Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp6083523ybv; Tue, 18 Feb 2020 09:32:14 -0800 (PST) X-Google-Smtp-Source: APXvYqy+T4c3+NUPS8pv15vXif8agk6hngjq5PuJfCe58eBnK9dq7JB7Ov8hFsIWY1PucBjJn+yH X-Received: by 2002:a05:6830:138b:: with SMTP id d11mr15659521otq.38.1582047134190; Tue, 18 Feb 2020 09:32:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582047134; cv=none; d=google.com; s=arc-20160816; b=b846I5L64SxXFOL0Bxys05zOX3gDlNmD6pe9IrQnAbudd60e7+VX3LNv4U5QiOEhCF 5P0pGWEixU5kcrUshhNkQ3on93ds49MmJ92oHd5cxLZQktdwQDw4c/qTNRHhKr57WMsR bdWjPLPVnRBehFM8Pjm6GZswq7pOuzFvOFEvV6jmABVX7iGCMue1fBl5esBsBIkm0ITQ RADSCZFHN155r6nVjjchPCCOWs9uKvnnMzz6fLw0rLCUVR0hrO9KxJshH02KPgOSviWv YHMzZbM90Qesu8ET6AP+oi5+HohiXNQ97fu6pBIgjH5SFsUpoE6oX/gFGb94lgnfSvLE 8qBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=hZ73zgkwiCIFv2pKr7M3n6S8JUBMDjCXg5lIsGiQJTM=; b=myGZUj0LnqAVe1Hx1WttlkxH4RO/urpTF+XaaDtROpS1dNr0Id5lCdPkGZgN/s3vQf H/3QEuvpoU8ysOxNb8HoBh5t7l6/qcrisIH2AC8Om8eVQh5qK6n1l0HDB9elCEglfbc8 57ZNmTiLp5lkbpl7OQNdQxpdEepIEPrDG8SW9Ow6wZKHPAvfLCwzxh1fxOVkiVlVKaUE arkcKKU8NAoTNW5Ln+XZyBXbkQfVLlgXyF7yTtA6lmEXKoX3o9O3YoK3MdxjAwMMfm1j FLSS61Zf8bMkmbAjauBmCMUYzqzUt+HvVo+Z368Q0xlix7nD9aPR7y8m+E6/SHHgniaF 8GVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=aD2gLUaU; 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=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q19si1906446otm.221.2020.02.18.09.32.02; Tue, 18 Feb 2020 09:32:14 -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=@alien8.de header.s=dkim header.b=aD2gLUaU; 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=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726802AbgBRRb4 (ORCPT + 99 others); Tue, 18 Feb 2020 12:31:56 -0500 Received: from mail.skyhub.de ([5.9.137.197]:33280 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726415AbgBRRb4 (ORCPT ); Tue, 18 Feb 2020 12:31:56 -0500 Received: from zn.tnic (p200300EC2F0C1F0014C3F76BBACA8B76.dip0.t-ipconnect.de [IPv6:2003:ec:2f0c:1f00:14c3:f76b:baca:8b76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id E759B1EC0CE8; Tue, 18 Feb 2020 18:31:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1582047114; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:references; bh=hZ73zgkwiCIFv2pKr7M3n6S8JUBMDjCXg5lIsGiQJTM=; b=aD2gLUaUS6aOiCdkfsfhp1I7wX10dRjWKc1NABLvNUD+qeP+CUV+fEH9B+LUmYnuVvu1HF fuG/eRNTBmpcE42kG9mWxhnZm1i9NRWrxW2VZlCTUHKSLoyCHFt5VDORHt94bvkc9pAMmf puzJhHj9Nhkg6Lqmd9r4l6GkUZG7wQw= Date: Tue, 18 Feb 2020 18:31:50 +0100 From: Borislav Petkov To: Peter Zijlstra , Steven Rostedt , Andy Lutomirski Cc: Tony Luck , x86-ml , lkml Subject: [RFC] #MC mess Message-ID: <20200218173150.GK14449@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline 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 Ok, so Peter raised this question on IRC today, that the #MC handler needs to disable all kinds of tracing/kprobing and etc exceptions happening while handling an #MC. And I guess we can talk about supporting some exceptions but #MC is usually nasty enough to not care about tracing when former happens. So how about this trivial first stab of using the big hammer and simply turning off stuff? The nmi_enter()/nmi_exit() thing still needs debating because ist_enter() already does rcu_nmi_enter() and I'm not sure whether any of the context tracking would still be ok with that. Anything else I'm missing? It is likely... Thx. --- diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index 2c4f949611e4..6dff97c53310 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -1214,7 +1214,7 @@ static void __mc_scan_banks(struct mce *m, struct mce *final, * MCE broadcast. However some CPUs might be broken beyond repair, * so be always careful when synchronizing with others. */ -void do_machine_check(struct pt_regs *regs, long error_code) +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); @@ -1251,6 +1251,10 @@ void do_machine_check(struct pt_regs *regs, long error_code) if (__mc_check_crashing_cpu(cpu)) return; + hw_breakpoint_disable(); + static_key_disable(&__tracepoint_read_msr.key); + tracing_off(); + ist_enter(regs); this_cpu_inc(mce_exception_count); @@ -1360,6 +1364,7 @@ void do_machine_check(struct pt_regs *regs, long error_code) ist_exit(regs); } EXPORT_SYMBOL_GPL(do_machine_check); +NOKPROBE_SYMBOL(do_machine_check); #ifndef CONFIG_MEMORY_FAILURE int memory_failure(unsigned long pfn, int flags) -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette