Automated merge of 'audit/topic-7.3-audit_fsopen' into 'stable-7.4'

* audit/topic-7.3-audit_fsopen:
  audit: add FSOPEN record to log filesystem name
This commit is contained in:
Paul Moore 2026-10-16 09:33:42 -04:00
commit 7eef953fa6
4 changed files with 27 additions and 0 deletions

View File

@ -15,6 +15,7 @@
#include <linux/namei.h>
#include <linux/file.h>
#include <uapi/linux/mount.h>
#include <linux/audit.h>
#include "internal.h"
#include "mount.h"
@ -134,6 +135,8 @@ SYSCALL_DEFINE2(fsopen, const char __user *, _fs_name, unsigned int, flags)
if (IS_ERR(fs_name))
return PTR_ERR(fs_name);
audit_log_fsopen(fs_name);
fs_type = get_fs_type(fs_name);
kfree(fs_name);
if (!fs_type)

View File

@ -449,6 +449,7 @@ extern void __audit_tk_injoffset(struct timespec64 offset);
extern void __audit_ntp_log(const struct audit_ntp_data *ad);
extern void __audit_log_nfcfg(const char *name, u8 af, unsigned int nentries,
enum audit_nfcfgop op, gfp_t gfp);
extern void __audit_log_fsopen(const char *fs_name);
static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp)
{
@ -598,6 +599,12 @@ static inline void audit_log_nfcfg(const char *name, u8 af,
__audit_log_nfcfg(name, af, nentries, op, gfp);
}
static inline void audit_log_fsopen(const char *fs_name)
{
if (!audit_dummy_context())
__audit_log_fsopen(fs_name);
}
extern int audit_n_rules;
extern int audit_signals;
#else /* CONFIG_AUDITSYSCALL */
@ -730,6 +737,9 @@ static inline void audit_log_nfcfg(const char *name, u8 af,
enum audit_nfcfgop op, gfp_t gfp)
{ }
static inline void audit_log_fsopen(const char *fs_name)
{ }
#define audit_n_rules 0
#define audit_signals 0
#endif /* CONFIG_AUDITSYSCALL */

View File

@ -122,6 +122,7 @@
#define AUDIT_OPENAT2 1337 /* Record showing openat2 how args */
#define AUDIT_DM_CTRL 1338 /* Device Mapper target control */
#define AUDIT_DM_EVENT 1339 /* Device Mapper events */
#define AUDIT_FSOPEN 1340 /* Record showing fsopen fs_name arg */
#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */
#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */

View File

@ -2883,6 +2883,19 @@ void __audit_log_nfcfg(const char *name, u8 af, unsigned int nentries,
}
EXPORT_SYMBOL_GPL(__audit_log_nfcfg);
void __audit_log_fsopen(const char *fs_name)
{
struct audit_buffer *ab;
ab = audit_log_start(audit_context(), GFP_KERNEL, AUDIT_FSOPEN);
if (!ab)
return;
audit_log_format(ab, "fs_name=");
audit_log_untrustedstring(ab, fs_name);
audit_log_end(ab);
}
static void audit_log_task(struct audit_buffer *ab)
{
kuid_t auid, uid;