Skip to contentSkip to conversation

compat: fix sys_fanotify_mark

PATCH In review Heiko Carstens 3 participants 3 messages Jan 15, 2014 – Jan 16, 2014

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

PATCH 1/1 compat: fix sys_fanotify_mark

91c2e0bcae72 "unify compat fanotify_mark(2), switch to COMPAT_SYSCALL_DEFINE" added a new unified compat fanotify_mark syscall to be used by all architectures.
Unfortunately the unified version merges the split mask parameter in a wrong way: the lower and higher word got swapped.

This was discovered with glibc's tst-fanotify test case.

Cc "James E.J. Bottomley" <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Ralf Baechle <[email protected]>
Cc [email protected] # v3.10+
---
 fs/notify/fanotify/fanotify_user.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/notify/fanotify/fanotify_user.c +2 -2
index e44cb6427df3..6663511ab33a 100644
@@ -888,9 +888,9 @@ COMPAT_SYSCALL_DEFINE6(fanotify_mark,
 {
 	return sys_fanotify_mark(fanotify_fd, flags,
 #ifdef __BIG_ENDIAN
-				((__u64)mask1 << 32) | mask0,
-#else
 				((__u64)mask0 << 32) | mask1,
+#else
+				((__u64)mask1 << 32) | mask0,
 #endif
 				 dfd, pathname);
 }
Signature · 1 line
1.8.4.5
Acked-by on v1 1/1
#1 lore raw

From: Heiko Carstens <[email protected]>
Date: Wed, 15 Jan 2014 12:45:57 +0100

Quoted 8 lines

91c2e0bcae72 "unify compat fanotify_mark(2), switch to COMPAT_SYSCALL_DEFINE" added a new unified compat fanotify_mark syscall to be used by all architectures.
Unfortunately the unified version merges the split mask parameter in a wrong way: the lower and higher word got swapped.

This was discovered with glibc's tst-fanotify test case.

Quoted 8 lines
Cc "James E.J. Bottomley" <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Ralf Baechle <[email protected]>
Cc [email protected] # v3.10+
#2 lore raw
In reply to Heiko Carstens
Quoted 5 lines · Heiko Carstens

91c2e0bcae72 "unify compat fanotify_mark(2), switch to COMPAT_SYSCALL_DEFINE" added a new unified compat fanotify_mark syscall to be used by all architectures.
Unfortunately the unified version merges the split mask parameter in a wrong way: the lower and higher word got swapped.

Nice catch; ACK and that should go into -stable starting with 3.10.