From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756402AbcC2Ihe (ORCPT ); Tue, 29 Mar 2016 04:37:34 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:4025 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755960AbcC2Ifw (ORCPT ); Tue, 29 Mar 2016 04:35:52 -0400 From: Matt Redfearn To: CC: Matt Redfearn , Paul Burton , , , "Amanieu d'Antras" , "Ralf Baechle" , Alex Smith , "Andrew Morton" Subject: [PATCH v2 2/6] MIPS: Support sending SIG_SYS to 32bit userspace from 64bit kernel Date: Tue, 29 Mar 2016 09:35:30 +0100 Message-ID: <1459240534-8658-3-git-send-email-matt.redfearn@imgtec.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1459240534-8658-1-git-send-email-matt.redfearn@imgtec.com> References: <1459240534-8658-1-git-send-email-matt.redfearn@imgtec.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [192.168.154.116] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The seccomp_bpf self test revealed that a 64bit kernel delivered an invalid SIG_SYS to a 32bit userspace, because it was falling into the default of the switch statement. Add a case to handle delivering the signal. With this patch, the seccomp_bpf self test now passes the TRAP.handler case with O32 and N32 userlands. Signed-off-by: Matt Redfearn Cc: Paul Burton Cc: linux-mips@linux-mips.org --- Changes in v2: None arch/mips/kernel/signal32.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c index 4909639aa35b..78c8349d151c 100644 --- a/arch/mips/kernel/signal32.c +++ b/arch/mips/kernel/signal32.c @@ -227,6 +227,12 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from) err |= __put_user(from->si_uid, &to->si_uid); err |= __put_user(from->si_int, &to->si_int); break; + case __SI_SYS >> 16: + err |= __copy_to_user(&to->si_call_addr, &from->si_call_addr, + sizeof(compat_uptr_t)); + err |= __put_user(from->si_syscall, &to->si_syscall); + err |= __put_user(from->si_arch, &to->si_arch); + break; } } return err; -- 2.5.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailapp01.imgtec.com ([195.59.15.196]:8123 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP id S27025249AbcC2If5eTKFk (ORCPT ); Tue, 29 Mar 2016 10:35:57 +0200 From: Matt Redfearn Subject: [PATCH v2 2/6] MIPS: Support sending SIG_SYS to 32bit userspace from 64bit kernel Date: Tue, 29 Mar 2016 09:35:30 +0100 Message-ID: <1459240534-8658-3-git-send-email-matt.redfearn@imgtec.com> In-Reply-To: <1459240534-8658-1-git-send-email-matt.redfearn@imgtec.com> References: <1459240534-8658-1-git-send-email-matt.redfearn@imgtec.com> MIME-Version: 1.0 Content-Type: text/plain Return-Path: Sender: linux-mips-bounce@linux-mips.org Errors-to: linux-mips-bounce@linux-mips.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-subscribe: List-owner: List-post: List-archive: To: IMG-MIPSLinuxKerneldevelopers@imgtec.com Cc: Matt Redfearn , Paul Burton , linux-mips@linux-mips.org, linux-kernel@vger.kernel.org, Amanieu d'Antras , Ralf Baechle , Alex Smith , Andrew Morton Message-ID: <20160329083530.kTAucMyahrUGQisLhJY059prOJ1OMoyNFOwKWaZb9Uo@z> The seccomp_bpf self test revealed that a 64bit kernel delivered an invalid SIG_SYS to a 32bit userspace, because it was falling into the default of the switch statement. Add a case to handle delivering the signal. With this patch, the seccomp_bpf self test now passes the TRAP.handler case with O32 and N32 userlands. Signed-off-by: Matt Redfearn Cc: Paul Burton Cc: linux-mips@linux-mips.org --- Changes in v2: None arch/mips/kernel/signal32.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c index 4909639aa35b..78c8349d151c 100644 --- a/arch/mips/kernel/signal32.c +++ b/arch/mips/kernel/signal32.c @@ -227,6 +227,12 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from) err |= __put_user(from->si_uid, &to->si_uid); err |= __put_user(from->si_int, &to->si_int); break; + case __SI_SYS >> 16: + err |= __copy_to_user(&to->si_call_addr, &from->si_call_addr, + sizeof(compat_uptr_t)); + err |= __put_user(from->si_syscall, &to->si_syscall); + err |= __put_user(from->si_arch, &to->si_arch); + break; } } return err; -- 2.5.0