Received: by 10.192.165.156 with SMTP id m28csp2339938imm; Thu, 12 Apr 2018 12:36:14 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/NI1jWhn7epqgqyUmYhSBLDSJDlk5mlXHWjoWc98fP9afeV7v2AZySmW8XxhWitv3elBB3 X-Received: by 10.99.148.17 with SMTP id m17mr1703272pge.140.1523561774557; Thu, 12 Apr 2018 12:36:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523561774; cv=none; d=google.com; s=arc-20160816; b=h+7aKiqEVzsxo3za4f2CrT9LVmPZ7aDfAP2xYMUH46oaSPYViwxtfDrif1UVLKNyqd ffS4KH7jqRsmj2P2Cc+X7b/6HTEmSIObTvHY5331bp17wqfxTO1FL4vPc+AR7lX0+YIj pfr563bwYZ8y5xj1V00Cf2HpnP9jtel+BApeW7jC8tcEZMFVRLeadCHngQnbfX76TYKm fvHWy8lVNBFShgy39iPomW93cgCWmRCgPhHVmVI40GXJ3b1DDqCFVdFmrdN0FLpfXuPp mrV4el6qWRV5NMlPoWrOjoK9n3Xtkf1K2d44tuQoaFdZSd1c+Q55YgsRYry4qlUWoPJu uVrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=jw+aai3i8f+9HwaB+VKlL+PrX5bMrkeKbIGHgTwkSh8=; b=GF9by8WkrIdskjLv+fsCy4pnXPHaTYmcUMrSZrSnnTVmcPz375DoML+aSIWkiMRjwx csEGMu4QGP4IEuIQwRAcEIz8GAK1xEFWB+7HZ12Ahy2c+hFvWSMtEVknie3/FXhx3lt9 NDgoxZ3R/W1FQr0FovXpgtkTWGTeQ1Dbsq8sN6MztTIKTn+VHb/OjTrMU3POzaga0tvu wZgO+kif76CPhbB4wqDcgh9hc163MgpOI+YULvbxF3dZ/hc0bZYGdpf7Y+zyWXjmvj3s J5pmgCJlNlCnQZrWMbq8rJwaZOa5Kh4ZFppjIFLhyQofnrP264z6z34mA3T/vDAxQ+dN 48Qw== 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 o2-v6si3793539pls.161.2018.04.12.12.36.00; Thu, 12 Apr 2018 12:36:14 -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 S1754094AbeDLTeI (ORCPT + 99 others); Thu, 12 Apr 2018 15:34:08 -0400 Received: from mail.efficios.com ([167.114.142.138]:45492 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752932AbeDLT2V (ORCPT ); Thu, 12 Apr 2018 15:28:21 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 119D31B069B; Thu, 12 Apr 2018 15:28:21 -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 6nciuENKTTlx; Thu, 12 Apr 2018 15:28:20 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id A43081B068F; Thu, 12 Apr 2018 15:28:20 -0400 (EDT) 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 OeBELndRMEhj; Thu, 12 Apr 2018 15:28:20 -0400 (EDT) Received: from thinkos.internal.efficios.com (192-222-157-41.qc.cable.ebox.net [192.222.157.41]) by mail.efficios.com (Postfix) with ESMTPSA id 458B01B0680; Thu, 12 Apr 2018 15:28:20 -0400 (EDT) From: Mathieu Desnoyers To: Peter Zijlstra , "Paul E . McKenney" , Boqun Feng , Andy Lutomirski , Dave Watson Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Paul Turner , Andrew Morton , Russell King , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Andrew Hunter , Andi Kleen , Chris Lameter , Ben Maurer , Steven Rostedt , Josh Triplett , Linus Torvalds , Catalin Marinas , Will Deacon , Michael Kerrisk , Mathieu Desnoyers Subject: [RFC PATCH for 4.18 03/23] arm: Add restartable sequences support Date: Thu, 12 Apr 2018 15:27:40 -0400 Message-Id: <20180412192800.15708-4-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180412192800.15708-1-mathieu.desnoyers@efficios.com> References: <20180412192800.15708-1-mathieu.desnoyers@efficios.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Call the rseq_handle_notify_resume() function on return to userspace if TIF_NOTIFY_RESUME thread flag is set. Perform fixup on the pre-signal frame when a signal is delivered on top of a restartable sequence critical section. Signed-off-by: Mathieu Desnoyers CC: Russell King CC: Catalin Marinas CC: Will Deacon CC: Thomas Gleixner CC: Paul Turner CC: Andrew Hunter CC: Peter Zijlstra CC: Andy Lutomirski CC: Andi Kleen CC: Dave Watson CC: Chris Lameter CC: Ingo Molnar CC: Ben Maurer CC: Steven Rostedt CC: "Paul E. McKenney" CC: Josh Triplett CC: Linus Torvalds CC: Andrew Morton CC: Boqun Feng CC: linux-api@vger.kernel.org --- arch/arm/Kconfig | 1 + arch/arm/kernel/signal.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 7e3d53575486..1897d40ddd87 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -90,6 +90,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(); -- 2.11.0