From mboxrd@z Thu Jan 1 00:00:00 1970 From: will.deacon@arm.com (Will Deacon) Date: Wed, 19 Aug 2015 17:56:43 +0100 Subject: [PATCH] arm64: entry: always restore x0 from the stack on syscall return In-Reply-To: <20150819163504.GL24062@e104818-lin.cambridge.arm.com> References: <1439996989-5772-1-git-send-email-will.deacon@arm.com> <20150819160320.GI24062@e104818-lin.cambridge.arm.com> <20150819162359.GA10297@arm.com> <20150819163504.GL24062@e104818-lin.cambridge.arm.com> Message-ID: <20150819165643.GD10297@arm.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Wed, Aug 19, 2015 at 05:35:05PM +0100, Catalin Marinas wrote: > On Wed, Aug 19, 2015 at 05:23:59PM +0100, Will Deacon wrote: > > On Wed, Aug 19, 2015 at 05:03:20PM +0100, Catalin Marinas wrote: > > > There is another str x0 in __sys_trace_return which I think we could > > > remove. > > > > Hmm, I don't think we can remove that. It's needed on the slowpath to > > update the pt_regs with either -ENOSYS (for __ni_sys_trace) or the > > syscall return value from the blr in __sys_trace. > > > > What we can do instead is change the branch above to branch to > > __sys_trace_return_skipped. Patch below. > > > > Will > > > > --->8 > > > > diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S > > index 2a5e64ccc991..088322ff1ba0 100644 > > --- a/arch/arm64/kernel/entry.S > > +++ b/arch/arm64/kernel/entry.S > > @@ -619,7 +619,7 @@ ret_fast_syscall: > > kernel_exit 0 > > ret_fast_syscall_trace: > > enable_irq // enable interrupts > > - b __sys_trace_return > > + b __sys_trace_return_skipped // we already saved x0 > > That would do. With this added: > > Reviewed-by: Catalin Marinas > > (or I can take it for 4.2 but I'd like more testing like LTP) Yeah, I'll run some tests overnight and see how it holds up. Will From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com ([217.140.101.70]:53072 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751457AbbHSQ4q (ORCPT ); Wed, 19 Aug 2015 12:56:46 -0400 Date: Wed, 19 Aug 2015 17:56:43 +0100 From: Will Deacon To: Catalin Marinas Cc: Larry Bassel , Kevin Hilman , "stable@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "hanjun.guo@linaro.org" Subject: Re: [PATCH] arm64: entry: always restore x0 from the stack on syscall return Message-ID: <20150819165643.GD10297@arm.com> References: <1439996989-5772-1-git-send-email-will.deacon@arm.com> <20150819160320.GI24062@e104818-lin.cambridge.arm.com> <20150819162359.GA10297@arm.com> <20150819163504.GL24062@e104818-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150819163504.GL24062@e104818-lin.cambridge.arm.com> Sender: stable-owner@vger.kernel.org List-ID: On Wed, Aug 19, 2015 at 05:35:05PM +0100, Catalin Marinas wrote: > On Wed, Aug 19, 2015 at 05:23:59PM +0100, Will Deacon wrote: > > On Wed, Aug 19, 2015 at 05:03:20PM +0100, Catalin Marinas wrote: > > > There is another str x0 in __sys_trace_return which I think we could > > > remove. > > > > Hmm, I don't think we can remove that. It's needed on the slowpath to > > update the pt_regs with either -ENOSYS (for __ni_sys_trace) or the > > syscall return value from the blr in __sys_trace. > > > > What we can do instead is change the branch above to branch to > > __sys_trace_return_skipped. Patch below. > > > > Will > > > > --->8 > > > > diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S > > index 2a5e64ccc991..088322ff1ba0 100644 > > --- a/arch/arm64/kernel/entry.S > > +++ b/arch/arm64/kernel/entry.S > > @@ -619,7 +619,7 @@ ret_fast_syscall: > > kernel_exit 0 > > ret_fast_syscall_trace: > > enable_irq // enable interrupts > > - b __sys_trace_return > > + b __sys_trace_return_skipped // we already saved x0 > > That would do. With this added: > > Reviewed-by: Catalin Marinas > > (or I can take it for 4.2 but I'd like more testing like LTP) Yeah, I'll run some tests overnight and see how it holds up. Will