aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-03-31 17:32:17 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-03-31 17:32:17 -0400
commit190f918660a69d1c56fd05dc8c6cbb8336a8a0af (patch)
tree2320b4aab7f048d97c35ac6ade5b7dedc71da89d /mm
parent176ab02d4916f09d5d8cb63372d142df4378cdea (diff)
parent1e4ec6217dcf4b26cf959b70298a3b990479c955 (diff)
Merge branch 'compat' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull s390 compat wrapper rework from Heiko Carstens: "S390 compat system call wrapper simplification work. The intention of this work is to get rid of all hand written assembly compat system call wrappers on s390, which perform proper sign or zero extension, or pointer conversion of compat system call parameters. Instead all of this should be done with C code eg by using Al's COMPAT_SYSCALL_DEFINEx() macro. Therefore all common code and s390 specific compat system calls have been converted to the COMPAT_SYSCALL_DEFINEx() macro. In order to generate correct code all compat system calls may only have eg compat_ulong_t parameters, but no unsigned long parameters. Those patches which change parameter types from unsigned long to compat_ulong_t parameters are separate in this series, but shouldn't cause any harm. The only compat system calls which intentionally have 64 bit parameters (preadv64 and pwritev64) in support of the x86/32 ABI haven't been changed, but are now only available if an architecture defines __ARCH_WANT_COMPAT_SYS_PREADV64/PWRITEV64. System calls which do not have a compat variant but still need proper zero extension on s390, like eg "long sys_brk(unsigned long brk)" will get a proper wrapper function with the new s390 specific COMPAT_SYSCALL_WRAPx() macro: COMPAT_SYSCALL_WRAP1(brk, unsigned long, brk); which generates the following code (simplified): asmlinkage long sys_brk(unsigned long brk); asmlinkage long compat_sys_brk(long brk) { return sys_brk((u32)brk); } Given that the C file which contains all the COMPAT_SYSCALL_WRAP lines includes both linux/syscall.h and linux/compat.h, it will generate build errors, if the declaration of sys_brk() doesn't match, or if there exists a non-matching compat_sys_brk() declaration. In addition this will intentionally result in a link error if somewhere else a compat_sys_brk() function exists, which probably should have been used instead. Two more BUILD_BUG_ONs make sure the size and type of each compat syscall parameter can be handled correctly with the s390 specific macros. I converted the compat system calls step by step to verify the generated code is correct and matches the previous code. In fact it did not always match, however that was always a bug in the hand written asm code. In result we get less code, less bugs, and much more sanity checking" * 'compat' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: (44 commits) s390/compat: add copyright statement compat: include linux/unistd.h within linux/compat.h s390/compat: get rid of compat wrapper assembly code s390/compat: build error for large compat syscall args mm/compat: convert to COMPAT_SYSCALL_DEFINE with changing parameter types kexec/compat: convert to COMPAT_SYSCALL_DEFINE with changing parameter types net/compat: convert to COMPAT_SYSCALL_DEFINE with changing parameter types ipc/compat: convert to COMPAT_SYSCALL_DEFINE with changing parameter types fs/compat: convert to COMPAT_SYSCALL_DEFINE with changing parameter types ipc/compat: convert to COMPAT_SYSCALL_DEFINE fs/compat: convert to COMPAT_SYSCALL_DEFINE security/compat: convert to COMPAT_SYSCALL_DEFINE mm/compat: convert to COMPAT_SYSCALL_DEFINE net/compat: convert to COMPAT_SYSCALL_DEFINE kernel/compat: convert to COMPAT_SYSCALL_DEFINE fs/compat: optional preadv64/pwrite64 compat system calls ipc/compat_sys_msgrcv: change msgtyp type from long to compat_long_t s390/compat: partial parameter conversion within syscall wrappers s390/compat: automatic zero, sign and pointer conversion of syscalls s390/compat: add sync_file_range and fallocate compat syscalls ...
Diffstat (limited to 'mm')
-rw-r--r--mm/mempolicy.c18
-rw-r--r--mm/process_vm_access.c26
2 files changed, 21 insertions, 23 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index f520b9da9c1f..4755c8576942 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1556,10 +1556,10 @@ SYSCALL_DEFINE5(get_mempolicy, int __user *, policy,
1556 1556
1557#ifdef CONFIG_COMPAT 1557#ifdef CONFIG_COMPAT
1558 1558
1559asmlinkage long compat_sys_get_mempolicy(int __user *policy, 1559COMPAT_SYSCALL_DEFINE5(get_mempolicy, int __user *, policy,
1560 compat_ulong_t __user *nmask, 1560 compat_ulong_t __user *, nmask,
1561 compat_ulong_t maxnode, 1561 compat_ulong_t, maxnode,
1562 compat_ulong_t addr, compat_ulong_t flags) 1562 compat_ulong_t, addr, compat_ulong_t, flags)
1563{ 1563{
1564 long err; 1564 long err;
1565 unsigned long __user *nm = NULL; 1565 unsigned long __user *nm = NULL;
@@ -1586,8 +1586,8 @@ asmlinkage long compat_sys_get_mempolicy(int __user *policy,
1586 return err; 1586 return err;
1587} 1587}
1588 1588
1589asmlinkage long compat_sys_set_mempolicy(int mode, compat_ulong_t __user *nmask, 1589COMPAT_SYSCALL_DEFINE3(set_mempolicy, int, mode, compat_ulong_t __user *, nmask,
1590 compat_ulong_t maxnode) 1590 compat_ulong_t, maxnode)
1591{ 1591{
1592 long err = 0; 1592 long err = 0;
1593 unsigned long __user *nm = NULL; 1593 unsigned long __user *nm = NULL;
@@ -1609,9 +1609,9 @@ asmlinkage long compat_sys_set_mempolicy(int mode, compat_ulong_t __user *nmask,
1609 return sys_set_mempolicy(mode, nm, nr_bits+1); 1609 return sys_set_mempolicy(mode, nm, nr_bits+1);
1610} 1610}
1611 1611
1612asmlinkage long compat_sys_mbind(compat_ulong_t start, compat_ulong_t len, 1612COMPAT_SYSCALL_DEFINE6(mbind, compat_ulong_t, start, compat_ulong_t, len,
1613 compat_ulong_t mode, compat_ulong_t __user *nmask, 1613 compat_ulong_t, mode, compat_ulong_t __user *, nmask,
1614 compat_ulong_t maxnode, compat_ulong_t flags) 1614 compat_ulong_t, maxnode, compat_ulong_t, flags)
1615{ 1615{
1616 long err = 0; 1616 long err = 0;
1617 unsigned long __user *nm = NULL; 1617 unsigned long __user *nm = NULL;
diff --git a/mm/process_vm_access.c b/mm/process_vm_access.c
index fd26d0433509..3c5cf68566ec 100644
--- a/mm/process_vm_access.c
+++ b/mm/process_vm_access.c
@@ -456,25 +456,23 @@ free_iovecs:
456 return rc; 456 return rc;
457} 457}
458 458
459asmlinkage ssize_t 459COMPAT_SYSCALL_DEFINE6(process_vm_readv, compat_pid_t, pid,
460compat_sys_process_vm_readv(compat_pid_t pid, 460 const struct compat_iovec __user *, lvec,
461 const struct compat_iovec __user *lvec, 461 compat_ulong_t, liovcnt,
462 unsigned long liovcnt, 462 const struct compat_iovec __user *, rvec,
463 const struct compat_iovec __user *rvec, 463 compat_ulong_t, riovcnt,
464 unsigned long riovcnt, 464 compat_ulong_t, flags)
465 unsigned long flags)
466{ 465{
467 return compat_process_vm_rw(pid, lvec, liovcnt, rvec, 466 return compat_process_vm_rw(pid, lvec, liovcnt, rvec,
468 riovcnt, flags, 0); 467 riovcnt, flags, 0);
469} 468}
470 469
471asmlinkage ssize_t 470COMPAT_SYSCALL_DEFINE6(process_vm_writev, compat_pid_t, pid,
472compat_sys_process_vm_writev(compat_pid_t pid, 471 const struct compat_iovec __user *, lvec,
473 const struct compat_iovec __user *lvec, 472 compat_ulong_t, liovcnt,
474 unsigned long liovcnt, 473 const struct compat_iovec __user *, rvec,
475 const struct compat_iovec __user *rvec, 474 compat_ulong_t, riovcnt,
476 unsigned long riovcnt, 475 compat_ulong_t, flags)
477 unsigned long flags)
478{ 476{
479 return compat_process_vm_rw(pid, lvec, liovcnt, rvec, 477 return compat_process_vm_rw(pid, lvec, liovcnt, rvec,
480 riovcnt, flags, 1); 478 riovcnt, flags, 1);