Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4865065ybi; Sat, 6 Jul 2019 15:30:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqxzENk4JK6GwOLXqT1c+tUuVyTiTLoklYr6yjn/CasOG8y1CmNbw88BlQG5NQ7GFTvqneP6 X-Received: by 2002:a17:90a:270f:: with SMTP id o15mr13871363pje.56.1562452200257; Sat, 06 Jul 2019 15:30:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562452200; cv=none; d=google.com; s=arc-20160816; b=a46nOa1eixxmud19NnChldJyFtQ14N35MAx6aMIc4DID+C09VAQsHiLTmULXyn3j0H 6NYPFF/kthHhAlmzQ689tnVAUwm1b2qwWTAz9gPu0IRVo7BRGzG+94kHKrXk64SuAKC7 00jDMi8/5NgDihrsXnrgOC/ZxHug/+0fRRw0PmhyrGbGZyU4sW87s6NF/K6nsWHlLlLq 9yODqcKw2FZ7BggBO3RRTu43DgIzkYWqV0bs9VhYUoNXkuj4SokezhC1SQ5gq7xL/w7i w2Au1AOds+mVYU6Kz45zqfpx20jYh8WGQMfOUgOEJFvbWJjQA/7jygImYgPFjpzYYry7 VGkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=OtuaqaPAt3Phb27g/Uhw1iZsYHlJngckuJCPLtChQ3E=; b=ndiE+/JEA9RjeWROzR+H3R+T8cqjX0dBNgYoun/NbpzkuXx2Nl/Xh+TKLmkW524ob2 gAMTSqAQv6M8+DeWU6eSUhMdbOCMbU+DqJ6oEsuFJrqnpJyaswuKfwAHKibM8tEt1bKg G8P+OUqDrfZzSXDcWZsaqKy6K0+cULIUyX6yO9acQEpqJhG4GsBmAhYnrMRQsLhKIeuQ HGlBOyB2vcnWSLYtr0FlyP50NqABeeKz1/MnehUnw34FfX/s57bWk4bplnA/+sMSRGtD RE2RTft2rLKVOvIAiRX19wyEn8xtZaFHk7KGfPV8O92DPSRsgeOMvIKWjVsTlKa18p/O U4vw== 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 x8si12743966pfa.186.2019.07.06.15.29.43; Sat, 06 Jul 2019 15:30:00 -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 S1726927AbfGFW1b (ORCPT + 99 others); Sat, 6 Jul 2019 18:27:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:32810 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726673AbfGFW1b (ORCPT ); Sat, 6 Jul 2019 18:27:31 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E760220838; Sat, 6 Jul 2019 22:27:29 +0000 (UTC) Date: Sat, 6 Jul 2019 18:27:28 -0400 From: Steven Rostedt To: Linus Torvalds Cc: Peter Zijlstra , Thomas Gleixner , Borislav Petkov , Ingo Molnar , Andrew Lutomirski , Peter Anvin , Dave Hansen , Juergen Gross , Linux List Kernel Mailing , He Zhe , Joel Fernandes , devel@etsukata.com Subject: Re: [PATCH v2 5/7] x86/mm, tracing: Fix CR2 corruption Message-ID: <20190706182728.435a89ed@gandalf.local.home> In-Reply-To: References: <20190704195555.580363209@infradead.org> <20190704200050.534802824@infradead.org> <20190705134916.GU3402@hirez.programming.kicks-ass.net> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 6 Jul 2019 14:41:22 -0700 Linus Torvalds wrote: > 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. > We also have to deal with reading vmalloc'd data as that can fault too. The perf ring buffer IIUC is vmalloc, so if perf records in one of these locations, then the reading of the vmalloc area has a potential to fault corrupting the CR2 register as well. Or have we changed vmalloc to no longer fault? -- Steve