Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1671520

Re: [PATCH v10 2/3] arm/syscalls: Check address limit on user-mode return

From Will Deacon <will.deacon@arm.com>
Newsgroups linux.kernel
Subject Re: [PATCH v10 2/3] arm/syscalls: Check address limit on user-mode return
Date 2017-06-21 11:10 +0200
Message-ID <tUJOa-4bl-11@gated-at.bofh.it> (permalink)
References <tSrC1-4gc-3@gated-at.bofh.it> <tSrC1-4gc-5@gated-at.bofh.it> <tUxN1-4P5-31@gated-at.bofh.it> <tUy6m-4Vv-29@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Jun 20, 2017 at 01:31:14PM -0700, Thomas Garnier wrote:
> On Tue, Jun 20, 2017 at 1:18 PM, Kees Cook <keescook@chromium.org> wrote:
> > On Wed, Jun 14, 2017 at 6:12 PM, Thomas Garnier <thgarnie@google.com> wrote:
> >> diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
> >> index eb5cd77bf1d8..e33c32d56193 100644
> >> --- a/arch/arm/kernel/entry-common.S
> >> +++ b/arch/arm/kernel/entry-common.S
> >> @@ -41,7 +41,9 @@ ret_fast_syscall:
> >>   UNWIND(.cantunwind    )
> >>         disable_irq_notrace                     @ disable interrupts
> >>         ldr     r1, [tsk, #TI_FLAGS]            @ re-check for syscall tracing
> >> -       tst     r1, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK
> >> +       tst     r1, #_TIF_SYSCALL_WORK
> >> +       bne     fast_work_pending
> >> +       tst     r1, #_TIF_WORK_MASK
> >
> > (IIUC) MOV32 is 2 cycles (MOVW, MOVT), and each TST above is 1 cycle
> > and each BNE is 1 cycle (when not taken). So:
> >
> > mov32 r2, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK
> > tst r1, r2
> > bne fast_work_pending
> >
> > is 4 cycles and tst, bne, tst, bne is also 4 cycles. Would mov32 be
> > more readable (since it keeps the flags together)?
> 
> I guess it would be more readable. Any opinion from the arm folks?

The mov32 sequence is probably better, but statically attributing cycles
on a per instruction basis is pretty futile on modern CPUs.

Will

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH v10 2/3] arm/syscalls: Check address limit on user-mode return Kees Cook <keescook@chromium.org> - 2017-06-20 22:20 +0200
  Re: [PATCH v10 2/3] arm/syscalls: Check address limit on user-mode return Thomas Garnier <thgarnie@google.com> - 2017-06-20 22:40 +0200
    Re: [PATCH v10 2/3] arm/syscalls: Check address limit on user-mode  return Will Deacon <will.deacon@arm.com> - 2017-06-21 11:10 +0200

csiph-web