lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 17 May 2018 11:30:01 -0400 (EDT)
From:   Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To:     Will Deacon <will.deacon@....com>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
        Boqun Feng <boqun.feng@...il.com>,
        Andy Lutomirski <luto@...capital.net>,
        Dave Watson <davejwatson@...com>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        linux-api <linux-api@...r.kernel.org>,
        Paul Turner <pjt@...gle.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Russell King <linux@....linux.org.uk>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        "H. Peter Anvin" <hpa@...or.com>, Andrew Hunter <ahh@...gle.com>,
        Andi Kleen <andi@...stfloor.org>, Chris Lameter <cl@...ux.com>,
        Ben Maurer <bmaurer@...com>, rostedt <rostedt@...dmis.org>,
        Josh Triplett <josh@...htriplett.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Catalin Marinas <catalin.marinas@....com>,
        Michael Kerrisk <mtk.manpages@...il.com>,
        Joel Fernandes <joelaf@...gle.com>
Subject: Re: [PATCH 03/14] arm: Add restartable sequences support

----- On May 17, 2018, at 9:32 AM, Will Deacon will.deacon@....com wrote:

> On Wed, May 16, 2018 at 04:13:13PM -0400, Mathieu Desnoyers wrote:
>> ----- On May 16, 2018, at 12:18 PM, Peter Zijlstra peterz@...radead.org wrote:
>> 
>> > On Mon, Apr 30, 2018 at 06:44:22PM -0400, Mathieu Desnoyers wrote:
>> >> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
>> >> index a7f8e7f4b88f..4f5c386631d4 100644
>> >> --- a/arch/arm/Kconfig
>> >> +++ b/arch/arm/Kconfig
>> >> @@ -91,6 +91,7 @@ config ARM
>> >>  	select HAVE_PERF_USER_STACK_DUMP
>> >>  	select HAVE_RCU_TABLE_FREE if (SMP && ARM_LPAE)
>> >>  	select HAVE_REGS_AND_STACK_ACCESS_API
>> >> +	select HAVE_RSEQ
>> >>  	select HAVE_SYSCALL_TRACEPOINTS
>> >>  	select HAVE_UID16
>> >>  	select HAVE_VIRT_CPU_ACCOUNTING_GEN
>> >> diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
>> >> index bd8810d4acb3..5879ab3f53c1 100644
>> >> --- a/arch/arm/kernel/signal.c
>> >> +++ b/arch/arm/kernel/signal.c
>> >> @@ -541,6 +541,12 @@ static void handle_signal(struct ksignal *ksig, struct
>> >> pt_regs *regs)
>> >>  	int ret;
>> >>  
>> >>  	/*
>> >> +	 * Increment event counter and perform fixup for the pre-signal
>> >> +	 * frame.
>> >> +	 */
>> >> +	rseq_signal_deliver(regs);
>> >> +
>> >> +	/*
>> >>  	 * Set up the stack frame
>> >>  	 */
>> >>  	if (ksig->ka.sa.sa_flags & SA_SIGINFO)
>> >> @@ -660,6 +666,7 @@ do_work_pending(struct pt_regs *regs, unsigned int
>> >> thread_flags, int syscall)
>> >>  			} else {
>> >>  				clear_thread_flag(TIF_NOTIFY_RESUME);
>> >>  				tracehook_notify_resume(regs);
>> >> +				rseq_handle_notify_resume(regs);
>> >>  			}
>> >>  		}
>> >>  		local_irq_disable();
>> > 
>> > I think you forgot to hook up rseq_syscall() checking.
>> 
>> Considering that rseq_syscall is implemented as follows:
>> 
>> +void rseq_syscall(struct pt_regs *regs)
>> +{
>> +       unsigned long ip = instruction_pointer(regs);
>> +       struct task_struct *t = current;
>> +       struct rseq_cs rseq_cs;
>> +
>> +       if (!t->rseq)
>> +               return;
>> +       if (!access_ok(VERIFY_READ, t->rseq, sizeof(*t->rseq)) ||
>> +           rseq_get_rseq_cs(t, &rseq_cs) || in_rseq_cs(ip, &rseq_cs))
>> +               force_sig(SIGSEGV, t);
>> +}
>> 
>> and that x86 calls it from syscall_return_slowpath() (which AFAIU is
>> now used in the fast-path since KPTI), I wonder where we should call
>> this on ARM ? I was under the impression that ARM return to userspace
>> fast-path was not calling C code unless work flags were set, but I might
>> be wrong.
>> 
>> Thoughts ?
> 
> Since this only matters for CONFIG_DEBUG_RSEQ, can we just force the
> slowpath for rseq tasks when that option is set?

Or as proposed by Boqun, we can simply call rseq_syscall in a CONFIG_DEBUG_RSEQ
ifdef. Given that this is a debug option, is it worth it to add the current->rseq
test for NULL in assembly before the call, or do we want to favor simplicity ?

Thanks,

Mathieu

> 
> Will

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ