diff options
author | Helge Deller <deller@gmx.de> | 2014-07-10 12:07:17 -0400 |
---|---|---|
committer | Helge Deller <deller@gmx.de> | 2014-07-13 09:55:04 -0400 |
commit | ab8a261ba5e2dd9206da640de5870cc31d568a7c (patch) | |
tree | 424862537466a9371222f2f115949af18af1b110 /arch/parisc | |
parent | eadcc7208a2237016be7bdff4551ba7614da85c8 (diff) |
parisc: fix fanotify_mark() syscall on 32bit compat kernel
On parisc we can not use the existing compat implementation for fanotify_mark()
because for the 64bit mask parameter the higher and lower 32bits are ordered
differently than what the compat function expects from big endian
architectures.
Specifically:
It finally turned out, that on hppa we end up with different assignments
of parameters to kernel arguments depending on if we call the glibc
wrapper function
int fanotify_mark (int __fanotify_fd, unsigned int __flags,
uint64_t __mask, int __dfd, const char *__pathname);
or directly calling the syscall manually
syscall(__NR_fanotify_mark, ...)
Reason is, that the syscall() function is implemented as C-function and
because we now have the sysno as first parameter in front of the other
parameters the compiler will unexpectedly add an empty paramenter in
front of the u64 value to ensure the correct calling alignment for 64bit
values.
This means, on hppa you can't simply use syscall() to call the kernel
fanotify_mark() function directly, but you have to use the glibc
function instead.
This patch fixes the kernel in the hppa-arch specifc coding to adjust
the parameters in a way as if userspace calls the glibc wrapper function
fanotify_mark().
Signed-off-by: Helge Deller <deller@gmx.de>
Cc: stable@vger.kernel.org # 3.13+
Diffstat (limited to 'arch/parisc')
-rw-r--r-- | arch/parisc/kernel/sys_parisc32.c | 10 | ||||
-rw-r--r-- | arch/parisc/kernel/syscall_table.S | 2 |
2 files changed, 11 insertions, 1 deletions
diff --git a/arch/parisc/kernel/sys_parisc32.c b/arch/parisc/kernel/sys_parisc32.c index bb9f3b64de55..ec741fe02ab6 100644 --- a/arch/parisc/kernel/sys_parisc32.c +++ b/arch/parisc/kernel/sys_parisc32.c | |||
@@ -4,6 +4,7 @@ | |||
4 | * Copyright (C) 2000-2001 Hewlett Packard Company | 4 | * Copyright (C) 2000-2001 Hewlett Packard Company |
5 | * Copyright (C) 2000 John Marvin | 5 | * Copyright (C) 2000 John Marvin |
6 | * Copyright (C) 2001 Matthew Wilcox | 6 | * Copyright (C) 2001 Matthew Wilcox |
7 | * Copyright (C) 2014 Helge Deller <deller@gmx.de> | ||
7 | * | 8 | * |
8 | * These routines maintain argument size conversion between 32bit and 64bit | 9 | * These routines maintain argument size conversion between 32bit and 64bit |
9 | * environment. Based heavily on sys_ia32.c and sys_sparc32.c. | 10 | * environment. Based heavily on sys_ia32.c and sys_sparc32.c. |
@@ -57,3 +58,12 @@ asmlinkage long sys32_unimplemented(int r26, int r25, int r24, int r23, | |||
57 | current->comm, current->pid, r20); | 58 | current->comm, current->pid, r20); |
58 | return -ENOSYS; | 59 | return -ENOSYS; |
59 | } | 60 | } |
61 | |||
62 | asmlinkage long sys32_fanotify_mark(compat_int_t fanotify_fd, compat_uint_t flags, | ||
63 | compat_uint_t mask0, compat_uint_t mask1, compat_int_t dfd, | ||
64 | const char __user * pathname) | ||
65 | { | ||
66 | return sys_fanotify_mark(fanotify_fd, flags, | ||
67 | ((__u64)mask1 << 32) | mask0, | ||
68 | dfd, pathname); | ||
69 | } | ||
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S index 0c9107285e66..1a0c3bf61d26 100644 --- a/arch/parisc/kernel/syscall_table.S +++ b/arch/parisc/kernel/syscall_table.S | |||
@@ -418,7 +418,7 @@ | |||
418 | ENTRY_SAME(accept4) /* 320 */ | 418 | ENTRY_SAME(accept4) /* 320 */ |
419 | ENTRY_SAME(prlimit64) | 419 | ENTRY_SAME(prlimit64) |
420 | ENTRY_SAME(fanotify_init) | 420 | ENTRY_SAME(fanotify_init) |
421 | ENTRY_COMP(fanotify_mark) | 421 | ENTRY_DIFF(fanotify_mark) |
422 | ENTRY_COMP(clock_adjtime) | 422 | ENTRY_COMP(clock_adjtime) |
423 | ENTRY_SAME(name_to_handle_at) /* 325 */ | 423 | ENTRY_SAME(name_to_handle_at) /* 325 */ |
424 | ENTRY_COMP(open_by_handle_at) | 424 | ENTRY_COMP(open_by_handle_at) |