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=-4.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_2 autolearn=no 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 AA962C433B4 for ; Thu, 6 May 2021 08:52:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 95DED611EE for ; Thu, 6 May 2021 08:52:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 95DED611EE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kingsoft.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2091A6B006E; Thu, 6 May 2021 04:52:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1DEEE6B0070; Thu, 6 May 2021 04:52:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 031E76B0071; Thu, 6 May 2021 04:52:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0159.hostedemail.com [216.40.44.159]) by kanga.kvack.org (Postfix) with ESMTP id D95036B006E for ; Thu, 6 May 2021 04:52:36 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 8F3F1181AEF09 for ; Thu, 6 May 2021 08:52:36 +0000 (UTC) X-FDA: 78110190312.17.4F7B1B1 Received: from mail.kingsoft.com (unknown [114.255.44.146]) by imf20.hostedemail.com (Postfix) with ESMTP id D7280132 for ; Thu, 6 May 2021 08:52:26 +0000 (UTC) X-AuditID: 0a580157-bebff70000027901-b8-6093ae4f6513 Received: from mail.kingsoft.com (localhost [10.88.1.79]) (using TLS with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.kingsoft.com (SMG-1-NODE-87) with SMTP id 07.4C.30977.F4EA3906; Thu, 6 May 2021 16:52:31 +0800 (HKT) Received: from alex-virtual-machine (10.88.1.103) by KSBJMAIL4.kingsoft.cn (10.88.1.79) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 6 May 2021 16:52:29 +0800 Date: Thu, 6 May 2021 16:52:29 +0800 From: Aili Yao To: Michal Hocko CC: David Hildenbrand , , Andrew Morton , "Michael S. Tsirkin" , Jason Wang , Alexey Dobriyan , Mike Rapoport , "Matthew Wilcox (Oracle)" , Oscar Salvador , "Roman Gushchin" , Alex Shi , Steven Price , Mike Kravetz , Jiri Bohac , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , "Wei Liu" , Naoya Horiguchi , , , , , Subject: Re: [PATCH v1 3/7] mm: rename and move page_is_poisoned() Message-ID: <20210506165229.320e950f@alex-virtual-machine> In-Reply-To: References: <20210429122519.15183-1-david@redhat.com> <20210429122519.15183-4-david@redhat.com> <0710d8d5-2608-aeed-10c7-50a272604d97@redhat.com> <20210506085611.1ec21588@alex-virtual-machine> <20210506152805.13fe775e@alex-virtual-machine> Organization: kingsoft X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.88.1.103] X-ClientProxiedBy: KSBJMAIL1.kingsoft.cn (10.88.1.31) To KSBJMAIL4.kingsoft.cn (10.88.1.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xLy8MWnVEzXfE5bVvFMbHH op7z3FsMZTLTp9WZ5F47ea/2i4Emn/bbxTGNKuuUWIozEg21mIuKEwE2i6YafQMAAA== X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: D7280132 X-Stat-Signature: ibnz8c45n7kdkpyx3q8qi3kjwjiqeo1f Authentication-Results: imf20.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf20.hostedemail.com: domain of yaoaili@kingsoft.com designates 114.255.44.146 as permitted sender) smtp.mailfrom=yaoaili@kingsoft.com Received-SPF: none (kingsoft.com>: No applicable sender policy available) receiver=imf20; identity=mailfrom; envelope-from=""; helo=mail.kingsoft.com; client-ip=114.255.44.146 X-HE-DKIM-Result: none/none X-HE-Tag: 1620291146-42863 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 Thu, 6 May 2021 09:55:51 +0200 Michal Hocko wrote: > On Thu 06-05-21 15:28:05, Aili Yao wrote: > > On Thu, 6 May 2021 09:06:14 +0200 > > Michal Hocko wrote: > > > > > On Thu 06-05-21 08:56:11, Aili Yao wrote: > > > > On Wed, 5 May 2021 15:27:39 +0200 > > > > Michal Hocko wrote: > [...] > > > > > I am not sure I follow. My point is that I fail to see any added value > > > > > of the check as it doesn't prevent the race (it fundamentally cannot as > > > > > the page can be poisoned at any time) but the failure path doesn't > > > > > put_page which is incorrect even for hwpoison pages. > > > > > > > > Sorry, I have something to say: > > > > > > > > I have noticed the ref count leak in the previous topic ,but I don't think > > > > it's a really matter. For memory recovery case for user pages, we will keep one > > > > reference to the poison page so the error page will not be freed to buddy allocator. > > > > which can be checked in memory_faulure() function. > > > > > > So what would happen if those pages are hwpoisoned from userspace rather > > > than by HW. And repeatedly so? > > > > Sorry, I may be not totally understand what you mean. > > > > Do you mean hard page offline from mcelog? > > No I mean soft hwpoison from userspace (e.g. by MADV_HWPOISON but there > are other interfaces AFAIK). > > And just to be explicit. All those interfaces are root only > (CAP_SYS_ADMIN) so I am not really worried about any malitious abuse of > the reference leak. I am mostly concerned that this is obviously broken > without a good reason. The most trivial fix would have been to put_page > in the return path but as I've mentioned in other email thread the fix > really needs a deeper thought and consider other things. > > Hope that clarifies this some more. Thanks, got it! Yes, there are some test scenarios that should be covered. But for test, the default SIGBUS handlers is usually replaced, and the test process may not hit the coredump code. Anyway, there is a ref leak in the normal enviorments and better to be fixed. Thanks! Aili Yao