Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJcbSZFCKVVQAXu2WGojnjHmJp05sRCQQpv=dCSTYjezE+aeeQ@mail.gmail.com>
Date: Wed, 8 Mar 2017 14:33:47 -0800
From: Thomas Garnier <thgarnie@...gle.com>
To: Nicolas Pitre <nicolas.pitre@...aro.org>
Cc: Arnd Bergmann <arnd@...db.de>, David Howells <dhowells@...hat.com>, 
	Al Viro <viro@...iv.linux.org.uk>, Dave Hansen <dave.hansen@...el.com>, 
	René Nyffenegger <mail@...enyffenegger.ch>, 
	Andrew Morton <akpm@...ux-foundation.org>, Kees Cook <keescook@...omium.org>, 
	"Paul E . McKenney" <paulmck@...ux.vnet.ibm.com>, Petr Mladek <pmladek@...e.com>, 
	Andy Lutomirski <luto@...nel.org>, Ard Biesheuvel <ard.biesheuvel@...aro.org>, 
	Sebastian Andrzej Siewior <bigeasy@...utronix.de>, Sergey Senozhatsky <sergey.senozhatsky@...il.com>, 
	Helge Deller <deller@....de>, Rik van Riel <riel@...hat.com>, Ingo Molnar <mingo@...nel.org>, 
	John Stultz <john.stultz@...aro.org>, Thomas Gleixner <tglx@...utronix.de>, 
	Oleg Nesterov <oleg@...hat.com>, Stanislav Kinsburskiy <skinsbursky@...tuozzo.com>, 
	Pavel Tikhomirov <ptikhomirov@...tuozzo.com>, Stephen Smalley <sds@...ho.nsa.gov>, 
	Frederic Weisbecker <fweisbec@...il.com>, Ingo Molnar <mingo@...hat.com>, "H . Peter Anvin" <hpa@...or.com>, 
	Paolo Bonzini <pbonzini@...hat.com>, Dmitry Safonov <dsafonov@...tuozzo.com>, 
	Borislav Petkov <bp@...en8.de>, Josh Poimboeuf <jpoimboe@...hat.com>, Brian Gerst <brgerst@...il.com>, 
	Alexander Potapenko <glider@...gle.com>, Jan Beulich <JBeulich@...e.com>, 
	Russell King <linux@...linux.org.uk>, Will Deacon <will.deacon@....com>, 
	Catalin Marinas <catalin.marinas@....com>, Mark Rutland <mark.rutland@....com>, 
	James Morse <james.morse@....com>, Chris Metcalf <cmetcalf@...lanox.com>, 
	Laura Abbott <labbott@...hat.com>, Andre Przywara <andre.przywara@....com>, 
	Linux API <linux-api@...r.kernel.org>, LKML <linux-kernel@...r.kernel.org>, 
	"the arch/x86 maintainers" <x86@...nel.org>, linux-arm-kernel@...ts.infradead.org, 
	Kernel Hardening <kernel-hardening@...ts.openwall.com>
Subject: Re: [PATCH v1 3/4] arm/syscalls: Specific usage of verify_pre_usermode_state

Make sense, as discussed on patch number one, I will write custom
assembly for each architecture when BUG_ON is not required. I will try
to use macros to make it easier to read.

On Wed, Mar 8, 2017 at 2:05 PM, Nicolas Pitre <nicolas.pitre@...aro.org> wrote:
> On Wed, 8 Mar 2017, Thomas Garnier wrote:
>
>> Implement specific usage of verify_pre_usermode_state for user-mode
>> returns for arm.
>> ---
>> Based on next-20170308
>> ---
>>  arch/arm/Kconfig               | 1 +
>>  arch/arm/kernel/entry-common.S | 5 +++++
>>  2 files changed, 6 insertions(+)
>>
>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
>> index 0d4e71b42c77..704fd8f197fa 100644
>> --- a/arch/arm/Kconfig
>> +++ b/arch/arm/Kconfig
>> @@ -12,6 +12,7 @@ config ARM
>>       select ARCH_HAVE_CUSTOM_GPIO_H
>>       select ARCH_HAS_GCOV_PROFILE_ALL
>>       select ARCH_MIGHT_HAVE_PC_PARPORT
>> +     select ARCH_NO_SYSCALL_VERIFY_PRE_USERMODE_STATE
>>       select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
>>       select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT if CPU_V7
>>       select ARCH_SUPPORTS_ATOMIC_RMW
>> diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
>> index eb5cd77bf1d8..80cfdc7fabde 100644
>> --- a/arch/arm/kernel/entry-common.S
>> +++ b/arch/arm/kernel/entry-common.S
>> @@ -39,6 +39,9 @@
>>  ret_fast_syscall:
>>   UNWIND(.fnstart     )
>>   UNWIND(.cantunwind  )
>> +     push    {r0}                            @ save returned r0
>> +     bl      verify_pre_usermode_state
>> +     pop     {r0}                            @ restore r0
>>       disable_irq_notrace                     @ disable interrupts
>>       ldr     r1, [tsk, #TI_FLAGS]            @ re-check for syscall tracing
>>       tst     r1, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK
>
> This feature is configurable, right?
>
> Here the branch overhead is imposed even if the feature is configured
> out. You should consider conditionally defining a macro like some other
> features do.
>
> Furthermore I think we still support old toolchains that don't know what
> push and pop mean. You should use the legacy syntax instead.
>
>
> Nicolas



-- 
Thomas

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.