From: Dmitry V. Levin Date: Tue, 16 Jun 2015 01:28:34 +0000 (+0000) Subject: mount: robustify MS_MGC_VAL decoding X-Git-Tag: v4.11~505 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c8cf5fed1d6829b5978e7e745178cec653bfb9b6;p=strace mount: robustify MS_MGC_VAL decoding * mount.c (sys_mount): When printing mount flags, do not assume that (flags & MS_MGC_MSK) == MS_MGC_VAL. --- diff --git a/mount.c b/mount.c index 7b30b371..2f7f0cae 100644 --- a/mount.c +++ b/mount.c @@ -35,17 +35,21 @@ SYS_FUNC(mount) { if (entering(tcp)) { - int ignore_type = 0, ignore_data = 0; + bool ignore_type = false; + bool ignore_data = false; + bool old_magic = false; unsigned long flags = tcp->u_arg[3]; /* Discard magic */ - if ((flags & MS_MGC_MSK) == MS_MGC_VAL) + if ((flags & MS_MGC_MSK) == MS_MGC_VAL) { flags &= ~MS_MGC_MSK; + old_magic = true; + } if (flags & MS_REMOUNT) - ignore_type = 1; + ignore_type = true; else if (flags & (MS_BIND | MS_MOVE)) - ignore_type = ignore_data = 1; + ignore_type = ignore_data = true; printpath(tcp, tcp->u_arg[0]); tprints(", "); @@ -59,7 +63,13 @@ SYS_FUNC(mount) printstr(tcp, tcp->u_arg[2], -1); tprints(", "); - printflags(mount_flags, tcp->u_arg[3], "MS_???"); + if (old_magic) { + tprints("MS_MGC_VAL"); + if (flags) + tprints("|"); + } + if (flags || !old_magic) + printflags(mount_flags, flags, "MS_???"); tprints(", "); if (ignore_data && tcp->u_arg[4])