kernel: fix filp_open on older kernel's kworker (#205)

On older kernel, kworker missing keyring from init process , and this
keyring is related to FBE , which causes filp_open return ENOKEY or
other errors.To fix this,just install init's keyring to per
kworkers.This works on Kernel 4.4 and 4.9.
This commit is contained in:
f19
2023-02-05 07:14:59 +08:00
committed by GitHub
parent cd33a6dd07
commit 0c322a33bc
5 changed files with 67 additions and 10 deletions

View File

@@ -1,6 +1,10 @@
#include "linux/version.h"
#include "linux/init.h"
#include "linux/fs.h"
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
#include "linux/key.h"
#include "linux/errno.h"
struct key *init_session_keyring = NULL;
#endif
ssize_t kernel_read_compat(struct file *p, void *buf, size_t count, loff_t *pos){
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
return kernel_read(p, buf, count, pos);