From patchwork Mon Oct 17 22:33:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Tai X-Patchwork-Id: 242 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1673068wrs; Mon, 17 Oct 2022 15:40:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5y5kU9QwgvDBAbJ58/Shj3x49ZcCkpNYXEcOXCfitKL919DuhQs26mIONgpfda9G4RKnvT X-Received: by 2002:a17:902:b70c:b0:179:eb79:cf9a with SMTP id d12-20020a170902b70c00b00179eb79cf9amr14079990pls.130.1666046429074; Mon, 17 Oct 2022 15:40:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666046429; cv=none; d=google.com; s=arc-20160816; b=Luk0kLXC/13I1Xy9fDSYg1/XSEUgbxmEJuhu7Pk9pTlnSlFrxVZ0V59q6J2pqe4s9H 2n+5NNpqFRteJZSU7sdMdqATw7PnLBhr7eOamLgAG7aiHQ1UVHenc4FKLvrj/BIK3WEJ RVH9w99QFk3B6n+q2u8OazoadOPQh42qstK7CkcZC7UA0Moohqpm2vaqvF8Oow3KteU1 8NQ9jtJ0He5FM/wEoazTKkKe01a7tz3DPlpEcfkm+FXXxo38Gh7iIfgIzusPDZMoxvEr SprSHhBUNWqz3nIcsuh/L6IYMkweGdiBaxl9b+L0c1/4aW11l5owssbV+81gzOea24Aj Ipsg== 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 :message-id:date:subject:to:from:dkim-signature; bh=axepoFwpQrDrQYXcdV/6jV6ZYyzoOO5W6Iku2bzAuP0=; b=WyFmnwJEtNRcOycMerV8YU9jQx8fssODZSUwC57WROJsBS+6hgsxqgm21REDEpcsvm DlUKsUuQoJnf9xzWjsufvD3CdYq7Gv/Blvq0i6M9Y0CH217b6N7ep5BrgU2eDqbESo0r NP8kqz7ciziZF/l+ElqSzj8Hpa8z8gOzMaLNkVYCzd6vIZwL7fvWUmA4cZrnIv4OB2nv oZFcKhePgO9tjWi2mXSrt+HepaEwZcekYErryunsvzewxonk9rwkHd3DfZNXrN1skQUI iw0rd88daTTP01skB2zWwzZYonkPZI/oOr0pgqlk3vK+D/SlPsBqjWR3N56TUrEZ9UeJ xxSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b="Cd/knNbu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x17-20020a656ab1000000b004347b49d045si14125690pgu.631.2022.10.17.15.40.13; Mon, 17 Oct 2022 15:40:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b="Cd/knNbu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229801AbiJQWdC (ORCPT + 99 others); Mon, 17 Oct 2022 18:33:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229784AbiJQWc7 (ORCPT ); Mon, 17 Oct 2022 18:32:59 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB02424973 for ; Mon, 17 Oct 2022 15:32:58 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29HLmwO0027014; Mon, 17 Oct 2022 22:32:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : mime-version : content-transfer-encoding; s=corp-2022-7-12; bh=axepoFwpQrDrQYXcdV/6jV6ZYyzoOO5W6Iku2bzAuP0=; b=Cd/knNbuY+0XHtBl2JHSSNzZ1ogK6VQ+DJBzk+2xqUsync1Rbjju9HqJYaDg9fHuwEro vvC6nZP5UBGPo3wKsjsEhMyn6016qadoS9HfNQ6Mh6FLzht7J/Yc9bMDE2DJBP3xMdoL 68XCwGIeww1w1wuf5HQdgY08fM2b5nScJg5dVbRhIEgSAPXu1mInEA9TO43VQBjnGr5R WZrGnSMuqIKDTFzRR8+wwjv5Pp9NKlXZEzQunlv5QvnKTmAOwgLss1x1JgxG/Q2CGXKV enx9Zps3u33v/qBGAOe4aIUIKn78GkJANjkM8Qv11ScrsYSzP23dJAa/7z2Ieg/NSaQn 4w== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3k99nt96dk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Oct 2022 22:32:39 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 29HKxNhY015891; Mon, 17 Oct 2022 22:32:38 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3k8hr9hvqq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Oct 2022 22:32:38 +0000 Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 29HMWcTt026010; Mon, 17 Oct 2022 22:32:38 GMT Received: from brm-x62-20.us.oracle.com (brm-x62-20.us.oracle.com [10.80.150.35]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3k8hr9hvqj-1; Mon, 17 Oct 2022 22:32:37 +0000 From: Thomas Tai To: tony.luck@intel.com, dave.hansen@linux.intel.com, jarkko@kernel.org, reinette.chatre@intel.com, linmiaohe@huawei.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, naoya.horiguchi@nec.com, thomas.tai@oracle.com Subject: [PATCH V3 0/1] x86/sgx: Add code to inject hwpoison into SGX memory Date: Mon, 17 Oct 2022 18:33:04 -0400 Message-Id: <20221017223305.578073-1-thomas.tai@oracle.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-17_13,2022-10-17_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 spamscore=0 bulkscore=0 mlxscore=0 phishscore=0 suspectscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210170128 X-Proofpoint-ORIG-GUID: yfcvgpH1kbUgstCQrvzJ-PRU0AHOcINR X-Proofpoint-GUID: yfcvgpH1kbUgstCQrvzJ-PRU0AHOcINR X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746976300219723402?= X-GMAIL-MSGID: =?utf-8?q?1746976300219723402?= This patch adds code to inject hwpoison into SGX memory. The SGX memory is processor reserved memory that cannot be directly accessed by system software. Changes since v2: - As suggested by Naoya Horiguchi , add a new mf_action_page_type MF_MSG_SGX and use action_result() to show the page type and the action taken. - Rewrite hwpoison.rst to show the output from dmesg after injection. - Add reinette.chatre@intel.com to the email list. Sorry that I mistyped the email address in the previous emails. - v2 Reviewed-by: Jarkko Sakkinen Changes since v1: - Add a comment in hwpoison_inject as suggested by Miaohe - v1: Reviewed-by: Tony Luck - v1: Reviewed-by: Miaohe Lin Thomas Tai (1): x86/sgx: Add code to inject hwpoison into SGX memory Documentation/mm/hwpoison.rst | 24 ++++++++++++++++++++++++ include/linux/mm.h | 1 + include/ras/ras_event.h | 1 + mm/hwpoison-inject.c | 4 ++++ mm/memory-failure.c | 5 ++++- 5 files changed, 34 insertions(+), 1 deletion(-)