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=-17.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 5E19EC433B4 for ; Wed, 5 May 2021 13:55:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A82406101C for ; Wed, 5 May 2021 13:55:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A82406101C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 237AE6B006C; Wed, 5 May 2021 09:55:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1AE756B006E; Wed, 5 May 2021 09:55:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F42006B0070; Wed, 5 May 2021 09:55:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0147.hostedemail.com [216.40.44.147]) by kanga.kvack.org (Postfix) with ESMTP id D39206B006C for ; Wed, 5 May 2021 09:55:49 -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 9AA98180AD807 for ; Wed, 5 May 2021 13:55:49 +0000 (UTC) X-FDA: 78107325618.05.34CB10E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf01.hostedemail.com (Postfix) with ESMTP id D80985001531 for ; Wed, 5 May 2021 13:55:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620222948; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wv7DtyHcfs2ySeIED82K+Ecm25ixAiJSXxqrEGIMQCg=; b=fgzIgTIEFNNhKhrYWC1s14gP2YeIk37o4C78gK1DdHB3CtLU3eIkMQfnY57TO2Kki9GVfY L28mElasnPE0dhOiIaYO0OL3uYaCarK3sXaHj07UbmWlRx22VLWAUgN12zg70+KHQCBn8U y1TS0jJ3VdM3wGgl+F0SRrs3g42ghHQ= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-271-Z1JUJdvdOICEz2sRSdUlVg-1; Wed, 05 May 2021 09:55:44 -0400 X-MC-Unique: Z1JUJdvdOICEz2sRSdUlVg-1 Received: by mail-ed1-f72.google.com with SMTP id u30-20020a50a41e0000b0290385504d6e4eso896969edb.7 for ; Wed, 05 May 2021 06:55:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=wv7DtyHcfs2ySeIED82K+Ecm25ixAiJSXxqrEGIMQCg=; b=cxJdu8D2azFQG85kydk0GQ25svyq3BEDHzIPf68f+9T3B/uQRCECFM02bXujXCMn2Q 3FtKvXOh8sxlX4lVophINWlC9bEXYv0q63kxTsF2EoU8Fn4P6Gncn/zmBuLEqc0t1GeZ jAzvVlEflR5+DTnm43Px5eB/+PaKY+0xStlZv1rnovbpikqsXWYK2Y1Rp4Dn88fNugQu XJ70uefxsmWMBeOh8LMdfQgN3ldH+vkt3mtR9fKr00OC0lRU31/C0iK5ueTIQ5cb3LY4 pI/0qGaKlhR1Ro+uE4ARmmdvvzYywYU3Fgwsw3BshVpIlFn5Dbagw9VZ1XrRPRl5ObQU XeSA== X-Gm-Message-State: AOAM531eeQW4B77ZHwM/Bgx2q4iPiDrGgOQQh/C3W4kc6qwUmJhChRIJ 4NNLeJDJm4AKW2Mrb+vroZk+RvTI7e0XI/QeW51DKo24SY+XRc32SIBAiydA/O+P1EnMc4qZ5HS UK1os9EW0IkA= X-Received: by 2002:a05:6402:2750:: with SMTP id z16mr33268680edd.355.1620222943466; Wed, 05 May 2021 06:55:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJytQVZt8vhG6EO2lG3Vi8QO/JWBTW2KMCExDOxIjfJW7nJy8h6I1m7TMVaMeBYyq3lDQvQNcQ== X-Received: by 2002:a05:6402:2750:: with SMTP id z16mr33268659edd.355.1620222943254; Wed, 05 May 2021 06:55:43 -0700 (PDT) Received: from [192.168.3.132] (p5b0c63bc.dip0.t-ipconnect.de. [91.12.99.188]) by smtp.gmail.com with ESMTPSA id k9sm16961732edv.69.2021.05.05.06.55.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 05 May 2021 06:55:43 -0700 (PDT) Subject: Re: [PATCH] Revert "mm/gup: check page posion status for coredump." To: Michal Hocko , Andrew Morton Cc: Aili Yao , linux-mm@kvack.org, LKML , Michal Hocko References: <20210505135407.31590-1-mhocko@kernel.org> From: David Hildenbrand Organization: Red Hat Message-ID: Date: Wed, 5 May 2021 15:55:42 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210505135407.31590-1-mhocko@kernel.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=fgzIgTIE; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf01.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 216.205.24.124) smtp.mailfrom=david@redhat.com X-Rspamd-Server: rspam03 X-Stat-Signature: jmyqqaz5wk7ppthhgosdfzz6xzwuwqud X-Rspamd-Queue-Id: D80985001531 Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf01; identity=mailfrom; envelope-from=""; helo=us-smtp-delivery-124.mimecast.com; client-ip=216.205.24.124 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1620222936-873542 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 05.05.21 15:54, Michal Hocko wrote: > From: Michal Hocko > > While reviewing http://lkml.kernel.org/r/20210429122519.15183-4-david@redhat.com > I have crossed d3378e86d182 ("mm/gup: check page posion status for > coredump.") and noticed that this patch is broken in two ways. First it > doesn't really prevent hwpoison pages from being dumped because hwpoison > pages can be marked asynchornously at any time after the check. > Secondly, and more importantly, the patch introduces a ref count leak > because get_dump_page takes a reference on the page which is not > releases. > > It also seems that the patch was merged incorrectly because there were > follow up changes not included as well as discussions on how to address > the underlying problem http://lkml.kernel.org/r/57ac524c-b49a-99ec-c1e4-ef5027bfb61b@redhat.com > > Therefore revert the original patch. > > Fixes: d3378e86d182 ("mm/gup: check page posion status for coredump.") > Signed-off-by: Michal Hocko > --- > mm/gup.c | 4 ---- > mm/internal.h | 20 -------------------- > 2 files changed, 24 deletions(-) > > diff --git a/mm/gup.c b/mm/gup.c > index 71e546e279fc..a33abe9048ed 100644 > --- a/mm/gup.c > +++ b/mm/gup.c > @@ -1592,10 +1592,6 @@ struct page *get_dump_page(unsigned long addr) > FOLL_FORCE | FOLL_DUMP | FOLL_GET); > if (locked) > mmap_read_unlock(mm); > - > - if (ret == 1 && is_page_poisoned(page)) > - return NULL; > - > return (ret == 1) ? page : NULL; > } > #endif /* CONFIG_ELF_CORE */ > diff --git a/mm/internal.h b/mm/internal.h > index ef5f336f59bd..43c4a2f8d4cc 100644 > --- a/mm/internal.h > +++ b/mm/internal.h > @@ -96,26 +96,6 @@ static inline void set_page_refcounted(struct page *page) > set_page_count(page, 1); > } > > -/* > - * When kernel touch the user page, the user page may be have been marked > - * poison but still mapped in user space, if without this page, the kernel > - * can guarantee the data integrity and operation success, the kernel is > - * better to check the posion status and avoid touching it, be good not to > - * panic, coredump for process fatal signal is a sample case matching this > - * scenario. Or if kernel can't guarantee the data integrity, it's better > - * not to call this function, let kernel touch the poison page and get to > - * panic. > - */ > -static inline bool is_page_poisoned(struct page *page) > -{ > - if (PageHWPoison(page)) > - return true; > - else if (PageHuge(page) && PageHWPoison(compound_head(page))) > - return true; > - > - return false; > -} > - > extern unsigned long highest_memmap_pfn; > > /* > Reviewed-by: David Hildenbrand -- Thanks, David / dhildenb