Skip to content

Commit b0dd19b

Browse files
Rtoaxdkruces
authored andcommitted
tools/mountsnoop: Fix fsmount printing wrong flags (iovisor#5178)
fsmount(2) syscall 'flags' parameter only could be zero or FSMOUNT_CLOEXEC. Signed-off-by: Rong Tao <[email protected]>
1 parent 2b18d95 commit b0dd19b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tools/mountsnoop.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,10 @@
455455
('MS_NOUSER', 1 << 31),
456456
]
457457

458+
FSMOUNT_FLAGS = [
459+
('FSMOUNT_CLOEXEC', 0x00000001),
460+
]
461+
458462
MOUNT_ATTR_FLAGS = [
459463
('MOUNT_ATTR_RDONLY', 0x00000001),
460464
('MOUNT_ATTR_NOSUID', 0x00000002),
@@ -612,6 +616,11 @@ def decode_mount_flags(flags):
612616
str_flags.extend(_decode_flags(flags, MOUNT_FLAGS))
613617
return '|'.join(str_flags)
614618

619+
def decode_fsmount_flags(flags):
620+
str_flags = []
621+
str_flags.extend(_decode_flags(flags, FSMOUNT_FLAGS))
622+
return '|'.join(str_flags)
623+
615624
def decode_mount_attr_flags(flags):
616625
str_flags = []
617626
str_flags.extend(_decode_flags(flags, MOUNT_ATTR_FLAGS))
@@ -761,7 +770,7 @@ def print_event(mounts, umounts, parent, cpu, data, size):
761770
call = ('fsmount({fs_fd}, {flags}, {attr_flags}) ' +
762771
'= {retval}').format(
763772
fs_fd=syscall['fs_fd'],
764-
flags=decode_mount_flags(syscall['flags']),
773+
flags=decode_fsmount_flags(syscall['flags']),
765774
attr_flags=decode_mount_attr_flags(syscall['attr_flags']),
766775
retval=decode_errno(event.union.retval))
767776
elif event.type == EventType.EVENT_FSCONFIG_RET:

0 commit comments

Comments
 (0)