History

audit,module: restore audit logging in load failure case

The move of the module sanity check to earlier skipped the audit logging call in the case of failure and to a place where the previously used context is unavailable. Add an audit logging call for the module loading failure case and get the module name when possible.

Richard Guy Briggs committed 1 year ago

Commit ae1ae111 parent 19272b34 files · +10 −9Browse files

Showing the changes to kernel/module (1 of 4 files). Show all

Unified · Split

kernel/module/main.c+4−2
@@ -3368,7 +3368,7 @@ static int load_module(struct load_info *info, const char __user *uargs, · 3367 unmodified lines
33683368
33693369 module_allocated = true;
33703370
3371− audit_log_kern_module(mod->name);
3371+ audit_log_kern_module(info->name);
33723372
33733373 /* Reserve our place in the list. */
33743374 err = add_unformed_module(mod);
@@ -3532,8 +3532,10 @@ static int load_module(struct load_info *info, const char __user *uargs, · 157 unmodified lines
35323532 * failures once the proper module was allocated and
35333533 * before that.
35343534 */
3535− if (!module_allocated)
3535+ if (!module_allocated) {
3536+ audit_log_kern_module(info->name ? info->name : "?");
35363537 mod_stat_bump_becoming(info, flags);
3538+ }
35373539 free_copy(info, flags);
35383540 return err;
35393541 }