Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp561780pxf; Thu, 11 Mar 2021 09:28:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJxpV4j7lwon0phMGqYj584rdlhgcKfyLsF0G4GxD652vVwupjXEqTuPLdWME8uTJFDLJVxp X-Received: by 2002:a17:906:7015:: with SMTP id n21mr4119748ejj.391.1615483728621; Thu, 11 Mar 2021 09:28:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615483728; cv=none; d=google.com; s=arc-20160816; b=WoyZ19yYuKtIPMvKqMfnyRc9MefvbAI2Z7KfErYjC5vjJo1bJlybWqCVBLdd5veyK3 vd3FH8f86rjpmiE5t8yiZ4o2gcz1nDqXNSBRp7S2wqEjYAO0rq4+opcxxRDFbI1n9y3R CNYYUhkh8nWNWfbV7Jstkeunx3CM0BG4JY7HVa2vVomzhjjsOy1sohzuj6fkB/Jkq/US rm6RF2YqxMtcYJRlTpcwdMXz9y+uXsjyonFEZBDZFuzu/38EGM83RhNnW8TXbjw8yiWi D01OoBNTCHfesdYTrMr2CLd0vkf63ZhgGf2NK59bFlZxz3/wBmI+xShksGbC6oop8EjK u3zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:dkim-signature:dkim-filter; bh=0es5nw/ggWUoYDySiqDbYKjmQxvlEcsoAK8a6oHJBbQ=; b=SflZWVjN8Jq6z51hMWg0PA4lrexs6xQE1YSc1yp7ymebEp1c9bp0pUD4GeyT90bfFV XG+UTNg3rxrjgWRXTfMaE5HkQL+W89+yBXMXn6KHbAMIOzoW0K/0yxGNM5Sa5Cmz++LY zJ1RAEC3BYXpwyQ3HCCG9SXHQP1cgIblJAz9xDPhFxeRBxrST9k4ewlk2RgyNr6/7AkO 08M5nwfHFTki0U8avLblt9JE1JhdPxibxfa4mzbPL6HU3cQ7LmKUOukbnMTtkNGhN3Ik cUz/KvoTBnbbVDfqcfsc+W05MC0LKRfnPT//vfgPxfN2khAni/jDyZzrvSr6bvTizNk6 b4sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=IeKl8IYr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id r20si2073926ejd.746.2021.03.11.09.28.26; Thu, 11 Mar 2021 09:28:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=IeKl8IYr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S229904AbhCKRZR (ORCPT + 99 others); Thu, 11 Mar 2021 12:25:17 -0500 Received: from mail.efficios.com ([167.114.26.124]:36842 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229729AbhCKRYq (ORCPT ); Thu, 11 Mar 2021 12:24:46 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 660EC28E668; Thu, 11 Mar 2021 12:24:45 -0500 (EST) Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id bFUnkYnH5NPu; Thu, 11 Mar 2021 12:24:45 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 0BC3028E931; Thu, 11 Mar 2021 12:24:45 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 0BC3028E931 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1615483485; bh=0es5nw/ggWUoYDySiqDbYKjmQxvlEcsoAK8a6oHJBbQ=; h=Date:From:To:Message-ID:MIME-Version; b=IeKl8IYrw42aGjiqrJEfGlXM2anjABzpfM/CVRUpHyaL7Z0jufWQ35tribep9SzTz f2vxuFsFA+/fagA50VRmNV1dsnmMtzwHS6qolrz41XnfQ1j5U1I20VcMBzxKUqz5fN g4vyWTMs8h/Ss6lT6tz9UaRDKSmCgpQ137OyJyzLwSocsmNtAjmBTvQDxjRoMvCssE X+sPtfiiUNkPsnDH2/VwXSi4EZV6QeEKYkXbG+mvHvDojgLi4PrUn6e/arUWVZr4PG DO0rNb5YOAWZbj1U9oeRa3QZugXtV19oHvd6QXB53CZ/CZf2eXy98mdpIC9yLrdL0T rG2oAia+8lA6Q== X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ptpoVccYqNze; Thu, 11 Mar 2021 12:24:44 -0500 (EST) Received: from mail03.efficios.com (mail03.efficios.com [167.114.26.124]) by mail.efficios.com (Postfix) with ESMTP id EAC7228E4FF; Thu, 11 Mar 2021 12:24:44 -0500 (EST) Date: Thu, 11 Mar 2021 12:24:44 -0500 (EST) From: Mathieu Desnoyers To: Peter Zijlstra Cc: Piotr Figiel , Andrew Morton , paulmck , Boqun Feng , Oleg Nesterov , "Dmitry V. Levin" , Florian Weimer , Alexey Dobriyan , Andrei Vagin , linux-kernel , Peter Oskolkov , Kamil Yurtsever , Chris Kennelly , Paul Turner , emmir , linux-man , linux-api Message-ID: <1972946676.5785.1615483484807.JavaMail.zimbra@efficios.com> In-Reply-To: References: <20210226135156.1081606-1-figiel@google.com> <1173189328.5477.1615474316906.JavaMail.zimbra@efficios.com> Subject: Re: [PATCH v2] ptrace: add PTRACE_GET_RSEQ_CONFIGURATION request MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [167.114.26.124] X-Mailer: Zimbra 8.8.15_GA_3996 (ZimbraWebClient - FF86 (Linux)/8.8.15_GA_4007) Thread-Topic: ptrace: add PTRACE_GET_RSEQ_CONFIGURATION request Thread-Index: bG+JyMYCodWp6UM/Hbxvt6m6jbkUEw== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On Mar 11, 2021, at 11:51 AM, Peter Zijlstra peterz@infradead.org wrote: > On Thu, Mar 11, 2021 at 09:51:56AM -0500, Mathieu Desnoyers wrote: >> >> >> ----- On Feb 26, 2021, at 8:51 AM, Piotr Figiel figiel@google.com wrote: >> >> > For userspace checkpoint and restore (C/R) a way of getting process state >> > containing RSEQ configuration is needed. >> > >> > There are two ways this information is going to be used: >> > - to re-enable RSEQ for threads which had it enabled before C/R >> > - to detect if a thread was in a critical section during C/R >> > >> > Since C/R preserves TLS memory and addresses RSEQ ABI will be restored >> > using the address registered before C/R. >> > >> > Detection whether the thread is in a critical section during C/R is needed >> > to enforce behavior of RSEQ abort during C/R. Attaching with ptrace() >> > before registers are dumped itself doesn't cause RSEQ abort. >> > Restoring the instruction pointer within the critical section is >> > problematic because rseq_cs may get cleared before the control is passed >> > to the migrated application code leading to RSEQ invariants not being >> > preserved. C/R code will use RSEQ ABI address to find the abort handler >> > to which the instruction pointer needs to be set. >> > >> > To achieve above goals expose the RSEQ ABI address and the signature value >> > with the new ptrace request PTRACE_GET_RSEQ_CONFIGURATION. >> > >> > This new ptrace request can also be used by debuggers so they are aware >> > of stops within restartable sequences in progress. >> > >> > Signed-off-by: Piotr Figiel >> > Reviewed-by: Michal Miroslaw >> >> Reviewed-by: Mathieu Desnoyers > > How do we route this? Do I stick this in tip/sched/core as being an rseq > patch? Sure, it's fine with me, thanks! Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com