Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp1190085pxy; Thu, 6 May 2021 02:27:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxa3v/HAmp3ZuJIdQZQMcHUp79tQDicpuwE/S4abHC3Z6WCatKi5JIRWIFYaI78f7aA9KH2 X-Received: by 2002:a17:90b:2307:: with SMTP id mt7mr15890804pjb.131.1620293271684; Thu, 06 May 2021 02:27:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620293271; cv=none; d=google.com; s=arc-20160816; b=pZXIY20TuFdYOXvCxgfZ6nXLTLvi5bsn/EOH/oXUIRTXqZkLHG3mSykBRG5t7sTg+o Bn8iwUDG0PRldmH0eE/LyiSG5kfHqfCqFYbqaIejr1adqrBkY9TSCe0vbSGs86AZXWSw 5U/6Y3MSk1OJYWVtGw3Rx8Ln1kkKrH7H++4+y1Qs05ZwYQ7qfR7b8pfSP5ix7GwRsi5k EFZPYRWnKw49lgBbW54gIC42P69qYONTZVsaWOAB38mXFymbVALQaT6DmeYqYmd877Ne 6U0Nh4Ag/yPjcQctAo3pkWfYP10DetYUBuHNwrtFbq6yRpf+iuMufXoyx9XfjLuTD4nf Xe6w== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=FH81BUJ3aazGiMJIB7qw1+ejkrWJ4S64JcZilkls4zQ=; b=RrFwGJvrwciutnlC62ChqAU7bRE1TaSo+9+iO84e8NoAHuwz6LoYjq5SH519ZOi8pO aOFf8O7RodBBUYeCN5g0d7qlEx7v9yNME2FEdPY8bhH3/It9RKIvS5cb7x0OB21K7VJJ 8Vd8J1Wsh9pt2PWORNJcisN1NheHC/ApdC3+8/iKPtfrT0kSMz2P3L8vAAFPzM/iBdvW BmXnmHskD/KWJF4XQzfGdzgbi07HxRrH0mTf1eL1vX/5dfSaEEJBZWw7OmYtpZltuM/S OfQ9vGYDpi2O3VTMn40ovUQ1uK4rAaDD4b+v4mli+zXKyPk6rhaWa6v71zhfH7knB1U/ Lf5Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b18si1783111plh.378.2021.05.06.02.27.37; Thu, 06 May 2021 02:27:51 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233927AbhEFIxg (ORCPT + 99 others); Thu, 6 May 2021 04:53:36 -0400 Received: from mail.kingsoft.com ([114.255.44.145]:24439 "EHLO mail.kingsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233464AbhEFIxc (ORCPT ); Thu, 6 May 2021 04:53:32 -0400 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.79) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrFIsWRmVeSWpSXmKPExsXCFcHor+u/bnKCQddeS4vpjV4Wc9avYbNY d7yL2eLr+l9AYtIFNotr2z0sll36zGRx4+BmNosnq7eyW+zZe5LFYurED2wWl3fNYbO4t+Y/ q8X9PgeLj/uDLf7/esVqcbHxAKPFmWlFFkfWb2eyaDzyns3i7eGDzBbLz85jszi86RaTxe8f QI3PWq+yOEh6rJm3htFjYvM7do+ds+6ye2xeoeWxaVUnm8emT5PYPU7M+M3isfOhpcfkG8sZ PVp3/GX3eHF1I4vHx6e3WDze77vK5rF+y1UWjzMLjgB1nq4OEIzisklJzcksSy3St0vgynj0 yadgimDFt09PWBsYe3m7GDk5JARMJDpnTGbuYuTiEBKYziTRs38DO4TzjFFi+q6pTF2MHBws AioSJ5qVQBrYBFQldt2bxQpiiwgoSXRt3skGUs8s0Mwu0fxzAjNIQljASeL485uMIDavgJVE 47YORpA5nAJ6Eh+PKUDMb2eWmHDsGdggfgExid4r/8F2SQjYSzxerwjRKihxcuYTFhCbWUBH 4sSqY8wQtrzE9rdzwGwhAUWJw0t+sUM8Iy9x9/d0Rgg7VqLpwC22CYzCs5CMmoVk1CwkoxYw Mq9iZCnOTTfcxAhJDuE7GOc1fdQ7xMjEwXiIUYKDWUmE9/SiyQlCvCmJlVWpRfnxRaU5qcWH GKU5WJTEeRtnAqUE0hNLUrNTUwtSi2CyTBycUg1M3rlRn+8xObiteCq0te8lX7P/o/eTfd0O nc9wqzRbvXy59vl30fGchx4ZP2c8/rSzyoNxX8FdfxtZqcXfm2/Lf30u1tERv/IMT/HC+urS 6l3Hl6zgz7Jx33Xr+9qA9xM1y75P48pSb1HhS7/eZay/mbt/6ZnNNa0qSyY7223ND2Bie1r6 xa5Q6ebnb/2sDLpZ26xX7qpfMeX/+mWWN9lua9Tx+udonzLbuKbeasakFa1zNJeeFWUXenSo ebuaYph9/wbz3O1+qUI3jgjOMUrWTc//LcOjJTFFR6vksN3TD+xLy8MWnVEzXfE5bVvFMbHH op7z3FsMZTLTp9WZ5F47ea/2i4Emn/bbxTGNKuuUWIozEg21mIuKEwE2i6YafQMAAA== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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