Skip to content

Commit e833f7d

Browse files
committed
Merge tag 'audit-pr-20250725' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit
Pull audit update from Paul Moore: "A single audit patch that restores logging of an audit event in the module load failure case" * tag 'audit-pr-20250725' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit: audit,module: restore audit logging in load failure case
2 parents dffb641 + ae1ae11 commit e833f7d

4 files changed

Lines changed: 10 additions & 9 deletions

File tree

include/linux/audit.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ extern int __audit_log_bprm_fcaps(struct linux_binprm *bprm,
417417
extern void __audit_log_capset(const struct cred *new, const struct cred *old);
418418
extern void __audit_mmap_fd(int fd, int flags);
419419
extern void __audit_openat2_how(struct open_how *how);
420-
extern void __audit_log_kern_module(char *name);
420+
extern void __audit_log_kern_module(const char *name);
421421
extern void __audit_fanotify(u32 response, struct fanotify_response_info_audit_rule *friar);
422422
extern void __audit_tk_injoffset(struct timespec64 offset);
423423
extern void __audit_ntp_log(const struct audit_ntp_data *ad);
@@ -519,7 +519,7 @@ static inline void audit_openat2_how(struct open_how *how)
519519
__audit_openat2_how(how);
520520
}
521521

522-
static inline void audit_log_kern_module(char *name)
522+
static inline void audit_log_kern_module(const char *name)
523523
{
524524
if (!audit_dummy_context())
525525
__audit_log_kern_module(name);
@@ -677,9 +677,8 @@ static inline void audit_mmap_fd(int fd, int flags)
677677
static inline void audit_openat2_how(struct open_how *how)
678678
{ }
679679

680-
static inline void audit_log_kern_module(char *name)
681-
{
682-
}
680+
static inline void audit_log_kern_module(const char *name)
681+
{ }
683682

684683
static inline void audit_fanotify(u32 response, struct fanotify_response_info_audit_rule *friar)
685684
{ }

kernel/audit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ struct audit_context {
200200
int argc;
201201
} execve;
202202
struct {
203-
char *name;
203+
const char *name;
204204
} module;
205205
struct {
206206
struct audit_ntp_data ntp_data;

kernel/auditsc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2864,7 +2864,7 @@ void __audit_openat2_how(struct open_how *how)
28642864
context->type = AUDIT_OPENAT2;
28652865
}
28662866

2867-
void __audit_log_kern_module(char *name)
2867+
void __audit_log_kern_module(const char *name)
28682868
{
28692869
struct audit_context *context = audit_context();
28702870

kernel/module/main.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3373,7 +3373,7 @@ static int load_module(struct load_info *info, const char __user *uargs,
33733373

33743374
module_allocated = true;
33753375

3376-
audit_log_kern_module(mod->name);
3376+
audit_log_kern_module(info->name);
33773377

33783378
/* Reserve our place in the list. */
33793379
err = add_unformed_module(mod);
@@ -3537,8 +3537,10 @@ static int load_module(struct load_info *info, const char __user *uargs,
35373537
* failures once the proper module was allocated and
35383538
* before that.
35393539
*/
3540-
if (!module_allocated)
3540+
if (!module_allocated) {
3541+
audit_log_kern_module(info->name ? info->name : "?");
35413542
mod_stat_bump_becoming(info, flags);
3543+
}
35423544
free_copy(info, flags);
35433545
return err;
35443546
}

0 commit comments

Comments
 (0)