From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751855AbdFHPGa (ORCPT ); Thu, 8 Jun 2017 11:06:30 -0400 Received: from foss.arm.com ([217.140.101.70]:53232 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751463AbdFHPG1 (ORCPT ); Thu, 8 Jun 2017 11:06:27 -0400 Message-ID: <593967C0.4030904@arm.com> Date: Thu, 08 Jun 2017 16:05:36 +0100 From: James Morse User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.6.0 MIME-Version: 1.0 To: Yury Norov CC: Catalin Marinas , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Arnd Bergmann , Andrew Pinski , Andrew Pinski , Adam Borowski , Chris Metcalf , Steve Ellcey , Maxim Kuvyrkov , Ramana Radhakrishnan , Florian Weimer , Bamvor Zhangjian , Andreas Schwab , Chris Metcalf , Heiko Carstens , schwidefsky@de.ibm.com, broonie@kernel.org, Joseph Myers , christoph.muellner@theobroma-systems.com, szabolcs.nagy@arm.com, klimov.linux@gmail.com, Nathan_Lynch@mentor.com, agraf@suse.de, Prasun.Kapoor@caviumnetworks.com, geert@linux-m68k.org, philipp.tomsich@theobroma-systems.com, manuel.montezelo@gmail.com, linyongting@huawei.com, davem@davemloft.net, zhouchengming1@huawei.com, Andrew Pinski , Bamvor Jian Zhang Subject: Re: [PATCH 14/20] arm64: ilp32: add sys_ilp32.c and a separate table (in entry.S) to use it References: <20170604120009.342-1-ynorov@caviumnetworks.com> <20170604120009.342-15-ynorov@caviumnetworks.com> In-Reply-To: <20170604120009.342-15-ynorov@caviumnetworks.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Yury, On 04/06/17 13:00, Yury Norov wrote: > From: Andrew Pinski > > Add a separate syscall-table for ILP32, which dispatches either to native > LP64 system call implementation or to compat-syscalls, as appropriate. (I'm still reading through this series trying to understand it, but spotted this: ) > diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S > index 279bc2ab10c3..7d52fe1ec6bd 100644 > --- a/arch/arm64/kernel/entry.S > +++ b/arch/arm64/kernel/entry.S > @@ -577,6 +594,7 @@ el0_svc_compat: > * AArch32 syscall handling > */ > adrp stbl, compat_sys_call_table // load compat syscall table pointer > + ldr x16, [tsk, #TSK_TI_FLAGS] > uxtw scno, w7 // syscall number in w7 (r7) > mov sc_nr, #__NR_compat_syscalls > b el0_svc_naked > @@ -798,15 +816,21 @@ ENDPROC(ret_from_fork) > .align 6 > el0_svc: > adrp stbl, sys_call_table // load syscall table pointer > + ldr x16, [tsk, #TSK_TI_FLAGS] > uxtw scno, w8 // syscall number in w8 > mov sc_nr, #__NR_syscalls > +#ifdef CONFIG_ARM64_ILP32 > + tst x16, #_TIF_32BIT_AARCH64 > + b.eq el0_svc_naked // We are using LP64 syscall table > + adrp stbl, sys_call_ilp32_table // load ilp32 syscall table pointer > + delouse_input_regs > +#endif > el0_svc_naked: // compat entry point > stp x0, scno, [sp, #S_ORIG_X0] // save the original x0 and syscall number > enable_dbg_and_irq > ct_user_exit 1 > > - ldr x16, [tsk, #TSK_TI_FLAGS] // check for syscall hooks If built with CONFIG_CONTEXT_TRACKING, ct_user_exit will call context_tracking_user_exit(), this will clobber x16 which you depend on not changing below: > - tst x16, #_TIF_SYSCALL_WORK > + tst x16, #_TIF_SYSCALL_WORK // check for syscall hooks > b.ne __sys_trace > cmp scno, sc_nr // check upper syscall limit > b.hs ni_sys Thanks, James From mboxrd@z Thu Jan 1 00:00:00 1970 From: james.morse@arm.com (James Morse) Date: Thu, 08 Jun 2017 16:05:36 +0100 Subject: [PATCH 14/20] arm64: ilp32: add sys_ilp32.c and a separate table (in entry.S) to use it In-Reply-To: <20170604120009.342-15-ynorov@caviumnetworks.com> References: <20170604120009.342-1-ynorov@caviumnetworks.com> <20170604120009.342-15-ynorov@caviumnetworks.com> Message-ID: <593967C0.4030904@arm.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi Yury, On 04/06/17 13:00, Yury Norov wrote: > From: Andrew Pinski > > Add a separate syscall-table for ILP32, which dispatches either to native > LP64 system call implementation or to compat-syscalls, as appropriate. (I'm still reading through this series trying to understand it, but spotted this: ) > diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S > index 279bc2ab10c3..7d52fe1ec6bd 100644 > --- a/arch/arm64/kernel/entry.S > +++ b/arch/arm64/kernel/entry.S > @@ -577,6 +594,7 @@ el0_svc_compat: > * AArch32 syscall handling > */ > adrp stbl, compat_sys_call_table // load compat syscall table pointer > + ldr x16, [tsk, #TSK_TI_FLAGS] > uxtw scno, w7 // syscall number in w7 (r7) > mov sc_nr, #__NR_compat_syscalls > b el0_svc_naked > @@ -798,15 +816,21 @@ ENDPROC(ret_from_fork) > .align 6 > el0_svc: > adrp stbl, sys_call_table // load syscall table pointer > + ldr x16, [tsk, #TSK_TI_FLAGS] > uxtw scno, w8 // syscall number in w8 > mov sc_nr, #__NR_syscalls > +#ifdef CONFIG_ARM64_ILP32 > + tst x16, #_TIF_32BIT_AARCH64 > + b.eq el0_svc_naked // We are using LP64 syscall table > + adrp stbl, sys_call_ilp32_table // load ilp32 syscall table pointer > + delouse_input_regs > +#endif > el0_svc_naked: // compat entry point > stp x0, scno, [sp, #S_ORIG_X0] // save the original x0 and syscall number > enable_dbg_and_irq > ct_user_exit 1 > > - ldr x16, [tsk, #TSK_TI_FLAGS] // check for syscall hooks If built with CONFIG_CONTEXT_TRACKING, ct_user_exit will call context_tracking_user_exit(), this will clobber x16 which you depend on not changing below: > - tst x16, #_TIF_SYSCALL_WORK > + tst x16, #_TIF_SYSCALL_WORK // check for syscall hooks > b.ne __sys_trace > cmp scno, sc_nr // check upper syscall limit > b.hs ni_sys Thanks, James