Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2430583imu; Thu, 10 Jan 2019 14:13:32 -0800 (PST) X-Google-Smtp-Source: ALg8bN7UX0Nlrc/rbu4Pi+hGU6q+svo86uDNlFwxQkPC91Wu0DZ8GGaCc5wJG0K9YAyqG7YGouNQ X-Received: by 2002:a63:65c7:: with SMTP id z190mr8834709pgb.249.1547158412769; Thu, 10 Jan 2019 14:13:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547158412; cv=none; d=google.com; s=arc-20160816; b=ZPScTrNiJ8koYg91C7vzzmSLBqzas0BZQ2txJ8eAgL0iq7qlXk1CHwzlGDiZA/2RIv xIXbhKKzO45naLWjBWvVmf0t3GJc9hSfXHYVZiqLPP7zwL2Fx87YZ1r5GslDNDvwP4LY lMOFWqbVz8h0NrFfp+GCAcAvkQ0Czrs4VFszelCZ5J6/4k1NCUBXPJy439JFV+AVosUy /K/MnVi2QAdvyiniOIi1NOhLUwcr8cxHSURmbpZ9Dvg/ZsxyVUk05zqxrlYywL55GqqP H+4jnvosO1POM07VNpp30LKvLunTW+JEGhl3km8GN+SLtxsFxxZj6uX1A6H09mF2+dBA UKxg== 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=KdjYJOzVCfeCe7Ioc9Rew5+ItUP7VYboNciWI+K3Sds=; b=CAqs534MZM6tuogjG6aWX1c/zZe4HWryr4qd2Sal7p8uSrhVLW2nZWHSNWTerv/g47 G6Ur7YkyCrbpVyFlvQo1ANl1YGg2zmljCYEF41wPRgeU2xJEypYDQVpmJZo3L8utSTj7 5ghr68D16Oi7dmSCxs5Ga/9BvQ5cHXy+BbrzeupKBZC4YarOBmvqkrHISEXhz8Wj/guf xuNmxITi2ficRM8M0+VO23UGFhirg+5SiPtRJVe5hxvUHjnP24sgAgoohDdGGNsT7sUK 57npQ+8UOEWSCbXQFD5a9MYIxHbbqXeLgW7J86UDfCIZs/hiskOuhZBzq2XiAvFSVPAE 4Hkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="KhRR3r7/"; 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 r11si9078841plo.319.2019.01.10.14.13.17; Thu, 10 Jan 2019 14:13:32 -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="KhRR3r7/"; 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 S1728277AbfAJWLX (ORCPT + 99 others); Thu, 10 Jan 2019 17:11:23 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:46018 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727788AbfAJWLW (ORCPT ); Thu, 10 Jan 2019 17:11:22 -0500 Received: by mail-lj1-f196.google.com with SMTP id s5-v6so11112800ljd.12 for ; Thu, 10 Jan 2019 14:11:20 -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=KdjYJOzVCfeCe7Ioc9Rew5+ItUP7VYboNciWI+K3Sds=; b=KhRR3r7/IU4vwsMRTlx7/FpGeUnljFFYP0hYBTUz4QVWaHAdSdKTw/lQbXmof0EGEj TayS4DnDVo3jFmlWfOFpykaa1rI/WTHvLiz+ec/+b21DRII6dRWVi+Wj2++9GTh/s+vI Iz+7cNVt44OrPCRyvjoBHNcVhXM38UQJuQ0cw= 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=KdjYJOzVCfeCe7Ioc9Rew5+ItUP7VYboNciWI+K3Sds=; b=X6J7b20rWG4eOuzWV3n2HwM2xYQ5bO39gIL95cEGnEtPanJPUlUbIQYnAmLl1n3foU mWDU4wQbQS4WBkLRlz+rsQsXgbsfIeJFkG/fxcXlFBme+ZHY4yBDs2pXNGE19BXOsbmh 90ZKetGPY0tFtTVGP3X6hsoBlU4Ec7nk9nY8NYmzlxzwWQ43NgoSWyDz2p93Yrm4EFYJ UDKyO0gSfrlZjkvtLBo7QtXrPh3iI7NptiUv3UE3BVIFT3sIoY4luDcZzPJxPhS6JOVR 54O5c1zICuK3ybQyfNAbqqHg7TfU/hwtp6AopYoV3wx1hk+83vyx/MawjllbCpE2rMvm ReHw== X-Gm-Message-State: AJcUuketkwBkGeUdVlGr+c8BXgBfosvIgPvWPPiWSmBmhqMl0a4VJ93L CyXSGncChK8pobB/G4roSMx2OKriHYA= X-Received: by 2002:a2e:6109:: with SMTP id v9-v6mr6830311ljb.126.1547158279350; Thu, 10 Jan 2019 14:11:19 -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 e14-v6sm15544011ljl.43.2019.01.10.14.11.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Jan 2019 14:11:18 -0800 (PST) Received: by mail-lj1-f178.google.com with SMTP id g11-v6so11165537ljk.3 for ; Thu, 10 Jan 2019 14:11:17 -0800 (PST) X-Received: by 2002:a2e:2c02:: with SMTP id s2-v6mr7100855ljs.118.1547158277491; Thu, 10 Jan 2019 14:11:17 -0800 (PST) MIME-Version: 1.0 References: <20190108044336.GB27534@dastard> <20190109022430.GE27534@dastard> <20190109043906.GF27534@dastard> <20190110004424.GH27534@dastard> <20190110070355.GJ27534@dastard> <20190110122442.GA21216@nautica> In-Reply-To: <20190110122442.GA21216@nautica> From: Linus Torvalds Date: Thu, 10 Jan 2019 14:11:01 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] mm/mincore: allow for making sys_mincore() privileged To: Dominique Martinet Cc: 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 Thu, Jan 10, 2019 at 4:25 AM Dominique Martinet wrote: > > Linus Torvalds wrote on Thu, Jan 10, 2019: > > (Except, of course, if somebody actually notices outside of tests. > > Which may well happen and just force us to revert that commit. But > > that's a separate issue entirely). > > Both Dave and I pointed at a couple of utilities that break with > this. nocache can arguably work with the new behaviour but will behave > differently; vmtouch on the other hand is no longer able to display > what's in cache or not - people use that for example to "warm up" a > container in page cache based on how it appears after it had been > running for a while is a pretty valid usecase to me. So honestly, the main reason I'm loath to revert is that yes, we know of theoretical differences, but they seem to all be performance-related. It would be really good to hear numbers. Is the warm-up optimization something that changes things from 3ms to 3.5ms? Or does it change things from 3ms to half a second? Because Dave is absolutely correct that mincore() isn't really even all that interesting an information leak if you can do the same with RWF_NOWAIT. But the other side of that same coin is that if we're not able to block mincore() sanely, then there's no point at looking at RWF_NOWAIT either. And we *can* do sane things about RWF_NOWAIT. For example, we could start async IO on RWF_NOWAIT, and suddenly it would go from "probe the page cache" to "probe and fill", and be much harder to use as an attack vector.. Do we want to do that? Maybe, maybe not. But if mincore() can't be fixed, there's no point in even trying. Now, if the mincore() change results in a big performance hit for people who use it as a heuristic for filling caches etc, then reverting the trial balloon is obviously something we must do, but at that point I'd also like to know which load it was that cared so much, and just what it did. Because we did have an alternate patch that just said "was the file writably opened, then we can do the page cache probing". But at least one user (fincore) didn't do even that. So right now, I consider the mincore change to be a "try to probe the state of mincore users", and we haven't really gotten a lot of information back yet. Linus