public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] fix fanotify syscall check on compat kernel
@ 2014-04-16 19:00 Helge Deller
  2014-04-17  9:33 ` chrubis
  2014-04-17 16:57 ` chrubis
  0 siblings, 2 replies; 7+ messages in thread
From: Helge Deller @ 2014-04-16 19:00 UTC (permalink / raw)
  To: ltp-list

The fanotify[0-5] testcases use the myfanotify_mark() wrapper for the
fanotify_mark() syscall. But the #define does not take into account, that
the mask field is actually of type _u64 where we need to split the hi
and low word in the syscall on a 32bit arch.

The attached patch converts the #define to a inline function where
the compiler will help to convert the given values to the correct types
(e.g. unsigned long).

Bug found and tested on the parisc/hppa (32bit userspace with 64bit
kernel) arch.

Signed-off-by: Helge Deller <deller@gmx.de>

diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h
index a4c2a8f..b13cb7b 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify.h
+++ b/testcases/kernel/syscalls/fanotify/fanotify.h
@@ -28,12 +28,26 @@
 #ifndef	__FANOTIFY_H__
 #define	__FANOTIFY_H__
 
+#include <sys/types.h>
+#include <endian.h>
+#include "config.h"
+#include "linux_syscall_numbers.h"
+
 /* fanotify(7) wrappers */
 
 #define	myfanotify_init(flags, event_f_flags) \
 	syscall(__NR_fanotify_init, flags, event_f_flags)
 
-#define	myfanotify_mark(fd, flags, mask, dfd, pathname)	\
-	syscall(__NR_fanotify_mark, fd, flags, mask, dfd, pathname)
+long myfanotify_mark(int fd, unsigned int flags, unsigned long long mask, int dfd, const char *pathname)
+{
+#if __WORDSIZE == 64
+	return ltp_syscall(__NR_fanotify_mark, fd, flags, mask, dfd, pathname);
+#else
+	return ltp_syscall(__NR_fanotify_mark, fd, flags,
+			 __LONG_LONG_PAIR((unsigned long) (mask >> 32),
+					  (unsigned long) mask),
+			 dfd, (unsigned long) pathname);
+#endif
+}
 
 #endif /* __FANOTIFY_H__ */

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-04-22 11:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-16 19:00 [LTP] [PATCH] fix fanotify syscall check on compat kernel Helge Deller
2014-04-17  9:33 ` chrubis
     [not found]   ` <trinity-7fc052ce-4544-4fa4-afc0-9b68430ef693-1397729289569@3capp-gmx-bs62>
2014-04-17 10:16     ` chrubis
2014-04-17 13:27     ` chrubis
2014-04-17 15:00       ` chrubis
2014-04-17 16:57 ` chrubis
     [not found]   ` <5350E02B.7080104@gmx.de>
     [not found]     ` <20140418082553.GA3389@ls3530.fritz.box>
2014-04-22 11:57       ` chrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox