Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp3572pxb; Tue, 17 Aug 2021 17:32:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkajW+wcMqebQXHz0vOhyoULCMKOTxHax5HG8M6qHL7vwYufkBIW1+VDSQ0ElGCC6WZ8vO X-Received: by 2002:a05:6602:48c:: with SMTP id y12mr4974661iov.14.1629246756558; Tue, 17 Aug 2021 17:32:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629246756; cv=none; d=google.com; s=arc-20160816; b=OgnQHvE6domy7SiI4Xpm2Dzq9vYYDnO63ucs4hRb3021ju7jt013l8S+Pn4H0rSVjq Gx6+INfpe7g0cseM+MQsCxda+aUawOoUygjlvv07GYRmHBIePu0ZADg3adpjDrAjaDAD UhsB8XmGhG2YszrEy78CWmzQZJE9MVYIe4+JJ7lhAfEt891iuSNiSaBwcuIrSRMnv72e Z0S6rGc1B2aHyPrc8xO1cc6sq3aFSdqa+BWGMumrSJD+6AJ/nwVWqU1EWQCZeK8nILyP vfoKDUNzZXj5OyX+HhjlBaNGIxbXRp7KgeTgJ7BrUCMdn3LZ/XU7i9nXt97DKQijInjP hvvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=W1uNCJBKdrpq/YPEnpOi6WVlMN7aPmOv/QM1Kimxyhw=; b=kZZYx5JuH0ZF/rO8JH68oBE6qyZ6B1forBhoTX51vjSDCU/8n3uXj/IMDg82OYRlXH vFYaVWWYi85tcltTnrStJ58WsEV5+4LoyCXBqeDFuIpSrl93nGty++PzP6RkuB3LD2z+ 41R8gl/96TKc59RV3T92+RWrNBn8Bfj9TnqDyj7EtYK6hbIig1OWnhh3ZObkDYyG27A3 vVLotmdWbxZKLHuDvjfcJFjVAhn26fsWzaC8WBYTbWqZ7JrpHqB6Hdgmg3KuTVVKI6Mw jxI9Kd3Gnb9WQYVnoJjvroow2NvA7HLn2HhJpuZRf7E8eUT9Wop08j6ibihJ30aJ5pD9 jOXg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l5si3970645iln.118.2021.08.17.17.31.50; Tue, 17 Aug 2021 17:32:36 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235800AbhHRAa1 (ORCPT + 99 others); Tue, 17 Aug 2021 20:30:27 -0400 Received: from mga12.intel.com ([192.55.52.136]:60945 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234302AbhHRAa0 (ORCPT ); Tue, 17 Aug 2021 20:30:26 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10079"; a="195807457" X-IronPort-AV: E=Sophos;i="5.84,330,1620716400"; d="scan'208";a="195807457" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Aug 2021 17:29:52 -0700 X-IronPort-AV: E=Sophos;i="5.84,330,1620716400"; d="scan'208";a="520687339" Received: from agluck-desk2.sc.intel.com ([10.3.52.146]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Aug 2021 17:29:52 -0700 From: Tony Luck To: Borislav Petkov Cc: Jue Wang , Ding Hui , naoya.horiguchi@nec.com, osalvador@suse.de, Youquan Song , huangcun@sangfor.com.cn, x86@kernel.org, linux-edac@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Tony Luck Subject: [PATCH v2 0/3] More machine check recovery fixes Date: Tue, 17 Aug 2021 17:29:39 -0700 Message-Id: <20210818002942.1607544-1-tony.luck@intel.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210706190620.1290391-1-tony.luck@intel.com> References: <20210706190620.1290391-1-tony.luck@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix a couple of issues in machine check handling 1) A repeated machine check inside the kernel without calling the task work function between machine checks it will go into an infinite loop 2) Machine checks in kernel functions copying data from user addresses send SIGBUS to the user as if the application had consumed the poison. But this is wrong. The user should see either an -EFAULT error return or a reduced byte count (in the case of write(2)). My latest tests have been on v4.14-rc6 with this patch (that's already in -mm) applied: https://lore.kernel.org/r/20210817053703.2267588-1-naoya.horiguchi@linux.dev Changes since v1: 1) Fix bug in kill_me_never() that forgot to clear p->mce_count so repeated recovery in the same task would trigger the panic for "Machine checks to different user pages" [Note to Jue Wang ... this *might* be why your test that injects two errors into the same buffer passed to a write(2) syscall failed with this message] 2) Re-order patches so that "Avoid infinite loop" can be backported to stable. Note that the other two parts of this series depend upon Al Viro's extensive re-work to lib/iov_iter.c ... so don't try to backport those without also picking up Al's work. Tony Luck (3): x86/mce: Avoid infinite loop for copy from user recovery x86/mce: Change to not send SIGBUS error during copy from user x86/mce: Drop copyin special case for #MC arch/x86/kernel/cpu/mce/core.c | 62 ++++++++++++++++++++++++---------- arch/x86/lib/copy_user_64.S | 13 ------- include/linux/sched.h | 1 + 3 files changed, 45 insertions(+), 31 deletions(-) base-commit: 7c60610d476766e128cc4284bb6349732cbd6606 -- 2.29.2