Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1212699imu; Wed, 16 Jan 2019 14:56:48 -0800 (PST) X-Google-Smtp-Source: ALg8bN7sEFCKK+sCytK+CvEyvG+sFkBqWck6r7106to1G4YNZykOSXdak04U/x3QmKJb8trmojZ8 X-Received: by 2002:a62:43c1:: with SMTP id l62mr12531483pfi.22.1547679407942; Wed, 16 Jan 2019 14:56:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547679407; cv=none; d=google.com; s=arc-20160816; b=fAHaFfNr6JyhbQrK3+cAhhCFWNKxIS52vg2RJeW3U10vEmc2vb15290EGcYACfaLnF GjcgVaVKMNvPUVbNMUe35sOy81XlZLOMbepwqCtpdEpZuSUpbza5FEQHHSceRUqC/7RM XXfgO8RA5mCW04TIwXPYoL8I1dpOQa+TuWLboZESuKwNSrjBt37yyM52zsqHibxRxQLJ ZfC8X1xJcIgrA+UK8JYnRZa8R7j4u7yFMVIbY7Gu1TBrFbdWioYINMHYKT5vpyGirwiE zuUKBJSEog+jEL13ex4X6s5+5W/UAI2cgpXfkDz9kFpO9w2CymBKC4+gcfRpdKOhofB1 tJzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=uPRXlDclQzo4Oa6N/pVmeZlRDqbRuhOouJ5A1bsVJZk=; b=nzRLvvfvt6CGg4xLS2ZdRs1+jFAsgIRncRbL4IXqpklXUzXMxLc3nM56uuCFSDh/oT RUONK6gHUg6v3nEQfPrS7v9yqoYMp3CM/bTYEuRyb04t/GcEExWyDKW1bMu+inz+/GvT ULjL470Vv9j5dRNPfNM19bLDD3X2TbEgbNxTMI06yOonNKz7t94n5Sj1kzcnFLmVRCFt KxuH461jOpYsFpTDYTsuY01js8PkPD1Ogsi5x+N+MTNjXZmTN0WPiD9iX4aRbVgZ/CXK BAUR2n4z3k0xWlIdL4E2OPWnYRHFmiPxBfJpS1cp+oALTKerA1ozoeFmdRFJBFcNgiIZ gnQw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k62si1021977pfc.208.2019.01.16.14.56.32; Wed, 16 Jan 2019 14:56:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405333AbfAPQM3 (ORCPT + 99 others); Wed, 16 Jan 2019 11:12:29 -0500 Received: from mx2.suse.de ([195.135.220.15]:37634 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727988AbfAPQM2 (ORCPT ); Wed, 16 Jan 2019 11:12:28 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 9553FADC5; Wed, 16 Jan 2019 16:12:26 +0000 (UTC) Date: Wed, 16 Jan 2019 17:12:24 +0100 (CET) From: Jiri Kosina To: Linus Torvalds cc: Dominique Martinet , Andy Lutomirski , Josh Snyder , Dave Chinner , Matthew Wilcox , Jann Horn , Andrew Morton , Greg KH , Peter Zijlstra , Michal Hocko , Linux-MM , kernel list , Linux API Subject: Re: [PATCH] mm/mincore: allow for making sys_mincore() privileged In-Reply-To: Message-ID: References: <20190110004424.GH27534@dastard> <20190110070355.GJ27534@dastard> <20190110122442.GA21216@nautica> <5c3e7de6.1c69fb81.4aebb.3fec@mx.google.com> <9E337EA6-7CDA-457B-96C6-E91F83742587@amacapital.net> <20190116054613.GA11670@nautica> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 16 Jan 2019, Linus Torvalds wrote: > > "Being owner or has cap" (whichever cap) is probably OK. On the other > > hand, writeability check makes more sense in general - could we > > somehow check if the user has write access to the file instead of > > checking if it currently is opened read-write? > > That's likely the best option. We could say "is it open for write, or > _could_ we open it for writing?" > > It's a slightly annoying special case, and I'd have preferred to avoid > it, but it doesn't sound *compilcated*. > > I'm on the road, but I did send out this: > > https://lore.kernel.org/lkml/CAHk-=wif_9nvNHJiyxHzJ80_WUb0P7CXNBvXkjZz-r1u0ozp7g@mail.gmail.com/ > > originally. The "let's try to only do the mmap residency" was the > optimistic "maybe we can just get rid of this complexity entirely" > version.. > > Anybody willing to test the above patch instead? And replace the > > || capable(CAP_SYS_ADMIN) > > check with something like > > || inode_permission(inode, MAY_WRITE) == 0 > > instead? > > (This is obviously after you've reverted the "only check mmap > residency" patch..) So that seems to deal with mincore() in a reasonable way indeed. It doesn't unfortunately really solve the preadv2(RWF_NOWAIT), nor does it provide any good answer what to do about it, does it? Thanks, -- Jiri Kosina SUSE Labs