From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04680C43387 for ; Thu, 17 Jan 2019 21:45:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CE40E2086D for ; Thu, 17 Jan 2019 21:45:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728135AbfAQVpa (ORCPT ); Thu, 17 Jan 2019 16:45:30 -0500 Received: from mx2.suse.de ([195.135.220.15]:43942 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726900AbfAQVp3 (ORCPT ); Thu, 17 Jan 2019 16:45:29 -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 1DF0CAD7D; Thu, 17 Jan 2019 21:45:28 +0000 (UTC) Subject: Re: [PATCH] mm/mincore: allow for making sys_mincore() privileged To: Josh Snyder , Dominique Martinet Cc: Linus Torvalds , Andy Lutomirski , Dave Chinner , Jiri Kosina , Matthew Wilcox , Jann Horn , Andrew Morton , Greg KH , Peter Zijlstra , Michal Hocko , Linux-MM , kernel list , Linux API References: <20190110070355.GJ27534@dastard> <20190110122442.GA21216@nautica> <5c3e7de6.1c69fb81.4aebb.3fec@mx.google.com> <9E337EA6-7CDA-457B-96C6-E91F83742587@amacapital.net> <20190116054613.GA11670@nautica> <20190116063430.GA22938@nautica> From: Vlastimil Babka Message-ID: Date: Thu, 17 Jan 2019 22:45:25 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/16/2019 8:52 AM, Josh Snyder wrote: > On Tue, Jan 15, 2019 at 10:34 PM Dominique Martinet > wrote: >> >> There is a difference with your previous patch though, that used to list no >> page in core when it didn't know; this patch lists pages as in core when it >> refuses to tell. I don't think that's very important, though. I've argued previously that reporting false positives (as your patch does) should be better, otherwise there might be somebody trying to fault in their pages in a loop until mincore reports positive, which would become an endless loop. So agreed with your change. Or maybe we could resort to the 5.0-rc1 page table check (that is now being reverted) but only in cases when we are not allowed the page cache residency check? Or would that be needlessly complicated? And it would be able to leak if a page was evicted from the page cache... > Is there a reason not to return -EPERM in this case? That would definitely break somebody. >> >> If anything, the 0400 user-owner file might be a problem in some edge >> case (e.g. if you're preloading git directories, many objects are 0444); >> should we *also* check ownership?... > > Yes, this seems valuable. Some databases with immutable files (e.g. git, as > you've mentioned) conceivably operate this way. > > Josh >