Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp5047673ybi; Sat, 20 Jul 2019 11:42:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqxAFQyp0QjoLDg7Qxkg1S3/Qwi+pO88zDTYh9SQ/XyQOVogUj2qCLNLp9arPGar7rYo+H4X X-Received: by 2002:a63:9a41:: with SMTP id e1mr62140564pgo.210.1563648153680; Sat, 20 Jul 2019 11:42:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563648153; cv=none; d=google.com; s=arc-20160816; b=kOrPlkln1CVYrwc3zdJjHYon9DO2aDO9M6dgh31xYfqyamh1nEFI/8eV3nyhFVz1ze Q74cSOoIAs2JqoJyLNki5yXvUwUYo6KO0Ts42d4leKoFze3Gmwkk1NmCinGEzNykJqiS ZKOYvdWyPjHRbtCR8uwI2IjbS26P0PYvlXafOpWmMCKZTNXLkshLztziY+QsS2fhPI4+ 2MlRIfBBN6b7GT3dRiOCwrQSf6aDn+GKmRzWZyzXpJZZ0+zWRvFjSCtd53F5ZHOnVm/G oHAxiPibtb5HNP2bUFwd39Dldm2/iqLLfNh8t/r1IazXjWINKANUqaC8VeGHdzHBME85 0OTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=aRZlmP88cW4JfTyFJkH0xmmP9qRKmxLsJYMfoWSfU2k=; b=KBTnHnvvdYbBbNIDvS03mhUdDML0GUw2hzIXRnwP/uT5PRlKoa5ZuHQB24x/bGeH7e GTdvuAIeafk5Qn3HYyUUy+V/XAh0VTNph0W8c261b0zYBeJpXLmNVI7VUoSi6gKUaQzY fQfUk/nVmHcQpmqYl48MXzONZmA8zOIagqGgy0hkUp2LyPdbtN3Kg24kmsDODb4KVyfL gUeHD8jr0qS6t9hvQnZZxTy8iIFYlEinjx/9VWStFh/uXdB5KHX0DYNCfDWi5A5F+jEz 04go36kDDYIp/uzJLlZPwDZ+B/fTOKFAbm5NoeKJG8vxBrjmCVLhqDTRSgK18d7jJAuS dZuQ== 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 f186si3411058pgc.438.2019.07.20.11.42.18; Sat, 20 Jul 2019 11:42:33 -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 S1727123AbfGTIp2 (ORCPT + 99 others); Sat, 20 Jul 2019 04:45:28 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:33745 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727114AbfGTIp1 (ORCPT ); Sat, 20 Jul 2019 04:45:27 -0400 Received: from pd9ef1cb8.dip0.t-ipconnect.de ([217.239.28.184] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1hokzE-0006jg-6h; Sat, 20 Jul 2019 10:45:00 +0200 Date: Sat, 20 Jul 2019 10:44:59 +0200 (CEST) From: Thomas Gleixner To: Sean Christopherson cc: Steven Rostedt , Peter Zijlstra , Eiichi Tsukata , edwintorok@gmail.com, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org, Josh Poimboeuf , Joel Fernandes Subject: Re: [PATCH] x86/stacktrace: Do not access user space memory unnecessarily In-Reply-To: Message-ID: References: <20190702053151.26922-1-devel@etsukata.com> <20190702072821.GX3419@hirez.programming.kicks-ass.net> <20190702113355.5be9ebfe@gandalf.local.home> <20190702133905.1482b87e@gandalf.local.home> <20190719202836.GB13680@linux.intel.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 20 Jul 2019, Thomas Gleixner wrote: > On Sat, 20 Jul 2019, Thomas Gleixner wrote: > > On Fri, 19 Jul 2019, Sean Christopherson wrote: > > > [ 0.680477] Run /sbin/init as init process > > > [ 0.682116] init[1]: segfault at 2926a7ef ip 00007f98a49d9c30 sp 00007fffd83e6af0 error 14 in ld-2.23.so[7f98a49d9000+26000] > > > > That's because the call into the context tracking muck clobbers RDX which > > contains the CR2 value on pagefault. So the pagefault resolves to crap and > > kills init. > > > > Brute force fix below. That needs to be conditional on read_cr2 but for now > > it does the job. > > But it does it just for the context tracking case. TRACE_IRQS_OFF* will do > the same damage. Hmm, should not becasue that calls through the thunk which preserves RDX.