Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1207089imu; Wed, 23 Jan 2019 12:36:49 -0800 (PST) X-Google-Smtp-Source: ALg8bN7Q15c4y+KX4Cy1CTb5I23IKaRkRCPFsIHhnwLS/aSfOf2++0ypB/w7PE9BunC1oKWbPHla X-Received: by 2002:a65:62da:: with SMTP id m26mr3392773pgv.278.1548275809542; Wed, 23 Jan 2019 12:36:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548275809; cv=none; d=google.com; s=arc-20160816; b=YfZtuFvOh3r7+jJi5m+rUtbazczOGFFkL4Yey48XXdLUWL8SXaG0N+SW/a7vaE1EUk Gkf/Fkq7muKi0pBPmOcrhERdNEstjUpRcFLG7SsptwvymmQrJsJVRJG5fol3WqLy0XZF q7g/sY73GGHijInpZEgovEpse6BDY5XAMjt6Bl6xFne3gOxbP4sPAFZ14/mh5JVgTlhD JMiz//VrE7WVAbN+y48vQdLEwiM/yu8tY1TR12gtQMumRePvT/pamqPu67G/xEsBWICw AjsPe0nW0kqA4S2ZAF0JChf1lLC7oHe3R26zWgWod1/8c+oHMNP0aPpHav+juuRWtxTb J4Yw== 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=SKJLCHAPKT7F2kMasdD5CPgiqsCrm80NhZkTQRdPbiY=; b=persCZ2jM3AxKkKZvpAbTepK2szOt1/rpjDYVkgzus8muvJAQlXEry9dDAGUTQGe2j d6s9dy0OGPOL2VVWDNZQ9ZXd76RAry+Ko6sMQ5L08dU7Sah2srjSVtuFk1C/RGtgWCGd lSOnyW0/24SrNqDRpHv6s40hFrCPvPt+6EBZTVSfxV4KAJclsdy6V5GfuCNlHjqACHi0 d90VQpxMyBYZUt5QhrVu3dnZrwgpYPIjGD4k9nDa4fP5AilE5AIctBoQj5pg/iEOTT11 +GxJ/6o4jgne2k+o0MrzoSR8D8iKXaP/Sp2/ikfbhQ2T1u7XlvkTXFLSIBVCmyqiP+uY /irw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="BY9X9J/4"; 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 v10si3889139plg.82.2019.01.23.12.36.33; Wed, 23 Jan 2019 12:36:49 -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="BY9X9J/4"; 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 S1726766AbfAWUfx (ORCPT + 99 others); Wed, 23 Jan 2019 15:35:53 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:46680 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726192AbfAWUfw (ORCPT ); Wed, 23 Jan 2019 15:35:52 -0500 Received: by mail-lf1-f67.google.com with SMTP id f5so2579385lfc.13 for ; Wed, 23 Jan 2019 12:35:51 -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=SKJLCHAPKT7F2kMasdD5CPgiqsCrm80NhZkTQRdPbiY=; b=BY9X9J/4+qqxYeGyF3R59zxkMjOBG19x6ckQ3lzQ8Ru+lHBQz5Wyx5u058TqaI8R+Z qAmOrx5ByYriMlr+YA0ByQJdlVx3veIJOEF+gI83DzB5PUQc/2ZZMGeD81NKhNvS3PWM /uSEKiKERYfDI2z3E2tUOXDOKJqrmctffswU4= 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=SKJLCHAPKT7F2kMasdD5CPgiqsCrm80NhZkTQRdPbiY=; b=I5GAjG0P27YTqJFShZS5ifZTWTFypZfkHs3huwhqChPZifmU/wjn8PArICxx1yh7d+ +Zi1Au9jgNFEV9nyVVuV3TlAdiP0A77NDC3TRDDoQJdRigQ/6ffbv5gSjd+wqqUJzJMg 5j3m9KtT5SML7OmwZKiArHf3upjge65BDLfbpUgTWWFlpw7IKAsIwqopxnX5XM+mWWdv qOlChX17ZbnHhoVwmsSbITFfKsWZp8fxuwbDqwWj/beXAM0nHb1ouJsCIYQJOfYWx63t CWYpku3U5ESR2b0O6arZDkp2jraignfZSgn9cyVjn5gGk7rXw0UUqXO2gili7KELplQp HH/Q== X-Gm-Message-State: AJcUukeW266sbn0pp2he/bxUMs93M1pYMhT/bA8k1gHJGYy+Y6If+t2n aEKNAoI+6+BTJNVjmIPXapCEp1Z/hwoQbg== X-Received: by 2002:a19:a28e:: with SMTP id l136mr3000840lfe.87.1548275750830; Wed, 23 Jan 2019 12:35:50 -0800 (PST) Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com. [209.85.208.178]) by smtp.gmail.com with ESMTPSA id v64sm635729lfa.48.2019.01.23.12.35.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 12:35:49 -0800 (PST) Received: by mail-lj1-f178.google.com with SMTP id v15-v6so3152862ljh.13 for ; Wed, 23 Jan 2019 12:35:49 -0800 (PST) X-Received: by 2002:a2e:880a:: with SMTP id x10-v6mr3388044ljh.174.1548275749194; Wed, 23 Jan 2019 12:35: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: From: Linus Torvalds Date: Thu, 24 Jan 2019 09:35:32 +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 9:27 AM Linus Torvalds wrote: > > I've reverted the 'let's try to just remove the code' part in my tree. > But I didn't apply the two other patches yet. Any final comments > before that should happen? Side note: the inode_permission() addition to can_do_mincore() in that patch 0002, seems to be questionable. We do +static inline bool can_do_mincore(struct vm_area_struct *vma) +{ + return vma_is_anonymous(vma) + || (vma->vm_file && (vma->vm_file->f_mode & FMODE_WRITE)) + || inode_permission(file_inode(vma->vm_file), MAY_WRITE) == 0; +} note how it tests whether vma->vm_file is NULL for the FMODE_WRITE test, but not for the inode_permission() test. So either we test unnecessarily in the second line, or we don't properly test it in the third one. 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. Anybody? Anyway, it's one reason why I didn't actually apply those other two patches yet. This may be a 5.1 issue.. Linus