Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2018238imu; Sat, 5 Jan 2019 12:19:45 -0800 (PST) X-Google-Smtp-Source: ALg8bN7CmIg8wzWdL1huCPMh9e0BbL/rpsfa973e7/eO/ek2bowysupOj/Pkj9CzzPgZsP00UgCM X-Received: by 2002:a63:ef04:: with SMTP id u4mr5866019pgh.197.1546719585300; Sat, 05 Jan 2019 12:19:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546719585; cv=none; d=google.com; s=arc-20160816; b=i3Mp+FQrAgLKazx1OPZZWRaW73hyyWAZ7RsfqzxInPtNZ4E/otevEQ5OxV/AJuH4v8 xdLgL7cqvZ+eRfal3+AIE/TP1njE91bvnjSK2vnWT+gy9tSVyai8dAQShlORT9jTULAS a5BO5ajJTUGAwWPrQ1OzRzME1U29FRPISJFrpbCUBgIFWGe64ouTfVBCoF5p69RPp0J5 59jgGT6m39Xagzjkna+ejpqT8gt5wbFC2T4Y+XByWizSok87EmE9tt05aVb6yzKj8K8o LisvZQm8znn+aR737s63GmBLCCU5WU4So5ykuMrrX7jKreXvZG22jBp92Ey5+hrKJuHj HXdg== 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=BRF36iWgYXCowecQCa4ahsuhW8PKhuB6aSQnN1znDbc=; b=LVFJPebVaFNmNKYjkJSv6HumeVVbgvdu+7SPFf+ilO+7W2x17D7GYQkfeth+iqCsqe tXkQe/JwG6YfXEuRI6UqsUwu/YqPtRAK/3FLgCTvyNdRruULNzLDMiLj88d/cQ92sOoC Ws/5Hu5B+9dVAFic/VF1DHQMJghY46mHnFEaGdHbYHHPS8kGgt4AcsX2l+jYj/fEt+WP 6jPQ2ueDixG3Kc9rafTgHGSUm4XotHu3yySLOIJtYwupwMaOYn3btAp3VAdoWcyZFxVe imko//pLCOcjG0bghcIvevqilDp8yu00lmBMAW+8jqpxYSg+xgaBDERqOMIRolZirzr6 1Llg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=K2mrC1he; 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 c3si54657137pls.73.2019.01.05.12.19.29; Sat, 05 Jan 2019 12:19:45 -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=K2mrC1he; 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 S1726311AbfAEURc (ORCPT + 99 others); Sat, 5 Jan 2019 15:17:32 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:45505 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726282AbfAEURc (ORCPT ); Sat, 5 Jan 2019 15:17:32 -0500 Received: by mail-lf1-f67.google.com with SMTP id b20so27601947lfa.12 for ; Sat, 05 Jan 2019 12:17:30 -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=BRF36iWgYXCowecQCa4ahsuhW8PKhuB6aSQnN1znDbc=; b=K2mrC1helUL4L325HY2NrT1I4s0DGh5TZeQoHqBCb4EiGtuS6OMSSMFj/IXj91AApP 0WIe+9z7ZKrZaj/QnItuCV8+QYEkOSxpr6DSt8xIIp314eWRJzAXpHNi0YCE6TpH5LnR EZ7lEPWEqoE21UAsTku9cUmNgSynPP2Ll+JaI= 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=BRF36iWgYXCowecQCa4ahsuhW8PKhuB6aSQnN1znDbc=; b=I9hVwZfyhmlHANKBKGfn1XLhtPIV6XyKlSO+YfcaDMf3S/4gC5AnlUJL27P5TY1c5z vhXtaJ7Z9+tL59xMUdoftaEmhYmlBOekMqDRJmYDk0/5Xls/XuE9pCmQGkr6iFcrI852 uJzNq9zk9ixLSMG3z//qJ0oydpASShFzXIYqUSYNgRmAz3nZRlLuslGwVxplWK4ZFcif GOH/Mlgiz2GtNTwvpo3DwLmU8LkN0xXS8RB7pS3pRt9wmbtFKqNaaVM8P2b31kYQ1P9a qChP/Hrob4heqJghF+pqY2JYg1AlBTZWCAQrheDk4B2kyWgdwAf+K4lvRdrvn242IySi 5jcg== X-Gm-Message-State: AA+aEWZdAAmD0mFDEApZB7bQLeGWE8GQS8ZEEVlkeMOS7fcVGp/49h8D w99py36ESDyvboGYxbnA39+5bt+YsZk= X-Received: by 2002:a19:7352:: with SMTP id o79mr30110747lfc.104.1546719449733; Sat, 05 Jan 2019 12:17:29 -0800 (PST) Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com. [209.85.208.171]) by smtp.gmail.com with ESMTPSA id j9sm68291lfk.74.2019.01.05.12.17.28 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 05 Jan 2019 12:17:28 -0800 (PST) Received: by mail-lj1-f171.google.com with SMTP id t18-v6so35098443ljd.4 for ; Sat, 05 Jan 2019 12:17:28 -0800 (PST) X-Received: by 2002:a2e:95c6:: with SMTP id y6-v6mr10266322ljh.59.1546719448269; Sat, 05 Jan 2019 12:17:28 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Sat, 5 Jan 2019 12:17:12 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] mm/mincore: allow for making sys_mincore() privileged To: Jiri Kosina Cc: Andrew Morton , Greg KH , Peter Zijlstra , Michal Hocko , linux-mm@kvack.org, Linux List Kernel Mailing , linux-api@vger.kernel.org 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 [ Crossed emails ] On Sat, Jan 5, 2019 at 12:12 PM Jiri Kosina wrote: > > I am still not completely sure what to return in such cases though; we can > either blatantly lie and always pretend that the pages are resident That's what my untested patch did. Or maybe just claim they are all not present? And again, that patch was entirely untested, so it may be garbage and have some fundamental problem. I also don't know exactly what rule might make most sense, but "you can write to the file" certainly to me implies that you also could know what parts of it are in-core. Who actually _uses_ mincore()? That's probably the best guide to what we should do. Maybe they open the file read-only even if they are the owner, and we really should look at file ownership instead. I tried to make that "can_do_mincore()" function easy to understand and easy to just modify to some sane state. Again, my patch is meant as a "perhaps something like this?" rather than some "this is _exactly_ how it must be done". Take the patch as a quick suggestion, not some final answer. Linus