Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3481764imj; Mon, 11 Feb 2019 22:37:12 -0800 (PST) X-Google-Smtp-Source: AHgI3IYF2aHXLE9qqwiw1urqhZvGAs7XiRSbHe+FYZHxEfwRLbhlwOJlPuJO1jBgd+hGz+89sjwO X-Received: by 2002:a17:902:f01:: with SMTP id 1mr2372868ply.143.1549953432091; Mon, 11 Feb 2019 22:37:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549953432; cv=none; d=google.com; s=arc-20160816; b=bFQCa7vG594rtVNXyBdLjVxx2i5bhBTR3l1QqewgR2NmiZvaIUg/v6rV19vKLsTtmz OuJemkIA2we+7b/JfwidVg/CtMY4lBaNJaO+wT1K4aULncq1Sej0kFITiGuwq4VvqQDQ K2IFH8OIWhyB/G0SBHohTOWt7GolVfoqsDuRXCtrYpQeXbeVJkDHnzt9oHZ2VpTwMzGU vHuqnwLyg/oxsylE49vQD+6HP8GS4rgeSz/jZOqQxaPworUfPfHSjq+MUcPwcqBxkJfq JUEYq10BXI7AtN9x09Hbqr7XNZLWUJvDyBMstTNN4b24AYoyVHIyHCirUCoxp89ajbZY tNaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=2luFFSDHFsJbDwl821dl7kMAmz12dh1A0o8rlWHEfHs=; b=yT1q0fbO3bRlZA0iBKaSLJ1yugyrjpkTFTi/VI4Xt7DKh7J3R1EAwx/vXGQCC4Vau2 DHE1ZUldY8STOEyuq+o90CAskbyuYHDcnI/2vPVlYX89xZkOXhc7ntwDRXakj74AfTgV lf1q0ow0kTTGe6anAJzVYWF2Vr9afn8SnXzQr1+QG1YDuQ9djhiEw+Ayi22mRwJGfrRJ nVdiS+74tdI0R6/0v/IW4fk7fTNj/FYQj+X4S7aAB1PbR+9ZQrZv81gUnWoGt09EBFHY fupfZWGILC0i6vJG5XO3svRaRK9TtNlTOGwIeoTbAhLY4EuXtOjFcUFxY5ax5uYURsVN g8Jg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m188si12904969pfb.266.2019.02.11.22.36.55; Mon, 11 Feb 2019 22:37:12 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726269AbfBLGgu (ORCPT + 99 others); Tue, 12 Feb 2019 01:36:50 -0500 Received: from mx2.suse.de ([195.135.220.15]:57950 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725930AbfBLGgu (ORCPT ); Tue, 12 Feb 2019 01:36:50 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 5F9C3AC4C; Tue, 12 Feb 2019 06:36:47 +0000 (UTC) Date: Tue, 12 Feb 2019 07:36:43 +0100 From: Michal Hocko To: Jiri Kosina Cc: Vlastimil Babka , Andrew Morton , Linus Torvalds , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-api@vger.kernel.org, Peter Zijlstra , Greg KH , Jann Horn , Dominique Martinet , Andy Lutomirski , Dave Chinner , Kevin Easton , Matthew Wilcox , Cyril Hrubis , Tejun Heo , "Kirill A . Shutemov" , Daniel Gruss , Josh Snyder Subject: Re: [PATCH 3/3] mm/mincore: provide mapped status when cached status is not allowed Message-ID: <20190212063643.GL15609@dhcp22.suse.cz> References: <20190130124420.1834-1-vbabka@suse.cz> <20190130124420.1834-4-vbabka@suse.cz> <20190131100907.GS18811@dhcp22.suse.cz> <99ee4d3e-aeb2-0104-22be-b028938e7f88@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 12-02-19 04:44:30, Jiri Kosina wrote: > On Fri, 1 Feb 2019, Vlastimil Babka wrote: > > > >> After "mm/mincore: make mincore() more conservative" we sometimes restrict the > > >> information about page cache residency, which we have to do without breaking > > >> existing userspace, if possible. We thus fake the resulting values as 1, which > > >> should be safer than faking them as 0, as there might theoretically exist code > > >> that would try to fault in the page(s) until mincore() returns 1. > > >> > > >> Faking 1 however means that such code would not fault in a page even if it was > > >> not in page cache, with unwanted performance implications. We can improve the > > >> situation by revisting the approach of 574823bfab82 ("Change mincore() to count > > >> "mapped" pages rather than "cached" pages") but only applying it to cases where > > >> page cache residency check is restricted. Thus mincore() will return 0 for an > > >> unmapped page (which may or may not be resident in a pagecache), and 1 after > > >> the process faults it in. > > >> > > >> One potential downside is that mincore() will be again able to recognize when a > > >> previously mapped page was reclaimed. While that might be useful for some > > >> attack scenarios, it's not as crucial as recognizing that somebody else faulted > > >> the page in, and there are also other ways to recognize reclaimed pages anyway. > > > > > > Is this really worth it? Do we know about any specific usecase that > > > would benefit from this change? TBH I would rather wait for the report > > > than add a hard to evaluate side channel. > > > > Well it's not that complicated IMHO. Linus said it's worth trying, so > > let's see how he likes the result. The side channel exists anyway as > > long as process can e.g. check if its rss shrinked, and I doubt we are > > going to remove that possibility. > > So, where do we go from here? > > Either Linus and Andrew like the mincore() return value tweak, or this > could be further discussed (*). But in either of the cases, I think > patches 1 and 2 should be at least queued for 5.1. I would go with patch 1 for 5.1. Patches 2 still sounds controversial or incomplete to me. And patch 3, well I will leave the decision to Andrew/Linus. > (*) I'd personally include it as well, as I don't see how it would break > anything, it's pretty straightforward, and brings back some sanity to > mincore() return value. -- Michal Hocko SUSE Labs