From 47669ab0361558a734e42f78196636d70201e44f Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sun, 23 Dec 2012 03:50:34 -0500 Subject: tile: switch to generic sigaltstack Signed-off-by: Al Viro --- arch/tile/include/asm/compat.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'arch/tile/include/asm/compat.h') diff --git a/arch/tile/include/asm/compat.h b/arch/tile/include/asm/compat.h index 88f3c227afd9..f11be1f2fe2f 100644 --- a/arch/tile/include/asm/compat.h +++ b/arch/tile/include/asm/compat.h @@ -281,8 +281,6 @@ long compat_sys_rt_sigaction(int sig, struct compat_sigaction __user *act, long compat_sys_rt_sigqueueinfo(int pid, int sig, struct compat_siginfo __user *uinfo); long compat_sys_rt_sigreturn(void); -long compat_sys_sigaltstack(const struct compat_sigaltstack __user *uss_ptr, - struct compat_sigaltstack __user *uoss_ptr); long compat_sys_truncate64(char __user *filename, u32 dummy, u32 low, u32 high); long compat_sys_ftruncate64(unsigned int fd, u32 dummy, u32 low, u32 high); long compat_sys_pread64(unsigned int fd, char __user *ubuf, size_t count, -- cgit v1.2.3 From 7b5d3c1d112d040b9eda239ec4ff247cf7102bd2 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Tue, 25 Dec 2012 15:28:39 -0500 Subject: tile: switch to generic compat rt_sigqueueinfo() Signed-off-by: Al Viro --- arch/tile/Kconfig | 1 + arch/tile/include/asm/compat.h | 2 -- arch/tile/kernel/compat_signal.c | 15 --------------- 3 files changed, 1 insertion(+), 17 deletions(-) (limited to 'arch/tile/include/asm/compat.h') diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig index cf33ba4992bb..f81b2755b4be 100644 --- a/arch/tile/Kconfig +++ b/arch/tile/Kconfig @@ -22,6 +22,7 @@ config TILE select GENERIC_CLOCKEVENTS select MODULES_USE_ELF_RELA select GENERIC_SIGALTSTACK + select GENERIC_COMPAT_RT_SIGQUEUEINFO select GENERIC_COMPAT_RT_SIGPROCMASK select GENERIC_COMPAT_RT_SIGPENDING diff --git a/arch/tile/include/asm/compat.h b/arch/tile/include/asm/compat.h index f11be1f2fe2f..e81b70d025dd 100644 --- a/arch/tile/include/asm/compat.h +++ b/arch/tile/include/asm/compat.h @@ -278,8 +278,6 @@ struct compat_sigaltstack; long compat_sys_rt_sigaction(int sig, struct compat_sigaction __user *act, struct compat_sigaction __user *oact, size_t sigsetsize); -long compat_sys_rt_sigqueueinfo(int pid, int sig, - struct compat_siginfo __user *uinfo); long compat_sys_rt_sigreturn(void); long compat_sys_truncate64(char __user *filename, u32 dummy, u32 low, u32 high); long compat_sys_ftruncate64(unsigned int fd, u32 dummy, u32 low, u32 high); diff --git a/arch/tile/kernel/compat_signal.c b/arch/tile/kernel/compat_signal.c index 6228be73cdf2..6773e620cbfc 100644 --- a/arch/tile/kernel/compat_signal.c +++ b/arch/tile/kernel/compat_signal.c @@ -97,21 +97,6 @@ out: return ret; } -long compat_sys_rt_sigqueueinfo(int pid, int sig, - struct compat_siginfo __user *uinfo) -{ - siginfo_t info; - int ret; - mm_segment_t old_fs = get_fs(); - - if (copy_siginfo_from_user32(&info, uinfo)) - return -EFAULT; - set_fs(KERNEL_DS); - ret = sys_rt_sigqueueinfo(pid, sig, (siginfo_t __force __user *)&info); - set_fs(old_fs); - return ret; -} - int copy_siginfo_to_user32(struct compat_siginfo __user *to, siginfo_t *from) { int err; -- cgit v1.2.3 From a402922bff5f28469ec6bbc5066bda3556299f52 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Tue, 25 Dec 2012 18:43:46 -0500 Subject: tile: switch to generic compat rt_sigaction() Signed-off-by: Al Viro --- arch/tile/Kconfig | 1 + arch/tile/include/asm/compat.h | 4 ---- arch/tile/kernel/compat_signal.c | 49 ---------------------------------------- 3 files changed, 1 insertion(+), 53 deletions(-) (limited to 'arch/tile/include/asm/compat.h') diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig index f81b2755b4be..96a717ebb1fa 100644 --- a/arch/tile/Kconfig +++ b/arch/tile/Kconfig @@ -22,6 +22,7 @@ config TILE select GENERIC_CLOCKEVENTS select MODULES_USE_ELF_RELA select GENERIC_SIGALTSTACK + select GENERIC_COMPAT_RT_SIGACTION select GENERIC_COMPAT_RT_SIGQUEUEINFO select GENERIC_COMPAT_RT_SIGPROCMASK select GENERIC_COMPAT_RT_SIGPENDING diff --git a/arch/tile/include/asm/compat.h b/arch/tile/include/asm/compat.h index e81b70d025dd..001d418a8957 100644 --- a/arch/tile/include/asm/compat.h +++ b/arch/tile/include/asm/compat.h @@ -272,12 +272,8 @@ extern int compat_setup_rt_frame(int sig, struct k_sigaction *ka, struct pt_regs *regs); /* Compat syscalls. */ -struct compat_sigaction; struct compat_siginfo; struct compat_sigaltstack; -long compat_sys_rt_sigaction(int sig, struct compat_sigaction __user *act, - struct compat_sigaction __user *oact, - size_t sigsetsize); long compat_sys_rt_sigreturn(void); long compat_sys_truncate64(char __user *filename, u32 dummy, u32 low, u32 high); long compat_sys_ftruncate64(unsigned int fd, u32 dummy, u32 low, u32 high); diff --git a/arch/tile/kernel/compat_signal.c b/arch/tile/kernel/compat_signal.c index 6773e620cbfc..d0a052e725be 100644 --- a/arch/tile/kernel/compat_signal.c +++ b/arch/tile/kernel/compat_signal.c @@ -34,13 +34,6 @@ #include #include -struct compat_sigaction { - compat_uptr_t sa_handler; - compat_ulong_t sa_flags; - compat_uptr_t sa_restorer; - sigset_t sa_mask __packed; -}; - struct compat_ucontext { compat_ulong_t uc_flags; compat_uptr_t uc_link; @@ -55,48 +48,6 @@ struct compat_rt_sigframe { struct compat_ucontext uc; }; -long compat_sys_rt_sigaction(int sig, struct compat_sigaction __user *act, - struct compat_sigaction __user *oact, - size_t sigsetsize) -{ - struct k_sigaction new_sa, old_sa; - int ret = -EINVAL; - - /* XXX: Don't preclude handling different sized sigset_t's. */ - if (sigsetsize != sizeof(sigset_t)) - goto out; - - if (act) { - compat_uptr_t handler, restorer; - - if (!access_ok(VERIFY_READ, act, sizeof(*act)) || - __get_user(handler, &act->sa_handler) || - __get_user(new_sa.sa.sa_flags, &act->sa_flags) || - __get_user(restorer, &act->sa_restorer) || - __copy_from_user(&new_sa.sa.sa_mask, &act->sa_mask, - sizeof(sigset_t))) - return -EFAULT; - new_sa.sa.sa_handler = compat_ptr(handler); - new_sa.sa.sa_restorer = compat_ptr(restorer); - } - - ret = do_sigaction(sig, act ? &new_sa : NULL, oact ? &old_sa : NULL); - - if (!ret && oact) { - if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) || - __put_user(ptr_to_compat(old_sa.sa.sa_handler), - &oact->sa_handler) || - __put_user(ptr_to_compat(old_sa.sa.sa_restorer), - &oact->sa_restorer) || - __put_user(old_sa.sa.sa_flags, &oact->sa_flags) || - __copy_to_user(&oact->sa_mask, &old_sa.sa.sa_mask, - sizeof(sigset_t))) - return -EFAULT; - } -out: - return ret; -} - int copy_siginfo_to_user32(struct compat_siginfo __user *to, siginfo_t *from) { int err; -- cgit v1.2.3 From 5a114b98661e3aaa0ac085eb931584dce3b0ef9b Mon Sep 17 00:00:00 2001 From: Chris Metcalf Date: Mon, 4 Mar 2013 11:19:09 -0500 Subject: tile: work around bug in the generic sys_llseek sys_llseek should specify the high and low 32-bit seek values as "unsigned int" but instead it specifies "unsigned long". Since compat syscall arguments are always sign-extended on tile, this means that a seek value of 0xffffffff will be incorrectly interpreted as a value of -1ULL. To avoid the risk of breaking binary compatibility on architectures that already use sys_llseek this way, we follow the same path as MIPS and provide a wrapper override. Signed-off-by: Chris Metcalf Cc: stable@kernel.org [v3.6 onwards] --- arch/tile/include/asm/compat.h | 3 +++ arch/tile/kernel/compat.c | 13 +++++++++++++ 2 files changed, 16 insertions(+) (limited to 'arch/tile/include/asm/compat.h') diff --git a/arch/tile/include/asm/compat.h b/arch/tile/include/asm/compat.h index 001d418a8957..78f1f2ded86c 100644 --- a/arch/tile/include/asm/compat.h +++ b/arch/tile/include/asm/compat.h @@ -288,6 +288,9 @@ long compat_sys_sync_file_range2(int fd, unsigned int flags, long compat_sys_fallocate(int fd, int mode, u32 offset_lo, u32 offset_hi, u32 len_lo, u32 len_hi); +long compat_sys_llseek(unsigned int fd, unsigned int offset_high, + unsigned int offset_low, loff_t __user * result, + unsigned int origin); /* Assembly trampoline to avoid clobbering r0. */ long _compat_sys_rt_sigreturn(void); diff --git a/arch/tile/kernel/compat.c b/arch/tile/kernel/compat.c index 7f72401b4f45..69034e215742 100644 --- a/arch/tile/kernel/compat.c +++ b/arch/tile/kernel/compat.c @@ -76,6 +76,18 @@ long compat_sys_fallocate(int fd, int mode, ((loff_t)len_hi << 32) | len_lo); } +/* + * Avoid bug in generic sys_llseek() that specifies offset_high and + * offset_low as "unsigned long", thus making it possible to pass + * a sign-extended high 32 bits in offset_low. + */ +long compat_sys_llseek(unsigned int fd, unsigned int offset_high, + unsigned int offset_low, loff_t __user * result, + unsigned int origin) +{ + return sys_llseek(fd, offset_high, offset_low, result, origin); +} + /* Provide the compat syscall number to call mapping. */ #undef __SYSCALL #define __SYSCALL(nr, call) [nr] = (call), @@ -83,6 +95,7 @@ long compat_sys_fallocate(int fd, int mode, /* See comments in sys.c */ #define compat_sys_fadvise64_64 sys32_fadvise64_64 #define compat_sys_readahead sys32_readahead +#define sys_llseek compat_sys_llseek /* Call the assembly trampolines where necessary. */ #define compat_sys_rt_sigreturn _compat_sys_rt_sigreturn -- cgit v1.2.3