Skip to content

Commit

Permalink
only check ftrace_enabled if cred->security is to be remapped
Browse files Browse the repository at this point in the history
  • Loading branch information
Corey Henderson committed May 6, 2017
1 parent 67c7f42 commit 44e9f0a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 6 additions & 0 deletions fopskit.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ int fopskit_init_cred_security(struct fops_cred_handler *h) {
* it's up to the caller of fopskit to decide how to handle this, based on fopskit_cred_remapped */
if (fopskit_sym_int("selinux_enabled") == 1 || fopskit_sym_int("selinux_disabled") == 1) {

/* remapping cred->security is only safe if ftrace is enabled */
if (fopskit_sym_int("ftrace_enabled") != 1) {
printk("fopskit: nable to insert module, ftrace is not enabled.\n");
return -ENOSYS;
}

/* save off init->cred->security */
init_sec = init->cred->security;

Expand Down
7 changes: 0 additions & 7 deletions tpe_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,6 @@ static struct fops_cred_handler tpe_cred_handler = {
static int __init tpe_init(void) {
int i, ret;

ret = fopskit_sym_int("ftrace_enabled");

if (!ret || IN_ERR(ret)) {
printk(PKPRE "Unable to insert module, ftrace is not enabled.\n");
return -ENOSYS;
}

ret = fopskit_init_cred_security(&tpe_cred_handler);

if (IN_ERR(ret))
Expand Down

0 comments on commit 44e9f0a

Please sign in to comment.