Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1685966ybt; Thu, 18 Jun 2020 14:53:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKm8NK5+WAM4RXeyXylexjujE48AAXBUPjcY1c0ffm7WSX5e0JTF61dSAB5CG3xEYjg0fS X-Received: by 2002:a17:906:fcae:: with SMTP id qw14mr793694ejb.166.1592517225965; Thu, 18 Jun 2020 14:53:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592517225; cv=none; d=google.com; s=arc-20160816; b=LGYpBEYxnlGxIXaUmPmjOP7njT+WihlVZbF2qB2D6csjHNmc+ip3yt6tf7XHdBm1Tt r0eGEWKB/8tV7gEeN50x7XUThLksnmua/+XeifYn/AHQD1y56c/y0fbXU2Md1rkToGEZ dcG5D/KsDkPyNPgG+hvmmr2vG8GIMggTXjYZBEPKUWEo/9wd1rqPlw0MWTwNQ5EKgqmC VPfrteSBrUCvAq6bxQainW70tygyN7Jd7uuMHXqQuXjPgZnof/GxYgQk0S3iW+/0904o uhC9ccHX1Fs13CTZg8KQX8yt1FhLvz4m//6fvMDcC8N8nTpaqu9lKQFvAUiY1lVeRukg FaLg== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=J1yjCAIfa2LMgY0+SpFBEzngF3QGV5sK+WkkqPO3pns=; b=odNHluZSTzmwBNzZaZKPErDE8Dc3KbDj8he4p3S+dSaqqfAiqSdyDWi7qMxwls2fas CVMEHFv7KUHXjbrQi74nCqVAikpjXtx7jj3kWBm9zTwmBBQK5cTQuBOc3YrQB9OcW0ca bZqr2T56YlK+WQcRyRTR2Jh/OgFGf2c3DyvmA3vdTWnXMtqhsMAaDkuQHOUxIWj6FJoo KUcZ7N72jBNjf2l29lk2IToV4tB5skcCtE/8Q/uDj5bGWSG1IbrVQe7ORrOpBo2L/SLO Tctq+wrK6U7AKWaPmgQU2q+G6m6YN2RMbuKVikTxw/B6bn+0hyYnn5R2CjfoFgz2HR/0 2dJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wPW4GY5z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dg4si2859530edb.439.2020.06.18.14.53.23; Thu, 18 Jun 2020 14:53:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wPW4GY5z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730762AbgFRShJ (ORCPT + 99 others); Thu, 18 Jun 2020 14:37:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:48302 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725829AbgFRShH (ORCPT ); Thu, 18 Jun 2020 14:37:07 -0400 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A40B8208C3 for ; Thu, 18 Jun 2020 18:37:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592505426; bh=Knz5GZwIrR2m3rJkhIEdASfCnCSkNHIP610FXM2qoNs=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=wPW4GY5zOPz7yJL5L7HuzdkJsaiJSLmRDAgYqv+lax5ZiBG4034xzT9Yex3qsiY1k joe1MsFiItJnnLNpQKMSPuTaitrUgrDngeLSs1PaEkyilFGM1O8TVm44XDqz5s/qJs fumbkA91fwtSrUTGzHvA3orAbUpRLvroIIjlCU3I= Received: by mail-wm1-f41.google.com with SMTP id t194so6733566wmt.4 for ; Thu, 18 Jun 2020 11:37:06 -0700 (PDT) X-Gm-Message-State: AOAM531HapEWjKsL6/wc1uIcWoW9wXsEc/drAbEECheHQSP1lBucpkH5 me2FvYEE//dvSN+JaJ3+WVwUkLR62Iyerp4ZC4geLg== X-Received: by 2002:a1c:80d4:: with SMTP id b203mr5383841wmd.138.1592505425251; Thu, 18 Jun 2020 11:37:05 -0700 (PDT) MIME-Version: 1.0 References: <20200618144801.642309720@infradead.org> <70455B9B-0952-4E03-B2CE-EEAE1E110C5B@amacapital.net> <20200618155017.GK576905@hirez.programming.kicks-ass.net> In-Reply-To: <20200618155017.GK576905@hirez.programming.kicks-ass.net> From: Andy Lutomirski Date: Thu, 18 Jun 2020 11:36:53 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/7] x86/entry: Fix #UD vs WARN more To: Peter Zijlstra Cc: Josh Poimboeuf , LKML , X86 ML , Dmitry Vyukov , Marco Elver , Andrey Konovalov , Mark Rutland , Matthew Helsley , Steven Rostedt , jthierry@redhat.com, Miroslav Benes Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 18, 2020 at 8:50 AM Peter Zijlstra wrote= : > > On Thu, Jun 18, 2020 at 07:57:35AM -0700, Andy Lutomirski wrote: > > > > > > > On Jun 18, 2020, at 7:50 AM, Peter Zijlstra wr= ote: > > > > > > =EF=BB=BFvmlinux.o: warning: objtool: exc_invalid_op()+0x47: call to = probe_kernel_read() leaves .noinstr.text section > > > > > > Since we use UD2 as a short-cut for 'CALL __WARN', treat it as such. > > > Have the bare exception handler do the report_bug() thing. > > > > I think you should consider inlining or noinstr-ifying report_bug() > > too if you want to make this more bulletproof. I admit the scenario > > where someone instruments it and it goes wrong is farfetched. > > How far down that rabbit hole do we go? Because then we need to noinstr > printk, the console drivers, those will very quickly pull in lovely bits > like PCI, USB, DRM :/ > > At some point we have to just give up. I wasn't imagining going far down the rabbit hole at all -- I think that, at most, we should cover the path for when the fault wasn't a BUG/WARN in the first place. I admit that, for #UD in particular, this isn't a big deal, but if it were a different vector, this could matter. I suppose report_bug() could be split into lookup_bug() and handle_bug(), and just lookup_bug() could be noinstr. --Andy