Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4837087ybi; Sat, 6 Jul 2019 14:42:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqyOglXeQbfio6WATc9S9FLDeifPnGdJiWbjaLwwUaaWSjvux2FU0N/s/b/jgfevCI6eiVqM X-Received: by 2002:a17:902:20b:: with SMTP id 11mr13652915plc.78.1562449354068; Sat, 06 Jul 2019 14:42:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562449354; cv=none; d=google.com; s=arc-20160816; b=dBh2y65z1cj6dWVZ/dYLoBVZd3TB4dZis4PW8rbcpUe4Ki66+U7JkT1e1gZ+HvyaBC fXFOuwfnCcKQtum9bP59OSgoOa8isAwCM5j3lHXyr8LRa/2EccxCtElQ9ooZgE4VjLqg 6HdKKpvAQYr0DI9Rt8Lndg93+JEwtUxxWXD7touJsNlEPUwxInfnpeEdU0y+dhngNtRz nPx8uy8y6BZzwtY+vvozIA9L6ehshZuyn4WciF4icG4m6ngkK5TZsV7yTJSxlynanczP 9o7y2fR8WCrRo2ZjWCQlzrVjYw4MIOIfHKMF5+FxUOttR23B9JFgK7oKLj0u9BqhZplp pfQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=3tEtD0lRCpf+jxYQ00teH9l4O5uQL9hDGsIbaVh4o1g=; b=b9hVtVoRjXU3Nb5Kcl8hDloKkEL/tkgxRF49vHGI8Bo5jv5T98NQ1kqeF4abYG5GO+ 2dDXAnRKtpvITsWozr+DU6IOavHY9IaESjyD/XMJVu+Hyy9MoqGm58sUKXK8U0Vom1+Z 2wL+yXpoPBInfN0fo6yhrtIt4CAI9E9eE2SvOuTb10qvl3Oi//7u+MfV8vYXOo27Zliw 5S4Rv1T1rHOv71LNbu57X7Nn+I7nQlly/vCnhEThj3MBnhXKwh9+ZbyKsWQ2UyBV02Me et6/RHCQOmVAiI3sdtKj5IrGJ+l0UK3mY1w6GCtRXsnXERjHa7c9uLT5PfoZu5jBvYN5 QVkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=FLWmBuqC; 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 y15si12303819pjp.90.2019.07.06.14.42.19; Sat, 06 Jul 2019 14:42:34 -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=@linux-foundation.org header.s=google header.b=FLWmBuqC; 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 S1726816AbfGFVln (ORCPT + 99 others); Sat, 6 Jul 2019 17:41:43 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:39977 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726714AbfGFVlm (ORCPT ); Sat, 6 Jul 2019 17:41:42 -0400 Received: by mail-lj1-f194.google.com with SMTP id m8so2850093lji.7 for ; Sat, 06 Jul 2019 14:41:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3tEtD0lRCpf+jxYQ00teH9l4O5uQL9hDGsIbaVh4o1g=; b=FLWmBuqCo0tNZ4Q4mKPdaEUKusTehmF6WMwpxDDFujTGjtlZq925m25RCOdabL3BE/ M5CZbYH5MIHH+Uy1BP+PfExtwoW+oNbE+UN9n6sAFkFpoKVa7p/ZIXUUK9Hvh4ETNSUt 6P3eM0hsIsHWuyyY/x9jKiN/55dscxgOJXaZE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3tEtD0lRCpf+jxYQ00teH9l4O5uQL9hDGsIbaVh4o1g=; b=UTSxn+e6rJKZuMTiKTytE41udtMNDCDSr4ULOz7Sc+zYl5PE0ndyvxun1smMPQaVQZ VhBbk8yu1qz8TnHBLaruCW9iptKj7bzhfoZ1x4Aa3e/GCwy70ECXyA0WXAeUqYGDHwve dv4Q+Q50VcpnA6cD5KrSOwYuxP/oIK9AOAXrI1eZrFySsDo8Phfo1yl8Uk3p7/KhWOKB +EjiH5o/25O3Pz0m8nXUZqptgPVmnzI33FnH4smfMhN76uEpa5t/TVKoXfmEIFsGggZ3 jszh0xQzNOcNHjwgNl83WWaF5upiToIyuyDZvJagFzTw5L/NMm3hudeYWlpmdh1TC2t2 ecCQ== X-Gm-Message-State: APjAAAVvuudqAftB6Js25/bYxMxEV7sFJfogsd2PO8q66JVrrRY2mbiD S2qiWdG7C2iidSD/BZkbgKhBmk8qtP4= X-Received: by 2002:a2e:5548:: with SMTP id j69mr5784352ljb.48.1562449300115; Sat, 06 Jul 2019 14:41:40 -0700 (PDT) Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com. [209.85.208.169]) by smtp.gmail.com with ESMTPSA id u9sm2011191lfb.38.2019.07.06.14.41.38 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Sat, 06 Jul 2019 14:41:39 -0700 (PDT) Received: by mail-lj1-f169.google.com with SMTP id p17so12376863ljg.1 for ; Sat, 06 Jul 2019 14:41:38 -0700 (PDT) X-Received: by 2002:a2e:b003:: with SMTP id y3mr5981899ljk.72.1562449298743; Sat, 06 Jul 2019 14:41:38 -0700 (PDT) MIME-Version: 1.0 References: <20190704195555.580363209@infradead.org> <20190704200050.534802824@infradead.org> <20190705134916.GU3402@hirez.programming.kicks-ass.net> In-Reply-To: <20190705134916.GU3402@hirez.programming.kicks-ass.net> From: Linus Torvalds Date: Sat, 6 Jul 2019 14:41:22 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 5/7] x86/mm, tracing: Fix CR2 corruption To: Peter Zijlstra Cc: Thomas Gleixner , Borislav Petkov , Ingo Molnar , Steven Rostedt , Andrew Lutomirski , Peter Anvin , Dave Hansen , Juergen Gross , Linux List Kernel Mailing , He Zhe , Joel Fernandes , devel@etsukata.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 5, 2019 at 6:50 AM Peter Zijlstra wrote: > > Also; all previous attempts at fixing this have been about pushing the > read_cr2() earlier; notably: > > 0ac09f9f8cd1 ("x86, trace: Fix CR2 corruption when tracing page faults") > d4078e232267 ("x86, trace: Further robustify CR2 handling vs tracing") I think both of those are because people - again - felt like tracing can validly corrupt CPU state, and then they fix up the symptoms rather than the cause. Which I disagree with. > And I'm thinking that with exception of this patch, the rest are > worthwhile cleanups regardless. I don't have any issues with the patches themselves, I agree that they are probably good on their own. I *do* have issues with the "tracing can change CPU state so we need to deal with it" model, though. I think that mode of thinking is wrong. I don't believe tracing should ever change core CPU state and that be considered ok. > Also; while looking at this, if we do continue with the C wrappers from > the very last patch, we can do horrible things like this on top and move > the read_cr2() back into C code. Again, I don't think that is the problem. I think it's a much more fundamental problem in thinking that core code should be changed because tracing is broken garbage and didn't do things right. I see Eiichi's patch, and it makes me go "that looks better" - simply because it fixes the fundamental issue, rather than working around the symptoms. Linus