Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3288671imm; Thu, 17 May 2018 06:32:45 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpYsdZYFAxbgW/NQLWwsWpSHDTh3hqz4jMLUL+4OVQEgy4OYAnnsLc1ymUXaFHyOSTV9tg0 X-Received: by 2002:a17:902:8d8d:: with SMTP id v13-v6mr5176076plo.362.1526563965132; Thu, 17 May 2018 06:32:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526563965; cv=none; d=google.com; s=arc-20160816; b=xCB0mcitDPP+Qxa2WlrMsFYw5zlc3S8ap7yAp2xwqFgJEXkMhQyXx4TxfI3nElK98U oCK3LjAAoMQ5/BbgES2WH0SEl7/XzzT/iaQm2aVQFNVOHUpmeiaPVXVna5t186X4G/KS 5Erid1fNkWhHw3qbEl9+M+I/XdpYVd4SJ2q2Mcykh4wSvnxqFdxoe62GoPEHfC5cYIqM uuxZKQKaxlWRdFvSylqOAWUFqmUB+RR9yvhBtxwVdsH0UA++8hXPXJh4/JE/VC6agKY6 8EmgxRH6EXeaNUWZ6p6jt7lfuHDbEs87ahVXUj0Q6pMdtB0Ng04ZhATKIJts7ZbeYKq7 WZ1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=gUveDkXtRzP+3WP4pasOM9e4plZaGHlz1CQx0UHFE+Y=; b=wyqnNkuGzFvf4giL7muf70wmRwDNgG9L2W8TvZBpxt9X01OK/TTxKGOJ7SqCRFnpVl fuAuS67HHN+nyAKyc3MGEoHgrOKgKjPN1kVrR19rq1wyAisSn0iAftOwDM2aaaW2r8wO jda7DlJt6nsDoWJdmKgJBebSyev/8YCdEbtK+NxNS7yblbdog+oIdboY+AxXwbX/rUn9 UKSEUgYdqX5OV5eUeRHwTaaOFhkNYkQf1umytHzMK4q2pD7xCMSA+5OWMD4GRW6QbTeL P26ZDY4ZGYilsjR07rRarWP6f4K8KVKZeioNgJMlexOjEWl8Ll6QGysRaKp7uxEDyB91 Z+lg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 75-v6si5388229pfv.262.2018.05.17.06.32.30; Thu, 17 May 2018 06:32:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752221AbeEQNcO (ORCPT + 99 others); Thu, 17 May 2018 09:32:14 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:35848 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752073AbeEQNcF (ORCPT ); Thu, 17 May 2018 09:32:05 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 785A11529; Thu, 17 May 2018 06:32:05 -0700 (PDT) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 458663F53D; Thu, 17 May 2018 06:32:05 -0700 (PDT) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 5A7391AE2DFB; Thu, 17 May 2018 14:32:31 +0100 (BST) Date: Thu, 17 May 2018 14:32:31 +0100 From: Will Deacon To: Mathieu Desnoyers Cc: Peter Zijlstra , "Paul E. McKenney" , Boqun Feng , Andy Lutomirski , Dave Watson , linux-kernel , linux-api , Paul Turner , Andrew Morton , Russell King , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Andrew Hunter , Andi Kleen , Chris Lameter , Ben Maurer , rostedt , Josh Triplett , Linus Torvalds , Catalin Marinas , Michael Kerrisk , Joel Fernandes Subject: Re: [PATCH 03/14] arm: Add restartable sequences support Message-ID: <20180517133230.GA2688@arm.com> References: <20180430224433.17407-1-mathieu.desnoyers@efficios.com> <20180430224433.17407-4-mathieu.desnoyers@efficios.com> <20180516161809.GH12198@hirez.programming.kicks-ass.net> <670368504.1912.1526501593893.JavaMail.zimbra@efficios.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <670368504.1912.1526501593893.JavaMail.zimbra@efficios.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 16, 2018 at 04:13:13PM -0400, Mathieu Desnoyers wrote: > ----- On May 16, 2018, at 12:18 PM, Peter Zijlstra peterz@infradead.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? Will