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=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,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 8A2D5C388F7 for ; Fri, 13 Nov 2020 00:02:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id ECA70207BB for ; Fri, 13 Nov 2020 00:02:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="E7lwuiW4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ECA70207BB 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 7A3326B006E; Thu, 12 Nov 2020 19:02:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 753F86B0071; Thu, 12 Nov 2020 19:02:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 643656B0072; Thu, 12 Nov 2020 19:02:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0072.hostedemail.com [216.40.44.72]) by kanga.kvack.org (Postfix) with ESMTP id 34CB56B006E for ; Thu, 12 Nov 2020 19:02:08 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id C736B8249980 for ; Fri, 13 Nov 2020 00:02:07 +0000 (UTC) X-FDA: 77477442294.10.hen44_360a80a2730a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id 9FEBF16A0BE for ; Fri, 13 Nov 2020 00:02:07 +0000 (UTC) X-HE-Tag: hen44_360a80a2730a X-Filterd-Recvd-Size: 5061 Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Fri, 13 Nov 2020 00:02:06 +0000 (UTC) Received: by mail-qk1-f194.google.com with SMTP id r7so7360789qkf.3 for ; Thu, 12 Nov 2020 16:02:06 -0800 (PST) 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:content-transfer-encoding:in-reply-to; bh=JpORj5SRIF6kbUi6eMJyhwjTKhIggfnZZH4GCFeLuxU=; b=E7lwuiW4jGXC+G/5DJvAta9blQ/xE5ncv/4oNOnhGnOLVWV+XeLXM7XtzX7UdqbnYf 2GN491Lq/hJE9p3K6qQvM9fTjw+l40xhXOJC7SxFyqOz5iIpTQgc3lGAzbHUgySXKMNy E4hXe7NlPvXVuJoOAE+3fxJRjYXQ11hpC7n8DV6r4lSSlh8+5cAugWJnlgSM02u0mbpi rR3apAS0TIxp2ewloK84IR4ScFTAGatz3XWHAE6eo02VTrZUflU4bWJAjm4j/cIPt18n 9bttSomPHhTQCOVEdNw6Pw4WCX2n9sBRh9WJZ1QhZ3aoiRPx4nfArTJQnCXcp54HAm8z 4Oww== 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:content-transfer-encoding :in-reply-to; bh=JpORj5SRIF6kbUi6eMJyhwjTKhIggfnZZH4GCFeLuxU=; b=JZHjghDr/vX6xRVB181XIvBMq2kGQtjLxRBLZDVebueT5nwi2YOCi6iQCCWu/G73tS zEkHar3yW9KIaLCONDj9+sxBSbZPyNBPBO47h8U+HP22Mj4liA1JRgB2U4ltRQmg/2kU DwXlNvyhL8gKvx+JgDlfhHrIX6/0qJFcHkzlJMKDxcSYl95/2MpccMbhpxYd1uafqP9B ArbFXqdY46zhyYZVdul+Bm/TB0DJigufeBg+n3S91WWJmBp9B9ndEIvlpLkTq4po5nO6 hqvwSaqSeaAK4Cg1AV3MEg0+S8srKQJzY8Zh4q+c24JSe0RLe+X6MbEC7wenIIjHcpYe xvqw== X-Gm-Message-State: AOAM533akigJIVt6Tx4XiKJ2yFxHngyx/t7G7fpqq4UyaAqEE7YluxU/ vQAZ1JHNdL0B5bq/KpcftWiiFw== X-Google-Smtp-Source: ABdhPJyfszv1c2zCo3KbwW6r9etDRhTimKjTtnJy/p2IorUmc5Zz9O1VugG6KcMkJKl1DGWDkClkcA== X-Received: by 2002:a37:5088:: with SMTP id e130mr2462816qkb.34.1605225726390; Thu, 12 Nov 2020 16:02:06 -0800 (PST) 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 z6sm5393509qti.88.2020.11.12.16.02.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Nov 2020 16:02:05 -0800 (PST) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1kdMXV-004Bqk-8p; Thu, 12 Nov 2020 20:02:05 -0400 Date: Thu, 12 Nov 2020 20:02:05 -0400 From: Jason Gunthorpe To: Dennis Dalessandro Cc: Ira Weiny , dledford@redhat.com, Jann Horn , linux-rdma@vger.kernel.org, Mike Marciniszyn , linux-mm@kvack.org Subject: Re: [PATCH for-rc v2] IB/hfi1: Move cached value of mm into handler Message-ID: <20201113000205.GX244516@ziepe.ca> References: <20201112025837.24440.6767.stgit@awfm-01.aw.intel.com> <20201112171439.GT3976735@iweiny-DESK2.sc.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: 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 Thu, Nov 12, 2020 at 05:08:22PM -0500, Dennis Dalessandro wrote: > 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= valid > > > > when closing the hfi1 cdev. It attempted to do this by saving a c= ached > > > > value of the current->mm pointer at file open time. This is a pro= blem if > > > > another process with access to the FD calls in via write() or ioc= tl() to > > > > pin pages via the hfi driver. The other fix tried to solve a use = after > > > > 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= opened > > > > the cdev if it was accessing via an IOCTL, and another process > > > > attempting to close the cdev with a different current->mm. > > >=20 > > > Again I'm still not seeing the race here.=C2=A0 It is entirely poss= ible > > > that the fix > > > I was trying to do way back was mistaken too...=C2=A0 ;-)=C2=A0 I w= ould just > > > delete the > > > last 2 sentences...=C2=A0 and/or reference the commit of those fixe= s and help > > > explain this more. > >=20 > > I was attempting to refer to [1], the email that started all of this. >=20 > That link should be: > [1] https://marc.info/?l=3Dlinux-rdma&m=3D159891753806720&w=3D2 And consistently use lore.kernel.org links please :\ Jason