Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1072652imm; Fri, 15 Jun 2018 10:43:29 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLRoq0AkJBGbBD2PDz8E/Tbfim848tQ0cSzXaEyTKq8gbLXLvBUacEwkFq61tcL/swCe0jE X-Received: by 2002:a17:902:6802:: with SMTP id h2-v6mr3083126plk.113.1529084609847; Fri, 15 Jun 2018 10:43:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529084609; cv=none; d=google.com; s=arc-20160816; b=WpIo6E8ZO58q7jbPRTNSJRsY9UlVVptXB03u3u1nE0dyeRPAM7CI9oT+7G1OySbCtg 0XQ7CIAABY2FMnOmCfw37LPiSAg46wSG1smH9OF75+0/IWdbmvXn6GZQK+tI4cUkPEyV fZmoHlH3uEX0LQF2QY/G6+zRz+YHPvRQw4xCslTd0vOE1EGsp3Lyww9maz/+jnb6Qh/9 g7b15p4QltPaZz+ys9U+ZObazK0WvS2NI/P1NfVj4J3oiZ2ZbwSPCKCaxBqWUGp0OC5/ CzoUroIg1JVYGXSxnSMR4lx9f0TnUJoNzt4YXv5RycwPpfFf4PnzFrFxSSiyHk2G5uBe iu9w== 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=dz8Ek6hDwHt70bS7YLmPpMoAxFFm/jf4HkSRl36mccM=; b=Ucyqyw6uKO/qLaU2Q0KmcyrZLOvjMmOBYqNbbIQn3lD7PFnPmmunrLFJ/QaZMYTA7D QX7e9dfGSLp+ifMDsh0PzMsNgFAU2yADUrFFYWTn07z/L8qsSBZTX55BWlbY17IbLTdd DxTOiNTjW7/j8V0NjPOTxduxFOdNj2zD9nuv1MAhJMZrUjno0DXehHsq/eetMEHGPwIm kMjpdjBHb6lj5UAzpdDnktLU8mWxRih7wrvKNnpX+v28PaA8+UrJfUg5jBDUu8pkG1x3 iZjusHybGhI42diYjliyD3cQ8BiC5cns7PFrwto7wRW+kTxI+/Tr8Di5mLJtEDc7cINe oXxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=H8FYpyJh; 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 j1-v6si8114258plk.257.2018.06.15.10.43.15; Fri, 15 Jun 2018 10:43:29 -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=H8FYpyJh; 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 S966312AbeFORl2 (ORCPT + 99 others); Fri, 15 Jun 2018 13:41:28 -0400 Received: from mail.efficios.com ([167.114.142.138]:49978 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966130AbeFORl0 (ORCPT ); Fri, 15 Jun 2018 13:41:26 -0400 Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 44BF122B4F0; Fri, 15 Jun 2018 13:41:26 -0400 (EDT) Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id kGL2OF0fpHXa; Fri, 15 Jun 2018 13:41:25 -0400 (EDT) Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 5F60C22B4EA; Fri, 15 Jun 2018 13:41:25 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 5F60C22B4EA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1529084485; bh=dz8Ek6hDwHt70bS7YLmPpMoAxFFm/jf4HkSRl36mccM=; h=Date:From:To:Message-ID:MIME-Version; b=H8FYpyJhK5VzWqhFo287ExgnsIcSLgKNsVadyAoSKU+7nUNCv8YKOYKjl1/b6wKBM w3zr/fwp+87XCtVldCMZ2M8pLRXCWXV5g6zqdnzJyBm/txqnZlaq3ZlO3DLTOGpDHg d4LUWGtMsUwMPZsZuzb7yfuxGyJw9TmRw7h7aYF52GgdI6VutBKTi/Icxs3KwiKeE0 0fAaW2EWCFiltt3QcqMT6JA4+thOb007AnsR/zRP6Hz8+3uPySNYsr7zWgTe6PVbUd ZUvjOiHxbox4tZxGpEN/OULGOj53z5ORh+AiM1Ljg5skIv/QgtaxbsffPZV/eIq8cx Q5lFNcKhFTZ+g== X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id kYqJBTxNb_Jn; Fri, 15 Jun 2018 13:41:25 -0400 (EDT) Received: from mail02.efficios.com (mail02.efficios.com [167.114.142.138]) by mail.efficios.com (Postfix) with ESMTP id 4739822B4E0; Fri, 15 Jun 2018 13:41:25 -0400 (EDT) Date: Fri, 15 Jun 2018 13:41:25 -0400 (EDT) From: Mathieu Desnoyers To: Paul Burton Cc: linux-mips , Peter Zijlstra , James Hogan , linux-kernel , Boqun Feng , "Paul E. McKenney" , Ralf Baechle Message-ID: <1881638448.14415.1529084485237.JavaMail.zimbra@efficios.com> In-Reply-To: <20180614235211.31357-3-paul.burton@mips.com> References: <20180614235211.31357-1-paul.burton@mips.com> <20180614235211.31357-3-paul.burton@mips.com> Subject: Re: [PATCH 2/4] MIPS: Add syscall detection for restartable sequences 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_2096 (ZimbraWebClient - FF52 (Linux)/8.8.8_GA_1703) Thread-Topic: MIPS: Add syscall detection for restartable sequences Thread-Index: 8labt1W//S0SV+XkhJcEQoKv5WqiTg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On Jun 14, 2018, at 7:52 PM, Paul Burton paul.burton@mips.com wrote: > Syscalls are not allowed inside restartable sequences, so add a call to > rseq_syscall() at the very beginning of the system call exit path when > CONFIG_DEBUG_RSEQ=y. This will help us to detect whether there is a > syscall issued erroneously inside a restartable sequence. > > Signed-off-by: Paul Burton > Cc: James Hogan > Cc: Ralf Baechle > Cc: Mathieu Desnoyers > Cc: Peter Zijlstra > Cc: Paul E. McKenney > Cc: Boqun Feng > Cc: linux-mips@linux-mips.org > Cc: linux-kernel@vger.kernel.org > --- > > arch/mips/kernel/entry.S | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/arch/mips/kernel/entry.S b/arch/mips/kernel/entry.S > index 38a302919e6b..d7de8adcfcc8 100644 > --- a/arch/mips/kernel/entry.S > +++ b/arch/mips/kernel/entry.S > @@ -79,6 +79,10 @@ FEXPORT(ret_from_fork) > jal schedule_tail # a0 = struct task_struct *prev > > FEXPORT(syscall_exit) > +#ifdef CONFIG_DEBUG_RSEQ > + move a0, sp > + jal rseq_syscall > +#endif > local_irq_disable # make sure need_resched and > # signals dont change between > # sampling and return > @@ -141,6 +145,10 @@ work_notifysig: # deal with pending signals and > j resume_userspace_check > > FEXPORT(syscall_exit_partial) > +#ifdef CONFIG_DEBUG_RSEQ > + move a0, sp > + jal rseq_syscall > +#endif > local_irq_disable # make sure need_resched doesn't > # change between and return > LONG_L a2, TI_FLAGS($28) # current->work Just to double-check: you did test with CONFIG_DEBUG_RSEQ=y, right ? Are there any live registers that need to be saved before calling rseq_syscall ? Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com