Skip to contentSkip to conversation

audit: add MOVE_MOUNT auxiliary record to log mount relocation

PATCH In review Ricardo Robaina 5 participants 10 messages Jul 13 – Aug 12

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 audit: add MOVE_MOUNT auxiliary record to log mount relocation

Modern mount tools (util-linux >= 2.39.1) use the new mount API (fsopen, fsconfig, fsmount, move_mount) instead of the legacy mount(2) syscall. The generic SYSCALL audit record logs the move_mount syscall but does not capture the flags argument, creating an audit gap for mount relocation operations.

Add a MOVE_MOUNT auxiliary record that logs the flags argument passed to move_mount(2). Pathnames and file descriptors are captured through existing PATH records and SYSCALL record arguments.

----
type=PATH : item=0 name=/mnt/test_src inode=1 dev=00:41 ... type=SYSCALL : arch=x86_64 syscall=move_mount ... type=MOVE_MOUNT : fs_flags=0x4
----
type=PATH : item=0 name=/mnt/test_dst inode=27460862 dev=fc:00 ... type=SYSCALL : arch=x86_64 syscall=move_mount ... type=MOVE_MOUNT : fs_flags=0x4

---
 fs/namespace.c             |  3 +++
 include/linux/audit.h      | 10 ++++++++++
 include/uapi/linux/audit.h |  1 +
 kernel/auditsc.c           | 13 +++++++++++++
 4 files changed, 27 insertions(+)
fs/namespace.c +3 -0
index 3d5cd5bf3b05..a6b0286744d9 100644
@@ -34,6 +34,7 @@
 #include <linux/mnt_idmapping.h>
 #include <linux/pidfs.h>
 #include <linux/nstree.h>
+#include <linux/audit.h>
 
 #include "pnode.h"
 #include "internal.h"
@@ -4625,6 +4626,8 @@ SYSCALL_DEFINE5(move_mount,
 	if (flags & MOVE_MOUNT_F_EMPTY_PATH)
 		uflags = AT_EMPTY_PATH;
 
+	audit_log_move_mount(flags);
+
 	CLASS(filename_maybe_null,from_name)(from_pathname, uflags);
 	if (!from_name && from_dfd >= 0) {
 		CLASS(fd_raw, f_from)(from_dfd);
include/linux/audit.h +10 -0
index 45abb3722d30..d1dc4035cb3c 100644
@@ -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_move_mount(unsigned int flags);
 
 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_move_mount(unsigned int flags)
+{
+	if (!audit_dummy_context())
+		__audit_log_move_mount(flags);
+}
+
 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_move_mount(unsigned int flags)
+{ }
+
 #define audit_n_rules 0
 #define audit_signals 0
 #endif /* CONFIG_AUDITSYSCALL */
include/uapi/linux/audit.h +1 -0
index e8f5ce677df7..40abf3dfd307 100644
@@ -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_MOVE_MOUNT	1342	/* Record showing move_mount flags */
 
 #define AUDIT_AVC		1400	/* SE Linux avc denial or grant */
 #define AUDIT_SELINUX_ERR	1401	/* Internal SE Linux Errors */
kernel/auditsc.c +13 -0
index 6610e667c728..4aca04d33d00 100644
@@ -2882,6 +2882,19 @@ void __audit_log_nfcfg(const char *name, u8 af, unsigned int nentries,
 }
 EXPORT_SYMBOL_GPL(__audit_log_nfcfg);
 
+void __audit_log_move_mount(unsigned int flags)
+{
+	struct audit_buffer *ab;
+
+	ab = audit_log_start(audit_context(), GFP_KERNEL,
+			     AUDIT_MOVE_MOUNT);
+	if (!ab)
+		return;
+
+	audit_log_format(ab, "fs_flags=0x%x", flags);
+	audit_log_end(ab);
+}
+
 static void audit_log_task(struct audit_buffer *ab)
 {
 	kuid_t auid, uid;
Signature · 1 line
2.53.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 19 lines · Ricardo Robaina

Modern mount tools (util-linux >= 2.39.1) use the new mount API (fsopen, fsconfig, fsmount, move_mount) instead of the legacy mount(2) syscall. The generic SYSCALL audit record logs the move_mount syscall but does not capture the flags argument, creating an audit gap for mount relocation operations.

Add a MOVE_MOUNT auxiliary record that logs the flags argument passed to move_mount(2). Pathnames and file descriptors are captured through existing PATH records and SYSCALL record arguments.

----
type=PATH : item=0 name=/mnt/test_src inode=1 dev=00:41 ... type=SYSCALL : arch=x86_64 syscall=move_mount ... type=MOVE_MOUNT : fs_flags=0x4
----
type=PATH : item=0 name=/mnt/test_dst inode=27460862 dev=fc:00 ... type=SYSCALL : arch=x86_64 syscall=move_mount ... type=MOVE_MOUNT : fs_flags=0x4

Quoted 3 lines
Quoted 101 lines
---
 fs/namespace.c             |  3 +++
 include/linux/audit.h      | 10 ++++++++++
 include/uapi/linux/audit.h |  1 +
 kernel/auditsc.c           | 13 +++++++++++++
 4 files changed, 27 insertions(+)
fs/namespace.c +3 -0
index 3d5cd5bf3b05..a6b0286744d9 100644
@@ -34,6 +34,7 @@
 #include <linux/mnt_idmapping.h>
 #include <linux/pidfs.h>
 #include <linux/nstree.h>
+#include <linux/audit.h>
 
 #include "pnode.h"
 #include "internal.h"
@@ -4625,6 +4626,8 @@ SYSCALL_DEFINE5(move_mount,
 	if (flags & MOVE_MOUNT_F_EMPTY_PATH)
 		uflags = AT_EMPTY_PATH;
 
+	audit_log_move_mount(flags);
+
 	CLASS(filename_maybe_null,from_name)(from_pathname, uflags);
 	if (!from_name && from_dfd >= 0) {
 		CLASS(fd_raw, f_from)(from_dfd);
include/linux/audit.h +10 -0
index 45abb3722d30..d1dc4035cb3c 100644
@@ -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_move_mount(unsigned int flags);
 
 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_move_mount(unsigned int flags)
+{
+	if (!audit_dummy_context())
+		__audit_log_move_mount(flags);
+}
+
 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_move_mount(unsigned int flags)
+{ }
+
 #define audit_n_rules 0
 #define audit_signals 0
 #endif /* CONFIG_AUDITSYSCALL */
include/uapi/linux/audit.h +1 -0
index e8f5ce677df7..40abf3dfd307 100644
@@ -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_MOVE_MOUNT	1342	/* Record showing move_mount flags */
 
 #define AUDIT_AVC		1400	/* SE Linux avc denial or grant */
 #define AUDIT_SELINUX_ERR	1401	/* Internal SE Linux Errors */
kernel/auditsc.c +13 -0
index 6610e667c728..4aca04d33d00 100644
@@ -2882,6 +2882,19 @@ void __audit_log_nfcfg(const char *name, u8 af, unsigned int nentries,
 }
 EXPORT_SYMBOL_GPL(__audit_log_nfcfg);
 
+void __audit_log_move_mount(unsigned int flags)
+{
+	struct audit_buffer *ab;
+
+	ab = audit_log_start(audit_context(), GFP_KERNEL,
+			     AUDIT_MOVE_MOUNT);
+	if (!ab)
+		return;
+
+	audit_log_format(ab, "fs_flags=0x%x", flags);
+	audit_log_end(ab);
+}
+
 static void audit_log_task(struct audit_buffer *ab)
 {
 	kuid_t auid, uid;
Signature · 1 line
2.53.0

- RGB

--
Richard Guy Briggs <[email protected]>
Sr. S/W Engineer, Kernel Security, Base Operating Systems Remote, Ottawa, Red Hat Canada
Upstream IRC: SunRaycer
Voice: +1.613.860 2354 SMS: +1.613.518.6570

maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Ricardo Robaina
Quoted 19 lines · Ricardo Robaina

Modern mount tools (util-linux >= 2.39.1) use the new mount API (fsopen, fsconfig, fsmount, move_mount) instead of the legacy mount(2) syscall. The generic SYSCALL audit record logs the move_mount syscall but does not capture the flags argument, creating an audit gap for mount relocation operations.

Add a MOVE_MOUNT auxiliary record that logs the flags argument passed to move_mount(2). Pathnames and file descriptors are captured through existing PATH records and SYSCALL record arguments.

----
type=PATH : item=0 name=/mnt/test_src inode=1 dev=00:41 ... type=SYSCALL : arch=x86_64 syscall=move_mount ... type=MOVE_MOUNT : fs_flags=0x4
----
type=PATH : item=0 name=/mnt/test_dst inode=27460862 dev=fc:00 ... type=SYSCALL : arch=x86_64 syscall=move_mount ... type=MOVE_MOUNT : fs_flags=0x4

Quoted 4 lines

---

maintainer
#3 lore raw
In reply to Ricardo Robaina
Quoted 23 lines · Ricardo Robaina

Modern mount tools (util-linux >= 2.39.1) use the new mount API (fsopen, fsconfig, fsmount, move_mount) instead of the legacy mount(2) syscall. The generic SYSCALL audit record logs the move_mount syscall but does not capture the flags argument, creating an audit gap for mount relocation operations.

Add a MOVE_MOUNT auxiliary record that logs the flags argument passed to move_mount(2). Pathnames and file descriptors are captured through existing PATH records and SYSCALL record arguments.

----
type=PATH : item=0 name=/mnt/test_src inode=1 dev=00:41 ... type=SYSCALL : arch=x86_64 syscall=move_mount ... type=MOVE_MOUNT : fs_flags=0x4
----
type=PATH : item=0 name=/mnt/test_dst inode=27460862 dev=fc:00 ... type=SYSCALL : arch=x86_64 syscall=move_mount ... type=MOVE_MOUNT : fs_flags=0x4

Quoted 6 lines
---
 fs/namespace.c             |  3 +++
 include/linux/audit.h      | 10 ++++++++++
 include/uapi/linux/audit.h |  1 +
 kernel/auditsc.c           | 13 +++++++++++++
 4 files changed, 27 insertions(+)

This is because we only log the first four syscall parameters, correct? To put this another way, if we logged all six syscall parameters this wouldn't be an issue, yes?

I'm aware of the argument for only logging the first four parameters, but I've always thought it was a rather foolish decision. Perhaps now is the time to spend to investigate adding those two missing parameters to the SYSCALL record so we don't have to worry about hacky workarounds like this (to be clear, I know this hacky workaround isn't your fault, you are just trying to make the best of a kludgy thing <g>).

Signature · 1 line
paul-moore.com
#4 lore raw
Quoted 22 lines · Paul Moore
Quoted 20 lines · Ricardo Robaina

Modern mount tools (util-linux >= 2.39.1) use the new mount API (fsopen, fsconfig, fsmount, move_mount) instead of the legacy mount(2) syscall. The generic SYSCALL audit record logs the move_mount syscall but does not capture the flags argument, creating an audit gap for mount relocation operations.

Add a MOVE_MOUNT auxiliary record that logs the flags argument passed to move_mount(2). Pathnames and file descriptors are captured through existing PATH records and SYSCALL record arguments.

----
type=PATH : item=0 name=/mnt/test_src inode=1 dev=00:41 ... type=SYSCALL : arch=x86_64 syscall=move_mount ... type=MOVE_MOUNT : fs_flags=0x4
----
type=PATH : item=0 name=/mnt/test_dst inode=27460862 dev=fc:00 ... type=SYSCALL : arch=x86_64 syscall=move_mount ... type=MOVE_MOUNT : fs_flags=0x4

Quoted 10 lines
Quoted 9 lines
---
 fs/namespace.c             |  3 +++
 include/linux/audit.h      | 10 ++++++++++
 include/uapi/linux/audit.h |  1 +
 kernel/auditsc.c           | 13 +++++++++++++
 4 files changed, 27 insertions(+)

Thanks for reviewing this patch, Paul!

Quoted 3 lines

This is because we only log the first four syscall parameters, correct? To put this another way, if we logged all six syscall parameters this wouldn't be an issue, yes?

Yes, that's correct.

Quoted 8 lines

I'm aware of the argument for only logging the first four parameters, but I've always thought it was a rather foolish decision. Perhaps now is the time to spend to investigate adding those two missing parameters to the SYSCALL record so we don't have to worry about hacky workarounds like this (to be clear, I know this hacky workaround isn't your fault, you are just trying to make the best of a kludgy thing <g>).

I completely agree that's the right thing to do, and I'm happy to hear that you'd be open to it.

I did a quick check and there are 100+ syscalls (~18% of the total) with more than 4 arguments
--around 67 of which pass audit-relevant scalars (flags, sizes,
modes) in the 5th or 6th position
that are currently lost.

I'll look into it. Please disregard this patch in the meantime.

Quoted 4 lines

--
paul-moore.com

-Ricardo

#5 lore raw
Quoted 2 lines · Eastern Daylight Time Ricardo Robaina
Quoted 1 line · Paul Moore

On Mon, Jul 13, 2026 at 1:00 PM Ricardo Robaina <[email protected]>

Quoted 30 lines · wrote:
Quoted 24 lines
Quoted 24 lines

Modern mount tools (util-linux >= 2.39.1) use the new mount API (fsopen, fsconfig, fsmount, move_mount) instead of the legacy mount(2) syscall. The generic SYSCALL audit record logs the move_mount syscall but does not capture the flags argument, creating an audit gap for mount relocation operations.

Add a MOVE_MOUNT auxiliary record that logs the flags argument passed to move_mount(2). Pathnames and file descriptors are captured through existing PATH records and SYSCALL record arguments.

----
type=PATH : item=0 name=/mnt/test_src inode=1 dev=00:41 ... type=SYSCALL : arch=x86_64 syscall=move_mount ... type=MOVE_MOUNT : fs_flags=0x4
----
type=PATH : item=0 name=/mnt/test_dst inode=27460862 dev=fc:00 ... type=SYSCALL : arch=x86_64 syscall=move_mount ... type=MOVE_MOUNT : fs_flags=0x4

---

Quoted 5 lines
Quoted 5 lines
 fs/namespace.c             |  3 +++
 include/linux/audit.h      | 10 ++++++++++
 include/uapi/linux/audit.h |  1 +
 kernel/auditsc.c           | 13 +++++++++++++
 4 files changed, 27 insertions(+)
Quoted 7 lines

Thanks for reviewing this patch, Paul!

Quoted 3 lines

This is because we only log the first four syscall parameters, correct? To put this another way, if we logged all six syscall parameters this wouldn't be an issue, yes?

Yes, that's correct.

I've been aiming to reply to this and lost the original...in the case of mmap, yes. If we had just 5 of the passed values, we would not need a supplemental record just to record the fd.

However, in many other syscalls, we only have pointers. Sometimes syscalls are designed to pass a structure with config items where some are security relevant. In those cases having all the args doesn't help and we still need the supplemental record.

-Steve

Quoted 23 lines
Quoted 7 lines

I'm aware of the argument for only logging the first four parameters, but I've always thought it was a rather foolish decision. Perhaps now is the time to spend to investigate adding those two missing parameters to the SYSCALL record so we don't have to worry about hacky workarounds like this (to be clear, I know this hacky workaround isn't your fault, you are just trying to make the best of a kludgy thing <g>).

I completely agree that's the right thing to do, and I'm happy to hear that you'd be open to it.

I did a quick check and there are 100+ syscalls (~18% of the total) with more than 4 arguments
--around 67 of which pass audit-relevant scalars (flags, sizes,
modes) in the 5th or 6th position
that are currently lost.

I'll look into it. Please disregard this patch in the meantime.

Quoted 2 lines

--
paul-moore.com

-Ricardo

maintainer
#6 lore raw
Quoted 43 lines · Steve Grubb
Quoted 2 lines · Eastern Daylight Time Ricardo Robaina
Quoted 1 line · Paul Moore

On Mon, Jul 13, 2026 at 1:00 PM Ricardo Robaina <[email protected]>

Quoted 30 lines · wrote:
Quoted 24 lines
Quoted 24 lines

Modern mount tools (util-linux >= 2.39.1) use the new mount API (fsopen, fsconfig, fsmount, move_mount) instead of the legacy mount(2) syscall. The generic SYSCALL audit record logs the move_mount syscall but does not capture the flags argument, creating an audit gap for mount relocation operations.

Add a MOVE_MOUNT auxiliary record that logs the flags argument passed to move_mount(2). Pathnames and file descriptors are captured through existing PATH records and SYSCALL record arguments.

----
type=PATH : item=0 name=/mnt/test_src inode=1 dev=00:41 ... type=SYSCALL : arch=x86_64 syscall=move_mount ... type=MOVE_MOUNT : fs_flags=0x4
----
type=PATH : item=0 name=/mnt/test_dst inode=27460862 dev=fc:00 ... type=SYSCALL : arch=x86_64 syscall=move_mount ... type=MOVE_MOUNT : fs_flags=0x4

---

Quoted 5 lines
Quoted 5 lines
 fs/namespace.c             |  3 +++
 include/linux/audit.h      | 10 ++++++++++
 include/uapi/linux/audit.h |  1 +
 kernel/auditsc.c           | 13 +++++++++++++
 4 files changed, 27 insertions(+)
Quoted 7 lines

Thanks for reviewing this patch, Paul!

Quoted 3 lines

This is because we only log the first four syscall parameters, correct? To put this another way, if we logged all six syscall parameters this wouldn't be an issue, yes?

Yes, that's correct.

Quoted 8 lines

I've been aiming to reply to this and lost the original...in the case of mmap, yes. If we had just 5 of the passed values, we would not need a supplemental record just to record the fd.

However, in many other syscalls, we only have pointers. Sometimes syscalls are designed to pass a structure with config items where some are security relevant. In those cases having all the args doesn't help and we still need the supplemental record.

True, but that is independent of logging all of the syscall parameters. In my opinion only logging the first four was a terrible mistake (I know you disagree Steve) and I'd just assume we correct that before we add an auxiliary record.

Signature · 1 line
paul-moore.com
maintainer
#7 lore raw
In reply to Ricardo Robaina
Quoted 52 lines · Ricardo Robaina
Quoted 21 lines · Paul Moore
Quoted 20 lines · Ricardo Robaina

Modern mount tools (util-linux >= 2.39.1) use the new mount API (fsopen, fsconfig, fsmount, move_mount) instead of the legacy mount(2) syscall. The generic SYSCALL audit record logs the move_mount syscall but does not capture the flags argument, creating an audit gap for mount relocation operations.

Add a MOVE_MOUNT auxiliary record that logs the flags argument passed to move_mount(2). Pathnames and file descriptors are captured through existing PATH records and SYSCALL record arguments.

----
type=PATH : item=0 name=/mnt/test_src inode=1 dev=00:41 ... type=SYSCALL : arch=x86_64 syscall=move_mount ... type=MOVE_MOUNT : fs_flags=0x4
----
type=PATH : item=0 name=/mnt/test_dst inode=27460862 dev=fc:00 ... type=SYSCALL : arch=x86_64 syscall=move_mount ... type=MOVE_MOUNT : fs_flags=0x4

Quoted 10 lines
Quoted 9 lines
---
 fs/namespace.c             |  3 +++
 include/linux/audit.h      | 10 ++++++++++
 include/uapi/linux/audit.h |  1 +
 kernel/auditsc.c           | 13 +++++++++++++
 4 files changed, 27 insertions(+)

Thanks for reviewing this patch, Paul!

Quoted 3 lines

This is because we only log the first four syscall parameters, correct? To put this another way, if we logged all six syscall parameters this wouldn't be an issue, yes?

Yes, that's correct.

Quoted 7 lines

I'm aware of the argument for only logging the first four parameters, but I've always thought it was a rather foolish decision. Perhaps now is the time to spend to investigate adding those two missing parameters to the SYSCALL record so we don't have to worry about hacky workarounds like this (to be clear, I know this hacky workaround isn't your fault, you are just trying to make the best of a kludgy thing <g>).

I completely agree that's the right thing to do, and I'm happy to hear that you'd be open to it.

Quoted 7 lines

I did a quick check and there are 100+ syscalls (~18% of the total) with more than 4 arguments
--around 67 of which pass audit-relevant scalars (flags, sizes,
modes) in the 5th or 6th position
that are currently lost.

I'll look into it. Please disregard this patch in the meantime.

Thanks Ricardo, I think this would be a great improvement!

I'm particularly curious to see what old/existing userspace tooling will do if we add the last two syscall arguments immediately after the first four. If we have to we can add them to the end, but if it doesn't break anything it would be preferable to add them inline with the other parameters.

Signature · 1 line
paul-moore.com
#8 lore raw
Quoted 1 line · Eastern Daylight Time Paul Moore

On Wed, Aug 12, 2026 at 10:40 AM Ricardo Robaina <[email protected]>

Quoted 2 lines · wrote:
Quoted 2 lines · Paul Moore
Quoted 1 line

On Mon, Jul 13, 2026 at 1:00 PM Ricardo Robaina <[email protected]>

Quoted 58 lines · wrote:
Quoted 58 lines
Quoted 25 lines
Quoted 25 lines

Modern mount tools (util-linux >= 2.39.1) use the new mount API (fsopen, fsconfig, fsmount, move_mount) instead of the legacy mount(2)
syscall. The generic SYSCALL audit record logs the move_mount syscall but does not capture the flags argument, creating an audit gap for mount relocation operations.

Add a MOVE_MOUNT auxiliary record that logs the flags argument passed to move_mount(2). Pathnames and file descriptors are captured through existing PATH records and SYSCALL record arguments.

----
type=PATH : item=0 name=/mnt/test_src inode=1 dev=00:41 ... type=SYSCALL : arch=x86_64 syscall=move_mount ... type=MOVE_MOUNT : fs_flags=0x4
----
type=PATH : item=0 name=/mnt/test_dst inode=27460862 dev=fc:00 ... type=SYSCALL : arch=x86_64 syscall=move_mount ... type=MOVE_MOUNT : fs_flags=0x4

---

Quoted 5 lines
Quoted 5 lines
 fs/namespace.c             |  3 +++
 include/linux/audit.h      | 10 ++++++++++
 include/uapi/linux/audit.h |  1 +
 kernel/auditsc.c           | 13 +++++++++++++
 4 files changed, 27 insertions(+)

Thanks for reviewing this patch, Paul!

Quoted 3 lines

This is because we only log the first four syscall parameters, correct? To put this another way, if we logged all six syscall parameters this wouldn't be an issue, yes?

Yes, that's correct.

Quoted 7 lines

I'm aware of the argument for only logging the first four parameters, but I've always thought it was a rather foolish decision. Perhaps now is the time to spend to investigate adding those two missing parameters to the SYSCALL record so we don't have to worry about hacky workarounds like this (to be clear, I know this hacky workaround isn't your fault, you are just trying to make the best of a kludgy thing <g>).

I completely agree that's the right thing to do, and I'm happy to hear that you'd be open to it.

I did a quick check and there are 100+ syscalls (~18% of the total) with more than 4 arguments

--around 67 of which pass audit-relevant scalars (flags, sizes,

modes) in the 5th or 6th position
that are currently lost.

Quoted 7 lines
Quoted 1 line

I'll look into it. Please disregard this patch in the meantime.

Thanks Ricardo, I think this would be a great improvement!

I'm particularly curious to see what old/existing userspace tooling will do if we add the last two syscall arguments immediately after the first four.

It would ignore them. During search, it grabs a0 and a1, then skips to ppid. In the output phase, it should also ignore them since there's no code to interpret them.

Quoted 3 lines

If we have to we can add them to the end, but if it doesn't break anything it would be preferable to add them inline with the other parameters.

I'd also prefer inline. That's the most natural view.

-Steve

#9 lore raw
Quoted 78 lines · Steve Grubb
Quoted 1 line · Eastern Daylight Time Paul Moore

On Wed, Aug 12, 2026 at 10:40 AM Ricardo Robaina <[email protected]>

Quoted 2 lines · wrote:
Quoted 2 lines · Paul Moore
Quoted 1 line

On Mon, Jul 13, 2026 at 1:00 PM Ricardo Robaina <[email protected]>

Quoted 58 lines · wrote:
Quoted 58 lines
Quoted 25 lines
Quoted 25 lines

Modern mount tools (util-linux >= 2.39.1) use the new mount API (fsopen, fsconfig, fsmount, move_mount) instead of the legacy mount(2)
syscall. The generic SYSCALL audit record logs the move_mount syscall but does not capture the flags argument, creating an audit gap for mount relocation operations.

Add a MOVE_MOUNT auxiliary record that logs the flags argument passed to move_mount(2). Pathnames and file descriptors are captured through existing PATH records and SYSCALL record arguments.

----
type=PATH : item=0 name=/mnt/test_src inode=1 dev=00:41 ... type=SYSCALL : arch=x86_64 syscall=move_mount ... type=MOVE_MOUNT : fs_flags=0x4
----
type=PATH : item=0 name=/mnt/test_dst inode=27460862 dev=fc:00 ... type=SYSCALL : arch=x86_64 syscall=move_mount ... type=MOVE_MOUNT : fs_flags=0x4

---

Quoted 5 lines
Quoted 5 lines
 fs/namespace.c             |  3 +++
 include/linux/audit.h      | 10 ++++++++++
 include/uapi/linux/audit.h |  1 +
 kernel/auditsc.c           | 13 +++++++++++++
 4 files changed, 27 insertions(+)

Thanks for reviewing this patch, Paul!

Quoted 3 lines

This is because we only log the first four syscall parameters, correct? To put this another way, if we logged all six syscall parameters this wouldn't be an issue, yes?

Yes, that's correct.

Quoted 7 lines

I'm aware of the argument for only logging the first four parameters, but I've always thought it was a rather foolish decision. Perhaps now is the time to spend to investigate adding those two missing parameters to the SYSCALL record so we don't have to worry about hacky workarounds like this (to be clear, I know this hacky workaround isn't your fault, you are just trying to make the best of a kludgy thing <g>).

I completely agree that's the right thing to do, and I'm happy to hear that you'd be open to it.

I did a quick check and there are 100+ syscalls (~18% of the total) with more than 4 arguments

--around 67 of which pass audit-relevant scalars (flags, sizes,

modes) in the 5th or 6th position
that are currently lost.

Quoted 7 lines
Quoted 1 line

I'll look into it. Please disregard this patch in the meantime.

Thanks Ricardo, I think this would be a great improvement!

I'm particularly curious to see what old/existing userspace tooling will do if we add the last two syscall arguments immediately after the first four.

It would ignore them. During search, it grabs a0 and a1, then skips to ppid. In the output phase, it should also ignore them since there's no code to interpret them.

Quoted 9 lines
Quoted 3 lines

If we have to we can add them to the end, but if it doesn't break anything it would be preferable to add them inline with the other parameters.

I'd also prefer inline. That's the most natural view.

-Steve

Thanks Paul and Steve, I agree that inline would be better as well.

I spent the afternoon working on this and already have a working draft. I'll do some extra tests and review it, but I believe I'll be able to post it over the next few days.

-Ricardo