Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1123131imu; Wed, 16 Jan 2019 13:10:35 -0800 (PST) X-Google-Smtp-Source: ALg8bN7LipiOAbRzOsLTUKnu2Uz321O0JVX6W2nKDagSgZbu3zuEKy9bbP/FqNB+SeqbVDlruIbj X-Received: by 2002:a63:e711:: with SMTP id b17mr10409762pgi.363.1547673035232; Wed, 16 Jan 2019 13:10:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547673035; cv=none; d=google.com; s=arc-20160816; b=qL3Fkndt2HLZdHij1AyfDT6okNFNlVHJHgPwIrTR9dB2iu3JnzOZSJeUtSqLgxEtuu +x4iNzNC/C8nAcE2dzWgIm/ODmj7+7BWmLwfmjSbXhEJq2AgHcVHDaGV8bIe2JVuSICW KNeqPt2jp38QkS112xR9fpL4l04LX2AW2QTNGnR5Sl4cyaEMm4VvRLyJicLTYuW8gyit HVriXWcPXNAAVViVpiLD40chEXV0olMz0cjWwAkRkoGb+Vq6pxTA8hcTcYez57Bpec2Z wFTvyfZhFGtKgXaE7wcnd37l3dt7FYm5M/GJUOwOGnlH2lHnkkJ2DoVHpiggdVXe9uNv Ww3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ZZS1U4v3VDXUyEzZkch2LpzJzGSGpGfSwXpd93MlFK4=; b=xoOBogbdNw51lWAHvcyAP2maCcRmR9ysogFZx48dhUX/HOR95qr7qTfrNTGrk/htNq YVPQEjMYEh9yJVP+D9jEcg92XhhVa1hM5LZXeobe/GJ5yCm7+epnwim0NmU82o4NnNyz UtcWkPszjXuCbNnp1K2SLPknRwtYRCo8JltudObkRNtaY0QP7qpaa6saqgiHY0D6y2Bs /bBcT+mCIwAfDq6r9rUJzwjX2G8CRfXNpqnDQaiwuco28WKbWXTsYnlfRv8GItaKWLbo YX2q49Ou04Yu1WwDZGxH4IgBHdJy7EODl4tFC2jQsLnxJ95ZM+fyHbNlNE2CJ+PTK+1T gY2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=PPNwGegn; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w5si7258068pfl.279.2019.01.16.13.10.18; Wed, 16 Jan 2019 13:10:35 -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; dkim=pass header.i=@linux-foundation.org header.s=google header.b=PPNwGegn; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732861AbfAPF6y (ORCPT + 99 others); Wed, 16 Jan 2019 00:58:54 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:34491 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729061AbfAPF6y (ORCPT ); Wed, 16 Jan 2019 00:58:54 -0500 Received: by mail-lj1-f196.google.com with SMTP id u89-v6so4426033lje.1 for ; Tue, 15 Jan 2019 21:58:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZZS1U4v3VDXUyEzZkch2LpzJzGSGpGfSwXpd93MlFK4=; b=PPNwGegng2NcNnY4scnYrVjmXI/IOp7EcDNxzrLfLqB1Z6oAmDCmQFBvGCPnpyNDak t+OaiqHTIpJ5WZRC0xGNwJ/DmR6oi4yJAQ1xfTGRPzfSsREsHHbLttRkZXqm3asv03xb D2ojNpW7Jvq3VlY3z0zP4wGyOck8ObDRQi2NY= 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=ZZS1U4v3VDXUyEzZkch2LpzJzGSGpGfSwXpd93MlFK4=; b=JPyq4JO+Y+8MY53dsMCtgmMb7mIGeP2OMFttf0UGTZs25TEMbl+65tQizvtzHpZcs7 ARWCmnBMd3EcGqiv4ZPGJjeZYpD6SMYymmynwznf9vEkF4CN755WydEaAgc1ftGEwDOT wnVv6t3ddzrmDOvG9rdtlmD4EuyvQ0YOfwZtSORSDF4VzqscrKEPuqxyY3tZAKroHANS uvWFmeez0DdavA4K1hRRrhg4efWJnWggXLKJZ5AsoUwZZ00DRWafT+bBYtHVaunJtiE7 r8QttChRBUPka0aL2yv0dZVf3RbgYa8cjwg2W5vXGWP76sM70YTn9nUihfCnQvhe4i7O L20Q== X-Gm-Message-State: AJcUukck+Hx6319wdDg3k7Y99wHy//VHaJr0MLbo+iu13MqCYC05Q36k w6uaNgFCQLvJfUBL8hlPZ7Kr8vf/Kvs= X-Received: by 2002:a2e:9d17:: with SMTP id t23-v6mr5220180lji.57.1547618331595; Tue, 15 Jan 2019 21:58:51 -0800 (PST) Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com. [209.85.167.47]) by smtp.gmail.com with ESMTPSA id m21sm987239lfl.97.2019.01.15.21.58.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Jan 2019 21:58:50 -0800 (PST) Received: by mail-lf1-f47.google.com with SMTP id e26so3939427lfc.2 for ; Tue, 15 Jan 2019 21:58:49 -0800 (PST) X-Received: by 2002:a19:4287:: with SMTP id p129mr5557953lfa.135.1547618329349; Tue, 15 Jan 2019 21:58:49 -0800 (PST) MIME-Version: 1.0 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> In-Reply-To: <20190116054613.GA11670@nautica> From: Linus Torvalds Date: Wed, 16 Jan 2019 17:58:32 +1200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] mm/mincore: allow for making sys_mincore() privileged To: Dominique Martinet Cc: Andy Lutomirski , Josh Snyder , Dave Chinner , Jiri Kosina , Matthew Wilcox , Jann Horn , Andrew Morton , Greg KH , Peter Zijlstra , Michal Hocko , Linux-MM , kernel list , Linux API Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 16, 2019 at 5:46 PM Dominique Martinet 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..) Linus