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=-13.6 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1, USER_IN_DEF_DKIM_WL 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 165E2C433E2 for ; Mon, 31 Aug 2020 20:36:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A4F66208A9 for ; Mon, 31 Aug 2020 20:36:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="cXMgYuoM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A4F66208A9 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D12826B0003; Mon, 31 Aug 2020 16:36:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C9C766B0037; Mon, 31 Aug 2020 16:36:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B637F6B0055; Mon, 31 Aug 2020 16:36:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 9931C6B0003 for ; Mon, 31 Aug 2020 16:36:34 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 46E0C180AD80F for ; Mon, 31 Aug 2020 20:36:34 +0000 (UTC) X-FDA: 77212021908.20.mom69_1d006bb27092 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id 1677D180C07A3 for ; Mon, 31 Aug 2020 20:36:34 +0000 (UTC) X-HE-Tag: mom69_1d006bb27092 X-Filterd-Recvd-Size: 5696 Received: from mail-oo1-f65.google.com (mail-oo1-f65.google.com [209.85.161.65]) by imf19.hostedemail.com (Postfix) with ESMTP for ; Mon, 31 Aug 2020 20:36:33 +0000 (UTC) Received: by mail-oo1-f65.google.com with SMTP id m25so1797015oou.0 for ; Mon, 31 Aug 2020 13:36:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=ALZ0cI088e7LavEE1zCuQl43dEIuq04xSG5XkBRnPb4=; b=cXMgYuoMdUne52TPYEQ+RFvNI7fYFdPFXmQNr2cTfKwhpwzXvn0C1UEkM2V288lmdo Bm09UkGWR+j1NnjJtpdsgh4pu7bbkdCOYa4W6LaTudcHbvcA1MeAlIMLvCJZGeFuwJSd SvC9QFsb45+heQ0E4L08PQpV0mZ/S1U6t2LLcDOgdATl+i0OpteWp66eF+2mglWO+iNz Un2AVZq41XE8zU42eC/gUHnwuKWSRdtpSqKVwu6OTepuiEVN/pA74/aDMO4b5HYmNr/s tVHEKv2wvuGJw9bi7Jl8VE6G61KmRs9aF6dPYuIbzLMXOzjKoUJmYltdWsB2lQYUceaK J7Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=ALZ0cI088e7LavEE1zCuQl43dEIuq04xSG5XkBRnPb4=; b=C3JCqS+ftLYh+hAyErNEppixvoyYsOzfCAqoldq0ahhCPfphVeIv+YgYvRSMTwrN+V 9bCgnu3mMH+SCrW9IifJcv55eewsBZZdm2SBz3zVyKJPxaqOyrGDTo7zu6trCB7mGfs+ a9lVNxtERnIgOtK+XUZ8hGU53tHZYuOUnpimSk3ooue69LXATZw22vavxoyFbmsI7Iz1 eFTMJ956KS60tfHd87tWJ4AdrHtYKFczVWcRjy5kqXLUcZAGCj6bbngLdqQVbUem7orJ Cq9gnugn65rjLvZ7iYgWw8vV1+QeksW9zsm5076CRZrZ9+OHLxRpkr5hQb9gItFXRkao WyRg== X-Gm-Message-State: AOAM532WCgeFGIvXwCzLN7oJ3+pYbnPePtNZ2zdc7QXAaUvBotMCs8GM bTTRoXLvICl19b+M1n02yxG/MQ== X-Google-Smtp-Source: ABdhPJxlYmDe1he0nb+ZttHTJoAT3S1OZGqNC/UYyfdM76yoUFWtJWVAxMeAPXce/Tx266vERYW5SA== X-Received: by 2002:a4a:d157:: with SMTP id o23mr1078948oor.2.1598906192708; Mon, 31 Aug 2020 13:36:32 -0700 (PDT) Received: from eggly.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id l22sm2035015oot.22.2020.08.31.13.36.30 (version=TLS1 cipher=ECDHE-ECDSA-AES128-SHA bits=128/128); Mon, 31 Aug 2020 13:36:31 -0700 (PDT) Date: Mon, 31 Aug 2020 13:36:16 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Jann Horn cc: Hugh Dickins , Andrew Morton , Linus Torvalds , Christoph Hellwig , kernel list , Linux-MM , linux-fsdevel , Alexander Viro , "Eric W . Biederman" , Oleg Nesterov Subject: Re: [PATCH v5 7/7] mm: Remove the now-unnecessary mmget_still_valid() hack In-Reply-To: Message-ID: References: <20200827114932.3572699-1-jannh@google.com> <20200827114932.3572699-8-jannh@google.com> User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Rspamd-Queue-Id: 1677D180C07A3 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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 Mon, 31 Aug 2020, Jann Horn wrote: > On Mon, Aug 31, 2020 at 8:07 AM Hugh Dickins wrote: > > On Thu, 27 Aug 2020, Jann Horn wrote: > > > > > The preceding patches have ensured that core dumping properly takes the > > > mmap_lock. Thanks to that, we can now remove mmget_still_valid() and all > > > its users. > > > > Hi Jann, while the only tears to be shed over losing mmget_still_valid() > > will be tears of joy, I think you need to explain why you believe it's > > safe to remove the instance in mm/khugepaged.c: which you'll have found > > I moved just recently, to cover an extra case (sorry for not Cc'ing you). > > > > > --- a/mm/khugepaged.c > > > +++ b/mm/khugepaged.c > > > @@ -431,7 +431,7 @@ static void insert_to_mm_slots_hash(struct mm_struct *mm, > > > > > > static inline int khugepaged_test_exit(struct mm_struct *mm) > > > { > > > - return atomic_read(&mm->mm_users) == 0 || !mmget_still_valid(mm); > > > + return atomic_read(&mm->mm_users) == 0; > > > } > > > > > > static bool hugepage_vma_check(struct vm_area_struct *vma, > > > > The movement (which you have correctly followed) was in > > bbe98f9cadff ("khugepaged: khugepaged_test_exit() check mmget_still_valid()") > > but the "pmd .. physical page 0" issue is explained better in its parent > > 18e77600f7a1 ("khugepaged: retract_page_tables() remember to test exit") > > > > I think your core dumping is still reading the page tables without > > holding mmap_lock > > Where? get_dump_page() takes mmap_lock now: > Right, sorry for the noise, that's precisely what 6/7 is all about, and properly declares itself there in its Subject - I plead that I got distracted by the vma snapshot part of the series, and paid too little attention before bleating. Looks good to me - thanks. > > I don't think there should be any paths into __get_user_pages() left > that don't hold the mmap_lock. Actually, we should probably try > sticking mmap_assert_locked() in there now as a follow-up? Maybe: I haven't given it thought, to be honest. Hugh