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
3368 3368
3369 module_allocated = true;3369 module_allocated = true;
3370 3370
3371 audit_log_kern_module(mod->name);3371 audit_log_kern_module(info->name);
3372 3372
3373 /* Reserve our place in the list. */3373 /* Reserve our place in the list. */
3374 err = add_unformed_module(mod);3374 err = add_unformed_module(mod);
@@ -3532,8 +3532,10 @@ static int load_module(struct load_info *info, const char __user *uargs, · 157 unmodified lines
3532 * failures once the proper module was allocated and3532 * failures once the proper module was allocated and
3533 * before that.3533 * before that.
3534 */3534 */
3535 if (!module_allocated)3535 if (!module_allocated) {
3536 audit_log_kern_module(info->name ? info->name : "?");
3536 mod_stat_bump_becoming(info, flags);3537 mod_stat_bump_becoming(info, flags);
3538 }
3537 free_copy(info, flags);3539 free_copy(info, flags);
3538 return err;3540 return err;
3539}3541}