Message ID | 20230708085744.3599311-3-linmiaohe@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp3802275vqx; Sat, 8 Jul 2023 02:13:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlFOAb3Sshp2h+MQXE9LAaCnFIUdUQ6blmnytTzMpDe2vDPWVePkRtTMkoJ/cEpKxXdgOBeD X-Received: by 2002:a05:6870:eaa3:b0:1b0:5eeb:319d with SMTP id s35-20020a056870eaa300b001b05eeb319dmr10832076oap.43.1688807619412; Sat, 08 Jul 2023 02:13:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688807619; cv=none; d=google.com; s=arc-20160816; b=Ae23Is6acLtSjlnL6o8O7A6lUQ5aOtftWbiFuA+MsZUFBN/VeiOihFYsBXYZgqp0cp A/EHI7sfaaVkoDx1Jn2Wr6kXs60YzZTxYuaIvl7LGFnKOccCtQ2rqLsjNWs8no+GoOh1 QkZhQ/IVYAjCfXVAz6X1zJwOfmV6LeqjOpRipLr3INtKGAwYl7MlCo1MoEO+nLP+ulpN n4TAUFLINl6KEJf6PHvfGHHL5wtt+LqTSH7/uLnQNZLdwr/IIrX6dkzstVxWA3WaGLXN 1y30TE/JxFJE8SNbrK0JKcvssrKw8dFkcciKPOfq6RVVn3KhsAz1alEKFAhEIiFGdPb/ Apqg== 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=t3jGnFlBe2e1gDFOxNrK0L2EElNUaiKTTYXS7V29tIw=; fh=4o7DIXI/66oHEW09L3854GeQKXh9nrvBy5ZxENMFBvA=; b=0lSp6CWXB23BbmxA68UQC9MfGmb3HET1qx1Y5PCTQcUkN9/cKBWC0wKRwRlLuQ2Srz zzPOjC0EHr5SvX0FwABn7eXIPy0bsxoXzINDOfLkSciIakH4+fsNoVwHowWAqZ21BUmx l/7ItDHRzM3d7CMc39hcFq+ovqa1qK4RVXNHRqPvfXFfS79W45CUW/IvIPutxaNI1yUW ZW1bogNkKCzBDYOkI2Livz+fs+M4fcw1C6J/mAFi4rzMJXKDBVjfOH8dkkSx13cnLV0H aoR9IcFUU9bfv9Bj7qqFzc1uXiovuGKCnkq31d46YNwUOS6jJi3kXi9sDJazu11UoVLU 7lnw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f4-20020a17090a9b0400b00262d692db39si3914468pjp.12.2023.07.08.02.13.22; Sat, 08 Jul 2023 02:13:39 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230328AbjGHI5n (ORCPT <rfc822;tebrre53rla2o@gmail.com> + 99 others); Sat, 8 Jul 2023 04:57:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230029AbjGHI5f (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 8 Jul 2023 04:57:35 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02EBE1FEE for <linux-kernel@vger.kernel.org>; Sat, 8 Jul 2023 01:57:33 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Qykdf41dVzTkgk; Sat, 8 Jul 2023 16:56:22 +0800 (CST) Received: from huawei.com (10.174.151.185) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Sat, 8 Jul 2023 16:57:29 +0800 From: Miaohe Lin <linmiaohe@huawei.com> To: <akpm@linux-foundation.org>, <naoya.horiguchi@nec.com> CC: <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>, <linmiaohe@huawei.com> Subject: [PATCH 2/8] mm: memory-failure: ensure moving HWPoison flag to the raw error pages Date: Sat, 8 Jul 2023 16:57:38 +0800 Message-ID: <20230708085744.3599311-3-linmiaohe@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230708085744.3599311-1-linmiaohe@huawei.com> References: <20230708085744.3599311-1-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.174.151.185] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770843138304563654?= X-GMAIL-MSGID: =?utf-8?q?1770843138304563654?= |
Series |
A few fixup and cleanup patches for memory-failure
|
|
Commit Message
Miaohe Lin
July 8, 2023, 8:57 a.m. UTC
If hugetlb_vmemmap_optimized is enabled, folio_clear_hugetlb_hwpoison()
called from try_memory_failure_hugetlb() won't transfer HWPoison flag to
subpages while folio's HWPoison flag is cleared. So when trying to free
this hugetlb page into buddy, folio_clear_hugetlb_hwpoison() is not called
to move HWPoison flag from head page to the raw error pages even if now
hugetlb_vmemmap_optimized is cleared. This will results in HWPoisoned page
being used again and raw_hwp_page leak.
Fixes: ac5fcde0a96a ("mm, hwpoison: make unpoison aware of raw error info in hwpoisoned hugepage")
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
mm/memory-failure.c | 2 ++
1 file changed, 2 insertions(+)
Comments
On Sat, Jul 08, 2023 at 04:57:38PM +0800, Miaohe Lin wrote: > If hugetlb_vmemmap_optimized is enabled, folio_clear_hugetlb_hwpoison() > called from try_memory_failure_hugetlb() won't transfer HWPoison flag to > subpages while folio's HWPoison flag is cleared. So when trying to free > this hugetlb page into buddy, folio_clear_hugetlb_hwpoison() is not called > to move HWPoison flag from head page to the raw error pages even if now > hugetlb_vmemmap_optimized is cleared. This will results in HWPoisoned page > being used again and raw_hwp_page leak. > > Fixes: ac5fcde0a96a ("mm, hwpoison: make unpoison aware of raw error info in hwpoisoned hugepage") > Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> Acked-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
diff --git a/mm/memory-failure.c b/mm/memory-failure.c index d21ee27ad412..c155122e3c66 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -1913,6 +1913,8 @@ void folio_clear_hugetlb_hwpoison(struct folio *folio) { if (folio_test_hugetlb_raw_hwp_unreliable(folio)) return; + if (folio_test_hugetlb_vmemmap_optimized(folio)) + return; folio_clear_hwpoison(folio); folio_free_raw_hwp(folio, true); }