Received: by 10.192.165.156 with SMTP id m28csp1007475imm; Mon, 16 Apr 2018 12:22:43 -0700 (PDT) X-Google-Smtp-Source: AIpwx49JWmxAjSsRFVZVssoErUsRaOm0m6n4c6TvXo8cykxYDyqlqHyh7kR3K1J8xIjQDTVw5zT3 X-Received: by 10.98.157.157 with SMTP id a29mr22678887pfk.39.1523906563681; Mon, 16 Apr 2018 12:22:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523906563; cv=none; d=google.com; s=arc-20160816; b=Pbib2dkMKuiqL+viXtcg0+fTML5dunqjiEABWHu9KuwJ8WkBTzzzRlGMm6RBs1/cS/ 6AbvEvdEnvcD4CBzbvsx2WbfIPNlhkD8FZRyRMCuwceayw0q7YuWks4emfJ9gT1nnUbO dV18Aq/ZswKo7oOtnIqquboiZX+ZXNuhRas+FMhnFF0Z1rGmuAY57zSJwR4eaF1uzSHx AweBdd3Du0dMW4pH/ekCwET09AJAtqmynGpSfFV1DqWJPO1GpcBY2fDrKAxVdNQ1Bz3q oMzl5cHot033sVW5k45aa9iKE/eXRsqJyss8F2P7ICIfJgzo4r5jHVT1ok0PUfH65lBc nn1Q== 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:arc-authentication-results; bh=Ho6m+qO1ay2TpOlytW+K7glsI+DDSg/nmrik5dtlSJc=; b=ERfB4uPgSp5AM0ZxQtp37kN5kWR1CBAhB8wFmM956rXBKPbk1GsoK4heCinHvZOtjA 00/uijbPpQccj6M+skbU2UUKmIUtF05ucoRw4+pkcXEGxRdHcNtiCAqF6/RV45PpoXd2 6WpO1HOLYyw+GnMI8BEUaEDOP+7yKXfVo8CxljqZdyK2oHJGK9B3QklQ92rX5wkVjJWy BrKL0QekLMa/6GZrWTe4MUVWbyHgodJkkHm7VY6gr6CA0v9RctQb6FNrHqofpDMBz4Uo 7R2nPfSBBu2QiwpWklHvP5xFgslToRBILW4fwFDKJY8Ewh1kI9vNs+4ZQSDwmEkRvO0I v2UQ== 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 64-v6si1615806plb.574.2018.04.16.12.22.29; Mon, 16 Apr 2018 12:22:43 -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 S1753331AbeDPTVX (ORCPT + 99 others); Mon, 16 Apr 2018 15:21:23 -0400 Received: from mail.efficios.com ([167.114.142.138]:48204 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751146AbeDPTVV (ORCPT ); Mon, 16 Apr 2018 15:21:21 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 8CA411B1EBB; Mon, 16 Apr 2018 15:21:20 -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 YhVgjxKanV96; Mon, 16 Apr 2018 15:21:19 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 5A3D01B1EB4; Mon, 16 Apr 2018 15:21:19 -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 8pjRS5DN4526; Mon, 16 Apr 2018 15:21:19 -0400 (EDT) Received: from mail02.efficios.com (mail02.efficios.com [167.114.142.138]) by mail.efficios.com (Postfix) with ESMTP id 3C7E61B1EAB; Mon, 16 Apr 2018 15:21:19 -0400 (EDT) Date: Mon, 16 Apr 2018 15:21:19 -0400 (EDT) From: Mathieu Desnoyers To: Linus Torvalds Cc: Andy Lutomirski , Peter Zijlstra , "Paul E. McKenney" , Boqun Feng , 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 , Catalin Marinas , Will Deacon , Michael Kerrisk Message-ID: <435471300.11403.1523906479091.JavaMail.zimbra@efficios.com> In-Reply-To: References: <20180412192800.15708-1-mathieu.desnoyers@efficios.com> <20180412192800.15708-13-mathieu.desnoyers@efficios.com> <542721578.11358.1523903708510.JavaMail.zimbra@efficios.com> Subject: Re: [RFC PATCH for 4.18 12/23] cpu_opv: Provide cpu_opv system call (v7) 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.7_GA_1964 (ZimbraWebClient - FF52 (Linux)/8.8.7_GA_1964) Thread-Topic: cpu_opv: Provide cpu_opv system call (v7) Thread-Index: Ff77n1/BvNFIfE8ClB/Y79KRWce7Gg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On Apr 16, 2018, at 2:39 PM, Linus Torvalds torvalds@linux-foundation.org wrote: > On Mon, Apr 16, 2018 at 11:35 AM, Mathieu Desnoyers > wrote: >> Specifically for single-stepping, the __rseq_table section introduced >> at user-level will allow newer debuggers and tools which do line and >> instruction-level single-stepping to skip over rseq critical sections. >> However, this breaks existing debuggers and tools. > > I really don't think single-stepping is a valid argument. > > Even if the cpu_opv() allows you to "single step", you're not actually > single stepping the same thing that you're using. So you are literally > debugging something else than the real code. > > At that point, you don't need "cpu_opv()", you need to just load > /dev/urandom in a buffer, and single-step that. Ta-daa! No new kernel > functionality needed. > > So if the main argument for cpu_opv is single-stepping, then just rip > it out. It's not useful. No, single-stepping is not the only use-case. Accessing remote cpu data is another use-case fulfilled by cpu_opv, which I think is more compelling. > > Anybody who cares deeply about single-stepping shouldn't be using > optimistic algorithms, and they shouldn't be doing multi-threaded > stuff either. They won't be able to use things like transactional > memory either. > > You can't single-step into the kernel to see what the kernel does > either when you're debugging something. > > News at 11: "single stepping isn't always viable". I don't mind if people cannot stop the program with a debugger and observe the state of registers manually at each step though a rseq critical section. I do mind breaking existing tools that rely on single-stepping approaches to automatically analyze program behavior [1,2]. Introducing a rseq critical section into a library (e.g. glibc memory allocator) would cause existing programs being analyzed with existing tools to hang. And I try very hard to avoid being told I'm the one breaking user-space. ;-) Thanks, Mathieu [1] http://rr-project.org/ [2] https://www.gnu.org/software/gdb/news/reversible.html -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com