From mboxrd@z Thu Jan 1 00:00:00 1970 Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 19 Oct 2016 10:52:18 +0200 (CEST) Received: from mail-wm0-f67.google.com ([74.125.82.67]:34092 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP id S23991970AbcJSIwLiLAGv (ORCPT ); Wed, 19 Oct 2016 10:52:11 +0200 Received: by mail-wm0-f67.google.com with SMTP id d199so2913402wmd.1 for ; Wed, 19 Oct 2016 01:52:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=3M66/bNLGeKw93lmYO/4myEaPJESI31toadHmsPriNE=; b=KWm/NyRkPeRjw5Zh/fu2FDjtKDy06ihp3p+d9iYf8Xc4a9ins+uz/K/zzWaoT56paa liMeD2EMyyNZgU5A1woLcGZUOR9dIhUc7lFShDG85ArHIQPP6SDfbrSKG5BxWBIl8z9+ BEpba0+AThu8gc6WuRJC/dyHpNmYZ+TUE7JWYGIy8gRC3hPyxW5vgbm0Jsvry7uA7VJc BQ0MWY68jaGshSQbVyIULK1obG6vuq2/qx83IJmU5k8rB12W2gotQ2rShHVT+SlbEVJG 49NCXTnmAI73KY09m42UQSbE8gXbkUsyhTgq8yq0U1MjgcXZO/3JkjlI9zIihuthXpXM axsA== X-Gm-Message-State: AA6/9Rkq/iJKjz4GyQf/r3kLIImwviJA2Kak9ufF3NF9W7RxSBhHoq06zj1D3she+qugTQ== X-Received: by 10.28.157.8 with SMTP id g8mr1702087wme.33.1476867126304; Wed, 19 Oct 2016 01:52:06 -0700 (PDT) Received: from localhost ([213.151.95.130]) by smtp.gmail.com with ESMTPSA id r1sm67519949wjc.43.2016.10.19.01.52.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 19 Oct 2016 01:52:05 -0700 (PDT) Date: Wed, 19 Oct 2016 10:52:05 +0200 From: Michal Hocko To: Lorenzo Stoakes Cc: Jan Kara , linux-mm@kvack.org, Linus Torvalds , Hugh Dickins , Dave Hansen , Rik van Riel , Mel Gorman , Andrew Morton , adi-buildroot-devel@lists.sourceforge.net, ceph-devel@vger.kernel.org, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, kvm@vger.kernel.org, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-cris-kernel@axis.com, linux-fbdev@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-mips@linux-mips.org, linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-scsi@vger.kernel.org, linux-security-module@vger.kernel.org, linux-sh@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, netdev@vger.kernel.org, sparclinux@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH 08/10] mm: replace __access_remote_vm() write parameter with gup_flags Message-ID: <20161019085204.GD7517@dhcp22.suse.cz> References: <20161013002020.3062-1-lstoakes@gmail.com> <20161013002020.3062-9-lstoakes@gmail.com> <20161019075903.GP29967@quack2.suse.cz> <20161019081352.GB7562@dhcp22.suse.cz> <20161019084045.GA19441@lucifer> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161019084045.GA19441@lucifer> User-Agent: Mutt/1.6.0 (2016-04-01) Return-Path: X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0) X-Orcpt: rfc822;linux-mips@linux-mips.org Original-Recipient: rfc822;linux-mips@linux-mips.org X-archive-position: 55503 X-ecartis-version: Ecartis v1.0.0 Sender: linux-mips-bounce@linux-mips.org Errors-to: linux-mips-bounce@linux-mips.org X-original-sender: mhocko@kernel.org Precedence: bulk List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: linux-mips X-List-ID: linux-mips List-subscribe: List-owner: List-post: List-archive: X-list: linux-mips On Wed 19-10-16 09:40:45, Lorenzo Stoakes wrote: > On Wed, Oct 19, 2016 at 10:13:52AM +0200, Michal Hocko wrote: > > On Wed 19-10-16 09:59:03, Jan Kara wrote: > > > On Thu 13-10-16 01:20:18, Lorenzo Stoakes wrote: > > > > This patch removes the write parameter from __access_remote_vm() and replaces it > > > > with a gup_flags parameter as use of this function previously _implied_ > > > > FOLL_FORCE, whereas after this patch callers explicitly pass this flag. > > > > > > > > We make this explicit as use of FOLL_FORCE can result in surprising behaviour > > > > (and hence bugs) within the mm subsystem. > > > > > > > > Signed-off-by: Lorenzo Stoakes > > > > > > So I'm not convinced this (and the following two patches) is actually > > > helping much. By grepping for FOLL_FORCE we will easily see that any caller > > > of access_remote_vm() gets that semantics and can thus continue search > > > > I am really wondering. Is there anything inherent that would require > > FOLL_FORCE for access_remote_vm? I mean FOLL_FORCE is a really > > non-trivial thing. It doesn't obey vma permissions so we should really > > minimize its usage. Do all of those users really need FOLL_FORCE? > > I wonder about this also, for example by accessing /proc/self/mem you trigger > access_remote_vm() and consequently get_user_pages_remote() meaning FOLL_FORCE > is implied and you can use /proc/self/mem to override any VMA permissions. I yes this is the desirable and expected behavior. > wonder if this is desirable behaviour or whether this ought to be limited to > ptrace system calls. Regardless, by making the flag more visible it makes it > easier to see that this is happening. mem_open already enforces PTRACE_MODE_ATTACH -- Michal Hocko SUSE Labs