Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1385896imu; Wed, 23 Jan 2019 16:22:44 -0800 (PST) X-Google-Smtp-Source: ALg8bN7R+qhU5iQTMVCE0odTDjkP4g4lFgjSRa5C08RDvcIeHkhTc7msjKT4QUzt3EmapcU6Bu1j X-Received: by 2002:a63:bc02:: with SMTP id q2mr3968621pge.116.1548289364342; Wed, 23 Jan 2019 16:22:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548289364; cv=none; d=google.com; s=arc-20160816; b=aosyApD8GRnchn5yjZUGzwfHPYLq05NzSmZmn2lKfiNU9RFh5KADKLoo2NbzkK4lM4 nQ1bYqMBbyXR9woVpSAHQq7pfEcuEWRJTCZQ7LLpli1OOdwjS5z6aZCby4ZAJPkbwdBw Q2uSLnL7gpYbtiPjnZEH5QPVYdzV1jSzyoqqiK373n+7LqcOrWmaiou9uAyAnknLkcB8 Eu/XaS49twLdZhtqg8Y8CJ5Vh+OD4mWRyifXOLRHX0JIA65Mm+CKFhg1juMIUIFa1ZuK 10J6Z5tA+YIpGocShwsPqIxljfXWxuQbhikB969Uc/Q9CmxIHEFmlC/Wr+EGygceOGnN qsig== 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=8I8uV3WmaHvuIIbILWs8wayzXWD2yoy7pULfBcUtKtA=; b=TD+NjOD1UZTcoCHPjShJTPoYWvz+CNpsnQrZwQSvJhKJdGzp3BoMDymfArgq1XeDNW BQ2NROYjof7CHCB9AtS9E2vH0k+4eNivdNaRgPNYYUc7GCt9zmhL6/w3tAHth7PG4tpt XwzPeC/PLxDS79tdWsaVre+PWrG1746p0e+ASE5M6IaMKDo4UAlHV0y41R0GXJ2JR+CI pSmu0CtXaS7rIsnpk8Y+WzcNuXj9erTJA1R+8OQpSy/UXEcOm4+BcRyN/fdu8Kb9g7cW 5GMa9AkcUKIrLtOxnmFwzykFEksBLENfP9NF+QX7E93y0VSnVkbeEC52/EWk/Y3LY/B5 Gsrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="PH9V0/KK"; 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 m188si675305pfb.266.2019.01.23.16.22.29; Wed, 23 Jan 2019 16:22:44 -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="PH9V0/KK"; 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 S1726322AbfAXAVA (ORCPT + 99 others); Wed, 23 Jan 2019 19:21:00 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:37819 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726078AbfAXAVA (ORCPT ); Wed, 23 Jan 2019 19:21:00 -0500 Received: by mail-lf1-f66.google.com with SMTP id y11so2992133lfj.4 for ; Wed, 23 Jan 2019 16:20:59 -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=8I8uV3WmaHvuIIbILWs8wayzXWD2yoy7pULfBcUtKtA=; b=PH9V0/KK92bXTEP81nt/LjQ6SSJLxS2F5++KT1VQvagruTtDYwwS38WCMe6QCTl1S9 M/9QB21XB+xpradFhe9+OrMMThoKxz5UPxF1nlYho5qbehIWzvZfhcn0/eS81yXC++tg bTuEa1IIpQqjLr/qqfcnvuWomWwQUP+zq6EPA= 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=8I8uV3WmaHvuIIbILWs8wayzXWD2yoy7pULfBcUtKtA=; b=PGgxpG42vp7iTg4pEOctDczIiU6P35FRhAliYBjyOD8RE5V6uyvmPRjQ6X+EN1kVM0 NU+FLEnEx7vTwQ4n2Wgiy0zWmA3kjWS8+DQ0l7ZjNjWHWRaznRejgvUUNRnzIDRCsY9X KN9F+bc7nQPGiaG6BtQHLpPlmTZ8UBxCxJ6Muo3+quR/5tHDHJHmeZUp7bb8mf30/CcU p34QJyt4FXaZMAljBdLikSluZMfE1CXGBUYDDfSHD0atDgjlH12jEsGjua+isyTa4Sr+ ES9NaBluTWCEdjSC5qQdremNtwwol8Jr/ScnAkylEvwtCF+FVujW/SDKr+zJRYKAmzkn dRFQ== X-Gm-Message-State: AJcUukfJg7Vxjyz59Q4czLZR6smj65BGVDWxYiCB8Tfu4AjTAD5y9M1I OeW2e8GSZNEfvBv9HRSn7MvVV7dt0bD2yw== X-Received: by 2002:a19:5a05:: with SMTP id o5mr3663781lfb.140.1548289257136; Wed, 23 Jan 2019 16:20:57 -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 u65sm739551lff.54.2019.01.23.16.20.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 16:20:55 -0800 (PST) Received: by mail-lf1-f47.google.com with SMTP id b20so2967851lfa.12 for ; Wed, 23 Jan 2019 16:20:54 -0800 (PST) X-Received: by 2002:a19:980f:: with SMTP id a15mr3398536lfe.103.1548289254203; Wed, 23 Jan 2019 16:20:54 -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: From: Linus Torvalds Date: Thu, 24 Jan 2019 13:20:37 +1300 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] mm/mincore: allow for making sys_mincore() privileged To: Jiri Kosina 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 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 Thu, Jan 24, 2019 at 12:12 PM Jiri Kosina wrote: > > > > > I think the "test vm_file" thing may be unnecessary, because a > > non-anonymous mapping should always have a file pointer and an inode. > > But I could imagine some odd case (vdso mapping, anyone?) that > > doesn't have a vm_file, but also isn't anonymous. > > Hmm, good point. > > So dropping the 'vma->vm_file' test and checking whether given vma is > special mapping should hopefully provide the desired semantics, shouldn't > it? Maybe. But on the whole I think it would be simpler and more straightforward to just instead add a vm_file test for the inode_permission() case. That way you at least know that you aren't following a NULL pointer. If the file then turns out to be some special thing, it doesn't really _matter_, I think. It won't have anything in the page cache etc, but the code should "work". Linus