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=-12.1 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,URIBL_BLOCKED,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 26CE8C4727F for ; Wed, 30 Sep 2020 23:24:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C3FAF20BED for ; Wed, 30 Sep 2020 23:24:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="YhG3ShaC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732223AbgI3XYy (ORCPT ); Wed, 30 Sep 2020 19:24:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730441AbgI3XYy (ORCPT ); Wed, 30 Sep 2020 19:24:54 -0400 Received: from mail-yb1-xb41.google.com (mail-yb1-xb41.google.com [IPv6:2607:f8b0:4864:20::b41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43171C061755 for ; Wed, 30 Sep 2020 16:24:53 -0700 (PDT) Received: by mail-yb1-xb41.google.com with SMTP id k2so2576844ybp.7 for ; Wed, 30 Sep 2020 16:24:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kQN/VEfDdjX5avpgdFSz5SN2peX8hbqc+PeyEygnJJQ=; b=YhG3ShaC7/6QIeO5Erm4os2H5+E+5WD5nhBGQ365+hRsPNNApe1PegAwJL8cabUth9 eCJupXwhhMRD1JTLPGhlGYN2IwxT9VC1Bpv2PAYHsINuTeVSWn4K0FDzJ6/ALz439I/v ekXI0ZzYQVeprDUaSMJ3tqFdV40PzGIFgTAku5eelgxg9co9xc+o98ENBIxpQjufrrkb ehFjESqfYVfwSgXwzPqFLUyUXkKaaQVyvTu2XOXOvU+JL0RfW6bXHOf+EBy9kqY0nLIh 7hcztgIwWfUsHtdBvLx9okcGqBAC3lzvUnsBxhpOyKYR+f9bArFRPGKCNWLDPsp9wiiK qVjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kQN/VEfDdjX5avpgdFSz5SN2peX8hbqc+PeyEygnJJQ=; b=anLSH+8E/Xsj60Sa1bxQPIBWr3pcjtw8oiihWdRxNSmMkcPGvMW2WNxEXaIK9fWGOP DugZDCwPsOez5JBiKhpmP9XwO+FmDoY5VfUGZXxqmEBhsMP4WLAzIwXqNn8CSAkQT3Jf ZXaLxoAQzhCLndahxUdhvQDsYGePU0XfyJt0+TjHhVWaK/Q4epog1QZYA02rZCLlaPZ1 mj5Jc2RBsquC+YeY3MIa2sOmM2FdRVjwgTMNLb68MoBQFqkRfeQU68w0j1NisK5q/tMV 350I2l/rdR0U37UWDZPULQggO7+7kDhGeVF4zPqFoF3EYisKMjSrEWU+VkrNZrrOrm8k kclQ== X-Gm-Message-State: AOAM531LQf1vjA53SEH8EJx2rUpkF4vV8xzp+QxNhNoxda93zCh+6uJz Z3aAcFSFymsxG0NqovOVCWM1fjMs3HbyqT1VkhprAI3Mb5nWrQ== X-Google-Smtp-Source: ABdhPJzTtg1x0wdG8AGHlOHNnHHpxdHWuJaLj8KzGpnPhj796YLhl/jpix/ZR8BrjsAyUR+fR8iIV9VZq4PSeY/WIFk= X-Received: by 2002:a25:14d5:: with SMTP id 204mr6807010ybu.162.1601508292279; Wed, 30 Sep 2020 16:24:52 -0700 (PDT) MIME-Version: 1.0 References: <20200930011944.19869-1-jannh@google.com> <20200930123217.GD9916@ziepe.ca> In-Reply-To: <20200930123217.GD9916@ziepe.ca> From: Michel Lespinasse Date: Wed, 30 Sep 2020 16:24:39 -0700 Message-ID: Subject: Re: [PATCH 4/4] mm/gup: Assert that the mmap lock is held in __get_user_pages() To: Jason Gunthorpe Cc: Jann Horn , Andrew Morton , linux-mm , LKML , "Eric W . Biederman" , Mauro Carvalho Chehab , Sakari Ailus Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 30, 2020 at 5:32 AM Jason Gunthorpe wrote: > 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. Thanks for doing this, there is a lot of value in ensuring that a function's callers follows the prerequisites. Acked-by: Michel Lespinasse 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=-12.1 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,URIBL_BLOCKED,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 647F0C4363D for ; Wed, 30 Sep 2020 23:24:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CA225206F4 for ; Wed, 30 Sep 2020 23:24:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="YhG3ShaC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CA225206F4 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 2CDA16B005C; Wed, 30 Sep 2020 19:24:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2A4106B0062; Wed, 30 Sep 2020 19:24:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1E4E38E0001; Wed, 30 Sep 2020 19:24:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0091.hostedemail.com [216.40.44.91]) by kanga.kvack.org (Postfix) with ESMTP id 04E776B005C for ; Wed, 30 Sep 2020 19:24:54 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id B40913646 for ; Wed, 30 Sep 2020 23:24:53 +0000 (UTC) X-FDA: 77321310066.18.fuel27_4f05c8627196 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id 8CBCA1019678A for ; Wed, 30 Sep 2020 23:24:53 +0000 (UTC) X-HE-Tag: fuel27_4f05c8627196 X-Filterd-Recvd-Size: 3525 Received: from mail-yb1-f194.google.com (mail-yb1-f194.google.com [209.85.219.194]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Wed, 30 Sep 2020 23:24:53 +0000 (UTC) Received: by mail-yb1-f194.google.com with SMTP id b142so2574595ybg.9 for ; Wed, 30 Sep 2020 16:24:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kQN/VEfDdjX5avpgdFSz5SN2peX8hbqc+PeyEygnJJQ=; b=YhG3ShaC7/6QIeO5Erm4os2H5+E+5WD5nhBGQ365+hRsPNNApe1PegAwJL8cabUth9 eCJupXwhhMRD1JTLPGhlGYN2IwxT9VC1Bpv2PAYHsINuTeVSWn4K0FDzJ6/ALz439I/v ekXI0ZzYQVeprDUaSMJ3tqFdV40PzGIFgTAku5eelgxg9co9xc+o98ENBIxpQjufrrkb ehFjESqfYVfwSgXwzPqFLUyUXkKaaQVyvTu2XOXOvU+JL0RfW6bXHOf+EBy9kqY0nLIh 7hcztgIwWfUsHtdBvLx9okcGqBAC3lzvUnsBxhpOyKYR+f9bArFRPGKCNWLDPsp9wiiK qVjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kQN/VEfDdjX5avpgdFSz5SN2peX8hbqc+PeyEygnJJQ=; b=EqVptPr0OToktYQgEa9WBzcDcd1d6yRpHXtHJUHwYx2f7uGL+wfxfT8FTJi+fMmesz VkrHXS9QU4cAeZC5mHIV++dz1UKPo8r3yvsYlGRDzxG7OYxYKD8kA1+C+5x/+QZD7k7y B8e+hy0IJARXxiwEQHUei4uKw6RHvTlgSKScBoee55sV+TQxwqH3IJKsz/MzY5Iswi+e it8Tvgb0zUEZvfz91qYxmwOXKYZMM/Z0zo3hj7uSr/U99HL8WDdyV5bpA1AZ4+pZJKhL ApXru5GdfS6xzBzm8+fX7jcwxPmQeGUhBK0x8+q2l9D8qQwFoLL7meaW50fRis86DGTT Bjpg== X-Gm-Message-State: AOAM531t9vNflm+OMXG1kHOwzZYUxzg30OT+7kWI9H43WgCLwhb3Z1RY hTf789Yvgzm+wCMym4KWqRChfe9ToqfLYBP/7KTPzw== X-Google-Smtp-Source: ABdhPJzTtg1x0wdG8AGHlOHNnHHpxdHWuJaLj8KzGpnPhj796YLhl/jpix/ZR8BrjsAyUR+fR8iIV9VZq4PSeY/WIFk= X-Received: by 2002:a25:14d5:: with SMTP id 204mr6807010ybu.162.1601508292279; Wed, 30 Sep 2020 16:24:52 -0700 (PDT) MIME-Version: 1.0 References: <20200930011944.19869-1-jannh@google.com> <20200930123217.GD9916@ziepe.ca> In-Reply-To: <20200930123217.GD9916@ziepe.ca> From: Michel Lespinasse Date: Wed, 30 Sep 2020 16:24:39 -0700 Message-ID: Subject: Re: [PATCH 4/4] mm/gup: Assert that the mmap lock is held in __get_user_pages() To: Jason Gunthorpe Cc: Jann Horn , Andrew Morton , linux-mm , LKML , "Eric W . Biederman" , Mauro Carvalho Chehab , Sakari Ailus Content-Type: text/plain; charset="UTF-8" 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 Wed, Sep 30, 2020 at 5:32 AM Jason Gunthorpe wrote: > 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. Thanks for doing this, there is a lot of value in ensuring that a function's callers follows the prerequisites. Acked-by: Michel Lespinasse