Fix syscall(__NR_fanotify_mark,...) on arm
authorChengwei Yang <chengwei.yang@intel.com>
Mon, 13 May 2013 09:58:28 +0000 (17:58 +0800)
committerChengwei Yang <chengwei.yang@intel.com>
Tue, 14 May 2013 04:26:27 +0000 (12:26 +0800)
In fanotify_mark definition, the third parameter __u64 mask should be
passed by r2/r3 on arm architecture. However, without a correct libc
wrapper, if it invoked directly by syscall, since FAN_OPEN defined as
uint32_t, it will pass the forth parameter through r3. So the kernel
will get wrong __u64 mask like below

sys_fanotify_mark: fanotify_fd=3 flags=1 dfd=33916 pathname=  (null) mask=ffffff9c00000020

The expected one should looks like

sys_fanotify_mark: fanotify_fd=3 flags=1 dfd=-100 pathname=00008488 mask=20

Please refer to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=%23618562

Change-Id: I0cbce0e05bdaa6a709406089c172ec09fab69d04
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com>
packaging/fix-syscall-NR_fanotify_mark-on-arm.patch [new file with mode: 0644]
packaging/systemd.spec

diff --git a/packaging/fix-syscall-NR_fanotify_mark-on-arm.patch b/packaging/fix-syscall-NR_fanotify_mark-on-arm.patch
new file mode 100644 (file)
index 0000000..d7f4d29
--- /dev/null
@@ -0,0 +1,13 @@
+diff --git a/src/missing.h b/src/missing.h
+index 213ef2f..c8f91ae 100644
+--- a/src/missing.h
++++ b/src/missing.h
+@@ -133,7 +133,7 @@ static inline int fanotify_init(unsigned int flags, unsigned int event_f_flags)
+
+ static inline int fanotify_mark(int fanotify_fd, unsigned int flags, uint64_t mask,
+                                 int dfd, const char *pathname) {
+-#if defined _MIPS_SIM && _MIPS_SIM == _MIPS_SIM_ABI32
++#if defined _MIPS_SIM && _MIPS_SIM == _MIPS_SIM_ABI32 || defined __arm__ && !defined __aarch64__
+         union {
+                 uint64_t _64;
+                 uint32_t _32[2];
index 8472293..cccc324 100644 (file)
@@ -22,7 +22,8 @@ Patch9:     main-allow-system-wide-limits-for-services.patch
 Patch10:    enable-core-dumps-globally.patch
 Patch11:    SMACK-Add-configuration-options.-v3.patch
 Patch12:    reboot_syscall_param.patch
-Patch13:       default_oom_score.patch
+Patch13:    default_oom_score.patch
+Patch14:    fix-syscall-NR_fanotify_mark-on-arm.patch
 
 BuildRequires:  pkgconfig(dbus-1) >= 1.4.0
 BuildRequires:  pkgconfig(dbus-glib-1)
@@ -178,6 +179,7 @@ This package includes the man pages for systemd.
 %patch11 -p1
 %patch12 -p1
 %patch13 -p1
+%patch14 -p1
 
 %build
 cp %{SOURCE1001} .