Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5025432ybv; Wed, 26 Feb 2020 07:11:08 -0800 (PST) X-Google-Smtp-Source: APXvYqw+WaU7jBLeTzAbvQoFqJPiAxHA6LKTpIRJQhlXN/CjIzWBzcvsgrXksXVULzaemj9oUdbr X-Received: by 2002:a9d:5607:: with SMTP id e7mr3610593oti.196.1582729868598; Wed, 26 Feb 2020 07:11:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582729868; cv=none; d=google.com; s=arc-20160816; b=zRB/6qN8Ru9s2CHBU24ZlBMeTM6I0wGQ/Qe0j6LIoM1Weova4atcLwyBNad024D7vF I6pPi1BzKla/ftAk7W4vwXTfrbjbG1YCZIt/skijP7E42Dtvz+bMBfA11l8wdz0OnNaE GE2XFwdEsEfZ7tEO8wuSmeru0fAiGTU+UqgMXd/qgaM7OYGLzKucb8BF7nUlTWaTen4g CJ1QuHj8E4hqOLB0P14/rb+0j29BzaRGTr7puWJ77axvzv7ksSAz3lLfb1ldsrCzSv6E 4xMilP2Cv1g87s/qFQfnz+wYibp0GXzlpxx4wpeojEdG8EFqyGGwPAnFxm8bYt2X/AZY +IIQ== 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=HCC759uxu07qwx1yUPCOsxhGtYzgdR7T54HMSsBwe7g=; b=iGLhJfQV2bGQyZDIwocCxsYlSc3E4Pl2m5PECXgBJur2FsBLT8MziZmvrW2wxjefTr V9aprSTGF9UiFylfJfzPH5R60SyQV5wHqJ+7J/vw3A3s8MHoJyNyXKle3JdaObVTXK25 XdU3W+vuphg6ha0nqfP48bqOGTi6w0wxv9Y6pWHNTzjRgIHUQEUycPNrwsPuIduEEUQO xGhhGjpWGESTYwM4UKUckMSVqxGe98NxGZjA14PqJrtTxNvJwLiOeXFGXei0+2zJ7sZp 0mNWx4U2kAlOXHEzR/98OijRIvMYoSLY0PW22PEy/RCMtpNMGJUIUbJfOkiRRL3qqLbM fJBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=shsGvBGn; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o7si1529840otk.185.2020.02.26.07.10.52; Wed, 26 Feb 2020 07:11:08 -0800 (PST) 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=@kernel.org header.s=default header.b=shsGvBGn; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727958AbgBZPKQ (ORCPT + 99 others); Wed, 26 Feb 2020 10:10:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:53284 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727941AbgBZPKO (ORCPT ); Wed, 26 Feb 2020 10:10:14 -0500 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (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 50FA724699 for ; Wed, 26 Feb 2020 15:10:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582729814; bh=g5VTwMGaK0OJyOYHoeCbwp4ZrmRijn3kpXqLNP75A7I=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=shsGvBGnxoWCENXkmKFIyQ9eTaVpnrbA9TdPaNcOvz5/Zr9zmCHMM8kfgwGonlQZf bFrmsma8GaXj9dWzvK/6igcMGt67yeox4Yzw+5JLSZf7nICuZP2MFlW7LD2gzyH+mO yqIWcqQHlbJaAAsmYphHCDugAXOzbcuBVe/a9lew= Received: by mail-wm1-f48.google.com with SMTP id c84so3513722wme.4 for ; Wed, 26 Feb 2020 07:10:14 -0800 (PST) X-Gm-Message-State: APjAAAXO8LmUNR1UENCELStqldouoRQVfppMkILh+Yn++w7kV7Cy8jcw P46CokrOEIj9GTvXg3C2T4NCvpdN2Yi41Wp1qT5muA== X-Received: by 2002:a1c:3906:: with SMTP id g6mr6314490wma.49.1582729812585; Wed, 26 Feb 2020 07:10:12 -0800 (PST) MIME-Version: 1.0 References: <20200225213636.689276920@linutronix.de> <20200225220216.315548935@linutronix.de> <20200226011349.GH9599@lenoir> <20200226132850.GX18400@hirez.programming.kicks-ass.net> In-Reply-To: <20200226132850.GX18400@hirez.programming.kicks-ass.net> From: Andy Lutomirski Date: Wed, 26 Feb 2020 07:10:01 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [patch 02/10] x86/mce: Disable tracing and kprobes on do_machine_check() To: Peter Zijlstra Cc: Andy Lutomirski , Frederic Weisbecker , Thomas Gleixner , LKML , X86 ML , Steven Rostedt , Brian Gerst , Juergen Gross , Paolo Bonzini , Arnd Bergmann 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 Wed, Feb 26, 2020 at 5:28 AM Peter Zijlstra wrote: > > On Tue, Feb 25, 2020 at 09:29:00PM -0800, Andy Lutomirski wrote: > > > >> +void notrace do_machine_check(struct pt_regs *regs, long error_code) > > >> { > > >> DECLARE_BITMAP(valid_banks, MAX_NR_BANKS); > > >> DECLARE_BITMAP(toclear, MAX_NR_BANKS); > > >> @@ -1360,6 +1366,7 @@ void do_machine_check(struct pt_regs *re > > >> ist_exit(regs); > > >> } > > >> EXPORT_SYMBOL_GPL(do_machine_check); > > >> +NOKPROBE_SYMBOL(do_machine_check); > > > > > > That won't protect all the function called by do_machine_check(), right? > > > There are lots of them. > > > > > > > It at least means we can survive to run actual C code in > > do_machine_check(), which lets us try to mitigate this issue further. > > PeterZ has patches for that, and maybe this series fixes it later on. > > (I'm reading in order!) > > Yeah, I don't cover that either. Making the kernel completely kprobe > safe is _lots_ more work I think. > > We really need some form of automation for this :/ The current situation > is completely nonsatisfactory. I've looked at too many patches lately and lost track a bit of which is which. Shouldn't a simple tracing_disable() or similar in do_machine_check() be sufficient? We'd maybe want automation to check everything before it. We still need to survive hitting a kprobe int3, but that shouldn't have recursion issues. (Yes, that function doesn't exist in current kernels. And we'd need to make sure that BPF respects it.)