Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp1153768pxy; Thu, 6 May 2021 01:28:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdGwI8EPyKr5BL8+plL0pAT51/xMvUKu84orbDegwOQK9wNdvMkrvYoi+HDSg1UJE/Hxde X-Received: by 2002:a17:902:db01:b029:eb:36ed:36f4 with SMTP id m1-20020a170902db01b02900eb36ed36f4mr3427736plx.61.1620289684655; Thu, 06 May 2021 01:28:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620289684; cv=none; d=google.com; s=arc-20160816; b=PYhrNAh0H7DC1TSZISI6uJpUBE03sTR/aLMx7CKmqbt4bSodW9JCLN+VfALPW+HT2q 1Yj/M7zFc2MJnTUXx9OQSQYU3JoGJ3BxP+dI/XUUmb+S0tuR57G8URZu6bf86m82Jac9 DNrGj/PsktnIWGVzruvdPPq1nuy6UcODRut58xpKv5jNS0+vStVE7DXXmooGnHgHJ5Wr ebikA02gZ9+1iIJnRPvkCmtVGIvPe8nCBWDK2Mjty4ibAWOyZmiwOWuyMhPiCJ/dM2tJ +CsbE6gSriNen/BAMrSGfiDfBcz/kR+EsrHv7cWcJ06i7TvRAW24n1/nLVvbm7Tt57aP KJzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ko5Il7tnnaRh/+DWXvFr0zXq1UzJJiHuAYa3FhMkhY8=; b=n0DFfkWshTAhHbh59U1RDl9N16x/9pZAW7yuZFopGq915DaeRp+hdELHBclryZxpGQ P3TVlAZCoX1LNgm8qB78jCKnQnYE1BuhMIY9f+CSkn8rDM3e+tAHN2cLn1ogmOKyl35e QPuWPAr1Y5EvlFz4xEeu/mTRSwjA8dgTu2f8qkUFqa5ffXHtc7HJbHoP/1FX5GVT0jVj Pq9qd2YG0RdDOjrgr1sKNWA5DRnulyZnG0s8F2e4A0jn7OjaSAShrctzdTuct6CBLs+A ZnO+oBGwnybWjUFLieS5wQocNMUG83hHuZuJUuMXFTrAAQP+SqylHYIjmK2lHdTzlkAA 1dIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=DvYo4XmN; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f1si2642229pge.539.2021.05.06.01.27.52; Thu, 06 May 2021 01:28:04 -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; dkim=pass header.i=@suse.com header.s=susede1 header.b=DvYo4XmN; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233689AbhEFIOq (ORCPT + 99 others); Thu, 6 May 2021 04:14:46 -0400 Received: from mx2.suse.de ([195.135.220.15]:41122 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229461AbhEFIOp (ORCPT ); Thu, 6 May 2021 04:14:45 -0400 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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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