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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 5902CC433B4 for ; Thu, 6 May 2021 08:13:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A7B9261057 for ; Thu, 6 May 2021 08:13:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A7B9261057 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 098F16B006C; Thu, 6 May 2021 04:13:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 036416B006E; Thu, 6 May 2021 04:13:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E17C96B0070; Thu, 6 May 2021 04:13:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0170.hostedemail.com [216.40.44.170]) by kanga.kvack.org (Postfix) with ESMTP id C51CF6B006C for ; Thu, 6 May 2021 04:13:47 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 8BE08180AD830 for ; Thu, 6 May 2021 08:13:47 +0000 (UTC) X-FDA: 78110092494.05.CF73F55 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf26.hostedemail.com (Postfix) with ESMTP id 1C510407F8DB for ; Thu, 6 May 2021 08:13:34 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1620288825; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ko5Il7tnnaRh/+DWXvFr0zXq1UzJJiHuAYa3FhMkhY8=; b=DvYo4XmNOYmmrEoAZYXLTtTy/YE4UC2FnkoOEJAMP+jxdN2+/tgKZjwR+JpMPKjXgMNecI 0uMm3ZjM0hg3VyIcL18eYC3Iu7lciFzXgVkNc+pbYqPyCcNmcg8Gj5JmWj3OPdzg1aaCws 6E4OkjKv23e4xHMFUeG3Mk+1OSIY6Tg= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id E7909B1C3; Thu, 6 May 2021 08:13:43 +0000 (UTC) Date: Thu, 6 May 2021 09:55:51 +0200 From: Michal Hocko To: Aili Yao Cc: David Hildenbrand , linux-kernel@vger.kernel.org, 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 , linux-hyperv@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, yaoaili126@gmail.com Subject: Re: [PATCH v1 3/7] mm: rename and move page_is_poisoned() Message-ID: 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210506152805.13fe775e@alex-virtual-machine> Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=DvYo4XmN; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf26.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.15 as permitted sender) smtp.mailfrom=mhocko@suse.com X-Stat-Signature: j6pu3pjhgpn1qt5nfk1bjye7srqa3cjh X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 1C510407F8DB Received-SPF: none (suse.com>: No applicable sender policy available) receiver=imf26; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1620288814-462843 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 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. -- Michal Hocko SUSE Labs