Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp183678ybi; Tue, 2 Jul 2019 18:44:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqwkQcd/65nUiIHJg22jHTOOpm2yR78uq63OWIIect+Thu1BTZC027Jdw5o5/DGFmat2byXD X-Received: by 2002:a17:902:2868:: with SMTP id e95mr36190676plb.319.1562118243710; Tue, 02 Jul 2019 18:44:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562118243; cv=none; d=google.com; s=arc-20160816; b=rKC+8+Myo6I1komfpz0aCxkhHeVvguM92YmBbxm50XRCximRedftV2acp3KiFa2dQ0 k5iD/m8HXH+wDy0wWJnMRjLyJfsnZbeDqxrDqAvmPYfp5G7SGbl4gp7mlq7ukWKNWVaq /MsmxHnRYNGGbY7VhPMrKV+5s+PTz4ap03qyd/iob13G87dQeSxzjnknDL82q7Hcn9kl 4Neo/kedJq+zCsIsk84nxps1RbMmln3yIVF3cJpjPrSwTg0DJGD0K8rOj6LJCZmHvaXo AYhYy/M69sf6VVp2P/YCJnp8r2Qg0xiu0VTcIgQ1VA9BhzgMVBR8UHy9vbtLZdjuokMg Szaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Upd1K9b6gYlAnA97u9qb4P9fFZj9SCrhC9d0+nLfQPA=; b=BSkJrLQNgDtWQuKhvoNJ8UFEfi1bq/1mywNqgsAPnX+rf33sh/yrDK4fCziYY4X57/ 5MczhIHIe3gM3nuqzZEZfnM7Lyh/83lOtaut9KL9TXzP5v9k5vbJfYicsvK8O1VQR7zG lfqPmWo0shscdSrQ/TIQWgmAVR6xT/qqHIIaP+4G5+Gnt6HepoaPQJYMC5ev9Pq4mU9X bfU896mV9kA860Bo454LOTK082q1Zngk4xsmWNFOhzILDUTMKzTO1tDmNGfnvf4waGg1 YDS6sXdlH/hfKqFLQXAm8V2Wy67R/DIdV+yMVl/xeP6SNQbRQG4V5BmD9vMiOdXu2Nla y8EQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=MbCpvr69; 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 o4si451188pgi.160.2019.07.02.18.43.48; Tue, 02 Jul 2019 18:44:03 -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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=MbCpvr69; 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 S1727309AbfGCBn0 (ORCPT + 99 others); Tue, 2 Jul 2019 21:43:26 -0400 Received: from merlin.infradead.org ([205.233.59.134]:55816 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727049AbfGCBnZ (ORCPT ); Tue, 2 Jul 2019 21:43:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Upd1K9b6gYlAnA97u9qb4P9fFZj9SCrhC9d0+nLfQPA=; b=MbCpvr69N4Ov9IP8oVzALxdjn EI3CdYNQMTfWzhePtTYmwR+7J+FDmHKJdrbv+wVK8Zb+rP/e4hHE6h4zVTaf+fwR8zrdSdq12os+o HIxlqbYzR4jBuZdiqcGN7L7yNjnFzQwF5jhGr4BJnXOJGI3QFwLgMdft7+8lYlBUxZPEWl2qBhJa4 2opG9GsTH2+kCUMZUoVmVbOWPQWoM7jw6ddY0UjDYiK1Irr6o7o0PW45EKo9WSThHyPwj6jt18NRe YNPJ1kUlOrEIIb+4PSx/2F27ugyY2rCbcqxcwCdIrVGKC3ZzctIVpD2E5vcdcIYMW3zo9UaIFWwkO Q6SdsZxcQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hiPEU-0000vQ-EL; Tue, 02 Jul 2019 20:18:31 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id AD9C5207B53F0; Tue, 2 Jul 2019 22:18:27 +0200 (CEST) Date: Tue, 2 Jul 2019 22:18:27 +0200 From: Peter Zijlstra To: Steven Rostedt Cc: Thomas Gleixner , 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 Message-ID: <20190702201827.GF3402@hirez.programming.kicks-ass.net> References: <20190702053151.26922-1-devel@etsukata.com> <20190702072821.GX3419@hirez.programming.kicks-ass.net> <20190702113355.5be9ebfe@gandalf.local.home> <20190702133905.1482b87e@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190702133905.1482b87e@gandalf.local.home> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 02, 2019 at 01:39:05PM -0400, Steven Rostedt wrote: > On Tue, 2 Jul 2019 11:33:55 -0400 > Steven Rostedt wrote: > > > On Tue, 2 Jul 2019 16:14:05 +0200 (CEST) > > Thomas Gleixner wrote: > > > > > On Tue, 2 Jul 2019, Peter Zijlstra wrote: > > > > > > > On Tue, Jul 02, 2019 at 02:31:51PM +0900, Eiichi Tsukata wrote: > > > > > Put the boundary check before it accesses user space to prevent unnecessary > > > > > access which might crash the machine. > > > > > > > > > > Especially, ftrace preemptirq/irq_disable event with user stack trace > > > > > option can trigger SEGV in pid 1 which leads to panic. > > > > Note, I'm only able to trigger this crash with the irq_disable event. > > The irq_enable and preempt_disable/enable events work just fine. This > > leads me to believe that the TRACE_IRQS_OFF macro (which uses a thunk > > trampoline) may have some issues and is probably the place to look at. > > I figured it out. > > It's another "corruption of the cr2" register issue. The following Arrggghhh.. > patch makes the issue go away. I'm not suggesting that we use this > patch, but it shows where the bug lies. > > IIRC, there was patches posted before that fixed this issue. I'll go > look to see if I can dig them up. Was it Joel that sent them? https://lkml.kernel.org/r/20190320221534.165ab87b@oasis.local.home I think; lemme re-read that thread.