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=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 935C1C388F7 for ; Thu, 12 Nov 2020 22:08:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 16EA822201 for ; Thu, 12 Nov 2020 22:08:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 16EA822201 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=cornelisnetworks.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 62D396B005C; Thu, 12 Nov 2020 17:08:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5DC9C6B005D; Thu, 12 Nov 2020 17:08:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4F3786B0068; Thu, 12 Nov 2020 17:08:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0126.hostedemail.com [216.40.44.126]) by kanga.kvack.org (Postfix) with ESMTP id 226846B005C for ; Thu, 12 Nov 2020 17:08:28 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id BD22F1EE6 for ; Thu, 12 Nov 2020 22:08:27 +0000 (UTC) X-FDA: 77477155854.20.pull70_181730127309 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id 92F4F180C07A3 for ; Thu, 12 Nov 2020 22:08:27 +0000 (UTC) X-HE-Tag: pull70_181730127309 X-Filterd-Recvd-Size: 3411 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by imf35.hostedemail.com (Postfix) with ESMTP for ; Thu, 12 Nov 2020 22:08:26 +0000 (UTC) IronPort-SDR: xqqt3727tCXI8UXNFi8BZRRkNWGikyrNSEFuhzZudVKZ18ULBBdLEUHMo16+a7SeIa6CVGOvBG yySvKW2zxb5Q== X-IronPort-AV: E=McAfee;i="6000,8403,9803"; a="150239814" X-IronPort-AV: E=Sophos;i="5.77,473,1596524400"; d="scan'208";a="150239814" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Nov 2020 14:08:25 -0800 IronPort-SDR: oSJg95d+2qGVSc9BPM+O7l7Ft+ZCzI1FJhAPLj7FpsqLPipmi/QzvoSu8Ic+EkeguCaQj4BSR8 w12mNhyiftGw== X-IronPort-AV: E=Sophos;i="5.77,473,1596524400"; d="scan'208";a="542419330" Received: from ddalessa-mobl.amr.corp.intel.com (HELO [10.254.205.29]) ([10.254.205.29]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Nov 2020 14:08:23 -0800 Subject: Re: [PATCH for-rc v2] IB/hfi1: Move cached value of mm into handler From: Dennis Dalessandro To: Ira Weiny Cc: jgg@ziepe.ca, dledford@redhat.com, Jann Horn , linux-rdma@vger.kernel.org, Mike Marciniszyn , linux-mm@kvack.org, Jason Gunthorpe References: <20201112025837.24440.6767.stgit@awfm-01.aw.intel.com> <20201112171439.GT3976735@iweiny-DESK2.sc.intel.com> Message-ID: Date: Thu, 12 Nov 2020 17:08:22 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable 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 11/12/2020 5:06 PM, Dennis Dalessandro wrote: > On 11/12/2020 12:14 PM, Ira Weiny wrote: >> On Wed, Nov 11, 2020 at 09:58:37PM -0500, Dennis Dalessandro wrote: >>> Two earlier bug fixes have created a security problem in the hfi1 >>> driver. One fix aimed to solve an issue where current->mm was not val= id >>> when closing the hfi1 cdev. It attempted to do this by saving a cache= d >>> value of the current->mm pointer at file open time. This is a problem= if >>> another process with access to the FD calls in via write() or ioctl()= to >>> pin pages via the hfi driver. The other fix tried to solve a use afte= r >>> free by taking a reference on the mm. This was just wrong because its >>> possible for a race condition between one process with an mm that ope= ned >>> the cdev if it was accessing via an IOCTL, and another process >>> attempting to close the cdev with a different current->mm. >> >> Again I'm still not seeing the race here.=C2=A0 It is entirely possibl= e=20 >> that the fix >> I was trying to do way back was mistaken too...=C2=A0 ;-)=C2=A0 I woul= d just=20 >> delete the >> last 2 sentences...=C2=A0 and/or reference the commit of those fixes a= nd help >> explain this more. >=20 > I was attempting to refer to [1], the email that started all of this. That link should be: [1] https://marc.info/?l=3Dlinux-rdma&m=3D159891753806720&w=3D2 -Denny