Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2460052imm; Wed, 16 May 2018 13:14:52 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoOA3legjoMPTD1FBM28If0i2jkPkpicsA5EpwCjImyi68oe6z+9St4Qu7ysJu8JhmsVnUo X-Received: by 2002:a17:902:2702:: with SMTP id c2-v6mr2260154plb.297.1526501692215; Wed, 16 May 2018 13:14:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526501692; cv=none; d=google.com; s=arc-20160816; b=hvI2qsehIh+WK8YwPugqgPGRAplfjzYjjSGm6LklRuS/r0kUv6ZxSxyk76x7K4suQ9 AvX9JAbY2pDJR3VpOjc3q/eS8jmyUTJvW9YztPG6M2dOW4BAlYNa+LxFuWHd9xk7yJff 76BFH/U3Wa4LaE//7LQIhKpucBec5RnUxxT5sfjq1mcE9sri587+QE6hj2LyBCalOkno JJN6F9GzZxLghEEQ5U7y0XkNVjKzxlTRyHRIEBlPlIF8BYwjkg54aCti6tRyI7I7sTli yAUOWbus/Myuc6bxC0GAFISo54tFxk8NDlD4NUwYcoLRWgWt23ZTf6ysU9al1h53PDzK j+Rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:dkim-signature:dkim-filter :arc-authentication-results; bh=dkb6bpq0Xh2WRSEXArVeu3YCAMm4pGSRBL5nGknEF8o=; b=J7+++bJsgCpudtj7xM6xtbMnpmd2qnTpEvo5jEsnZY7kY6yanN0pe4W1rSLUSFDXFN k+HM/jWDZsP6IO20twAiCOZXdWAwMHUTdGV7OaLaYAv5znODq+06kXgaBrBOtvTKPCfw hUUVr5xzbUxqRJ1UVKMPDYtSUhCXNiNYw7g8CogIy3iudNY+L9azwAeKnJExTJ3+1l5s keUA8C4s7auyHOYBpCHEkeS3zqsJWHuJTnd9bMAbmIXqGZDq0QKCPKVDWDYXFte1q8A/ U4dGTc9KnRIdnQcINqqYu67Yt8cqPc2sWgXyY6hORAbAeQO99rtU36ke8vpun/OK1enF 34Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=lhoNwRoT; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a64-v6si2651618pge.386.2018.05.16.13.14.37; Wed, 16 May 2018 13:14:52 -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; dkim=pass header.i=@efficios.com header.s=default header.b=lhoNwRoT; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751373AbeEPUNS (ORCPT + 99 others); Wed, 16 May 2018 16:13:18 -0400 Received: from mail.efficios.com ([167.114.142.138]:60836 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751038AbeEPUNP (ORCPT ); Wed, 16 May 2018 16:13:15 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id B46EB1C0552; Wed, 16 May 2018 16:13:14 -0400 (EDT) Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail02.efficios.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id ev5ClQHTyqF6; Wed, 16 May 2018 16:13:14 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 1AB961C0548; Wed, 16 May 2018 16:13:14 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 1AB961C0548 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1526501594; bh=dkb6bpq0Xh2WRSEXArVeu3YCAMm4pGSRBL5nGknEF8o=; h=Date:From:To:Message-ID:MIME-Version; b=lhoNwRoTtOe1BjZLnXO27bHoTdG7G9Ewwx/RSSCXcetmajOpUB/3KnnkmR+qvUHmx Y4DcW1rKzx3Qze61RvrWJ/dByFGY9+nN7X47QcZJMq+kq/H6OdPLe9ZaN3H1g6dDlk w+MprkAyxyroJp1qrArelSrxFTI8uMBunO/eNf4xdlSxEul0gaEINQzTsk1/iL303p x1B1fkt8vJgXKo4Sh0+OjXxY2JsOPoQbjRXpDK3NeSiOUoARthCiUX6+ivjvJ27yY6 BUbefgTEoh+BgabM+rtBP5AUbN887e5ZZtATNjVAkIBH8DzUhCM39+nl5ipt+2mVff 0j08ia9q8+0fw== X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail02.efficios.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id jNuUvczm9PFp; Wed, 16 May 2018 16:13:14 -0400 (EDT) Received: from mail02.efficios.com (mail02.efficios.com [167.114.142.138]) by mail.efficios.com (Postfix) with ESMTP id F39DB1C0541; Wed, 16 May 2018 16:13:13 -0400 (EDT) Date: Wed, 16 May 2018 16:13:13 -0400 (EDT) From: Mathieu Desnoyers To: Peter Zijlstra Cc: "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 , Will Deacon , Michael Kerrisk , Joel Fernandes Message-ID: <670368504.1912.1526501593893.JavaMail.zimbra@efficios.com> In-Reply-To: <20180516161809.GH12198@hirez.programming.kicks-ass.net> References: <20180430224433.17407-1-mathieu.desnoyers@efficios.com> <20180430224433.17407-4-mathieu.desnoyers@efficios.com> <20180516161809.GH12198@hirez.programming.kicks-ass.net> Subject: Re: [PATCH 03/14] arm: Add restartable sequences support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [167.114.142.138] X-Mailer: Zimbra 8.8.8_GA_2026 (ZimbraWebClient - FF52 (Linux)/8.8.8_GA_2031) Thread-Topic: Add restartable sequences support Thread-Index: JwDnrosDtRXGkL2/HdIoZluMjdpT5w== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- 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 ? Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com