From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A61AAC433E6 for ; Thu, 14 Jan 2021 20:22:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 06CE723A05 for ; Thu, 14 Jan 2021 20:22:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 06CE723A05 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=alien8.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 54F568D0122; Thu, 14 Jan 2021 15:22:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4D9EF8D00F0; Thu, 14 Jan 2021 15:22:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3A1518D0122; Thu, 14 Jan 2021 15:22:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0052.hostedemail.com [216.40.44.52]) by kanga.kvack.org (Postfix) with ESMTP id 201D88D00F0 for ; Thu, 14 Jan 2021 15:22:23 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id E06561EF3 for ; Thu, 14 Jan 2021 20:22:22 +0000 (UTC) X-FDA: 77705502924.03.shape40_291278d27529 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id BD7A328A4EB for ; Thu, 14 Jan 2021 20:22:22 +0000 (UTC) X-HE-Tag: shape40_291278d27529 X-Filterd-Recvd-Size: 2965 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Thu, 14 Jan 2021 20:22:22 +0000 (UTC) Received: from zn.tnic (p200300ec2f1aa9006cfc9535ea796179.dip0.t-ipconnect.de [IPv6:2003:ec:2f1a:a900:6cfc:9535:ea79:6179]) (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 34CD61EC0253; Thu, 14 Jan 2021 21:22:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1610655740; 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:in-reply-to: references:references; bh=B98lkJB1V5RYsjEAJLeZgjNYUBdiqyknXyQisAXWnig=; b=aq9KFkfNTOWE8yJKkb4oMKx5lEZa+qRKShQukNmCJcDGpvA5J80gNQZKR/DqOxYcko5H8T WUCO77i9S5HqeSJfphu4sGCL8MO6TvY/qSN6DtYSBDF9OqWaSHi6RhHJ77KfkAFo1yjJ77 nH/v/v1J6oo+CEcS5Ffn8ptFQc+ngGg= Date: Thu, 14 Jan 2021 21:22:13 +0100 From: Borislav Petkov To: Tony Luck Cc: x86@kernel.org, Andrew Morton , Peter Zijlstra , Darren Hart , Andy Lutomirski , linux-kernel@vger.kernel.org, linux-edac@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v2 1/3] x86/mce: Avoid infinite loop for copy from user recovery Message-ID: <20210114202213.GI12284@zn.tnic> References: <20210108222251.14391-1-tony.luck@intel.com> <20210111214452.1826-1-tony.luck@intel.com> <20210111214452.1826-2-tony.luck@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210111214452.1826-2-tony.luck@intel.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Jan 11, 2021 at 01:44:50PM -0800, Tony Luck wrote: > @@ -1431,8 +1433,11 @@ noinstr void do_machine_check(struct pt_regs *regs) > mce_panic("Failed kernel mode recovery", &m, msg); > } > > - if (m.kflags & MCE_IN_KERNEL_COPYIN) > + if (m.kflags & MCE_IN_KERNEL_COPYIN) { > + if (current->mce_busy) > + mce_panic("Multiple copyin", &m, msg); So this: we're currently busy handling the first MCE, why do we must panic? Can we simply ignore all follow-up MCEs to that page? I.e., the page will get poisoned eventually and that poisoning is currently executing so all following MCEs are simply nothing new and we can ignore them. It's not like we're going to corrupt more data - we already are "corrupting" whole 4K. Am I making sense? Because if we do this, we won't have to pay attention to any get_user() callers and whatnot - we simply ignore and the solution is simple and you won't have to touch any get_user() callers... Hmmm? -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette