Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp553497pxb; Thu, 14 Jan 2021 12:25:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJwJQQiTqQclI6i+z+Ir36qte2Ta8VhHV2qjFAQ/5K/cZaFtrD3BmdXZ0qpfXskytNdenOx1 X-Received: by 2002:aa7:c543:: with SMTP id s3mr6970761edr.88.1610655913888; Thu, 14 Jan 2021 12:25:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610655913; cv=none; d=google.com; s=arc-20160816; b=opVfp/Boml9+Mttl+Qs4cnl+B5VmwpxQATOCf1hjRepKZf1p1hP/2qcLxuoTKaQqY1 9/3LIQ+uKOqpqKg37lCNCcA193mKKLPbYUWhXh7iOU9S/HLcTp72MdxUOsB6UN8A8+9H b70z3yVrKEho33scj6RGqW/bdnIcMWuCvyhseq0mH7lfp+tNl3rbGIlQKLV/VbBt/nn4 Sx7ApEVlvRG8qSlm34tlXiN6EnhPBzPuBRg3CgRh4bsorzcIDF2sbEwcGyRg1jc/hdCk eYOC1tSluXCukySOxK1m01Z/5rSflx+FEJbZhyK/2Ctiz1IVc9bMw3lCk35flxxPHJEr E4SA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=B98lkJB1V5RYsjEAJLeZgjNYUBdiqyknXyQisAXWnig=; b=zbR1P4DAvmrt+wgjwAdXnuzfwyjILo/jysxfnMwBvRmgGG0r2wcZpTurLsDPHLTUO2 MqVTUAAE16qeXPyb4SUSGaJS1PPF0X3OKHS7YjfS49+pK+Ij2lUW+O0c+fFOGv+5zYuj uEQZXin4WoS6kaKfG0W1DCO8gIu2GCPO1wOEz+uzbb2k/CgB2Nuf3JdRHhhKE17ldS/C K4dJM8Wg4/7BlCkiBa5FXQ+DfVJ5wA4jO237Q6MQ1FCkpP2oWW/uJhSMr538sz3Cu8+K xaytQC4+0y6gm6NzJ1gNTin9MsoAsMtoFrhfUD3kpi2z5uxxmzHXYM9rDfiVyDA+J7TM 9sVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=aq9KFkfN; 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=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m7si3260367edq.123.2021.01.14.12.24.48; Thu, 14 Jan 2021 12:25:13 -0800 (PST) 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=@alien8.de header.s=dkim header.b=aq9KFkfN; 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=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726578AbhANUXC (ORCPT + 99 others); Thu, 14 Jan 2021 15:23:02 -0500 Received: from mail.skyhub.de ([5.9.137.197]:60648 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726266AbhANUXB (ORCPT ); Thu, 14 Jan 2021 15:23:01 -0500 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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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