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=-7.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 2232AC4727F for ; Wed, 30 Sep 2020 12:32:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AF0FD2071E for ; Wed, 30 Sep 2020 12:32:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="GUGGoSv/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AF0FD2071E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0A3216B006E; Wed, 30 Sep 2020 08:32:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 052EA6B0070; Wed, 30 Sep 2020 08:32:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E82FD6B0071; Wed, 30 Sep 2020 08:32:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0059.hostedemail.com [216.40.44.59]) by kanga.kvack.org (Postfix) with ESMTP id D1B436B006E for ; Wed, 30 Sep 2020 08:32:19 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 95C0C181AE865 for ; Wed, 30 Sep 2020 12:32:19 +0000 (UTC) X-FDA: 77319665598.23.jeans69_3f13f1b27192 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin23.hostedemail.com (Postfix) with ESMTP id 77A4637606 for ; Wed, 30 Sep 2020 12:32:19 +0000 (UTC) X-HE-Tag: jeans69_3f13f1b27192 X-Filterd-Recvd-Size: 4107 Received: from mail-qv1-f65.google.com (mail-qv1-f65.google.com [209.85.219.65]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Wed, 30 Sep 2020 12:32:18 +0000 (UTC) Received: by mail-qv1-f65.google.com with SMTP id cv8so749396qvb.12 for ; Wed, 30 Sep 2020 05:32:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=NkfhHWqAyTXfsHUI0Z4eVtQNkwGeBFdljOZ84SCK75I=; b=GUGGoSv/+Zv/Uq7Uw1zhk63u/eHB/U4rT/5bP8wIu7UwiI+nt2KRiWKpcHUl0qoTw6 rJUIwRmN4L2cprluAoSgLHWcIAMWfRIYyxJ3tTB8g4nJF+LQAzgm5gAZPeDCMSCcXOgi muMYRHXyLdX1Q7BW1No7xEPmeohy4cJtByCMrokGA0fI8vMMWs8DfCku0GrXBtlWnN2T jQxgjzfdbgQOQge0gNFmt8U0Wkc1Fpqp2g9uS/iprfFvk4M5FoyriSZHVYYC70BX/yHZ 0+9L20hw+fCOvid6nhsW7QnsSqP492hv2+L5lOlAqOZOs53MxDbbilEPKju5k5yUR/aH vZLA== 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:message-id:references :mime-version:content-disposition:in-reply-to; bh=NkfhHWqAyTXfsHUI0Z4eVtQNkwGeBFdljOZ84SCK75I=; b=ZTmgo41mxLDZ7xNGIslTMsuG1v+q3HVvOuR8518MpICLKTNcX7fWcpHtMHgFjjQQ0z soLs4brG7eaH3YrxwOAqOvD5JdG8hdQ+H4kvka7ZBUkna8RJ5zvTrPeujxi/Pd/jiB2R Htxt9pCsU4XWm1wfc+lD/zI6RtpD5SiCUkJVi/adiVdy2N642E11WSot77C4EKZDlbiZ kCfbNgFwpEH0vPWwXYx3CN1cIEkNNL5WdigfOVqs1UZPhAeyyrz8LEeQAgJpD4j6vmAV u0LrxFZ2vwce+iLeNjSgjK9Ifn0Rt4UNoDETukuvBK3f9X2ikDncO+5ywkmSgbrrfFtO mWBg== X-Gm-Message-State: AOAM532bJvOOgju/pHWnFeSLDfHvWl3CF/joEYEP/d1Qyng8ECDnZIWK 1GNEMMJWA5PdPwSfPe3ODc3RLQ== X-Google-Smtp-Source: ABdhPJxr1lJohZaVmNubjdVqFxJt30RPkWUcDblap0Wx8uvGAf8koWgYxRBQ3wu+zrgv4Al9PQ7N6g== X-Received: by 2002:a0c:e5cf:: with SMTP id u15mr2213842qvm.14.1601469138414; Wed, 30 Sep 2020 05:32:18 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-48-30.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.48.30]) by smtp.gmail.com with ESMTPSA id u46sm2193852qth.31.2020.09.30.05.32.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Sep 2020 05:32:17 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1kNbHN-003w8o-3n; Wed, 30 Sep 2020 09:32:17 -0300 Date: Wed, 30 Sep 2020 09:32:17 -0300 From: Jason Gunthorpe To: Jann Horn Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Eric W . Biederman" , Michel Lespinasse , Mauro Carvalho Chehab , Sakari Ailus Subject: Re: [PATCH 4/4] mm/gup: Assert that the mmap lock is held in __get_user_pages() Message-ID: <20200930123217.GD9916@ziepe.ca> References: <20200930011944.19869-1-jannh@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Sep 29, 2020 at 06:20:01PM -0700, Jann Horn wrote: > After having cleaned up all GUP callers (except for the atomisp staging > driver, which currently gets mmap locking completely wrong [1]) to always > ensure that they hold the mmap lock when calling into GUP (unless the mm is > not yet globally visible), add an assertion to make sure it stays that way > going forward. > > [1] https://lore.kernel.org/lkml/CAG48ez3tZAb9JVhw4T5e-i=h2_DUZxfNRTDsagSRCVazNXx5qA@mail.gmail.com/ > > Signed-off-by: Jann Horn > --- > mm/gup.c | 2 ++ > 1 file changed, 2 insertions(+) I'm happy to see this, I have observed many cases of missing locking here. Reviewed-by: Jason Gunthorpe Thanks, Jason