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=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 2032DC433DB for ; Tue, 22 Dec 2020 13:45:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7C69A23103 for ; Tue, 22 Dec 2020 13:45:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7C69A23103 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id AB2C46B0088; Tue, 22 Dec 2020 08:45:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A62396B0089; Tue, 22 Dec 2020 08:45:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 928E36B0092; Tue, 22 Dec 2020 08:45:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0088.hostedemail.com [216.40.44.88]) by kanga.kvack.org (Postfix) with ESMTP id 7839B6B0088 for ; Tue, 22 Dec 2020 08:45:01 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 3279B180AD83A for ; Tue, 22 Dec 2020 13:45:01 +0000 (UTC) X-FDA: 77621039202.30.wheel02_420889d27460 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id 0B098180B3AA7 for ; Tue, 22 Dec 2020 13:45:01 +0000 (UTC) X-HE-Tag: wheel02_420889d27460 X-Filterd-Recvd-Size: 3983 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Tue, 22 Dec 2020 13:44:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=eXSyGreQyqo1MSmMoq/qMuV3OWCVLUj1olxIkYhTkl0=; b=Ix8mJC38mYvh+lNbE2zOg73S2V aW8+bJnapCtY5yvKkPflK2jIdDa2nZaR3ghWYIzq0sfRZ02qOCAZfEHG/mQxOfcyk+/5GLm05CZQ9 1//PIsYFfsPOM9YnsFc0MK/+cW401LKBSC2npcgsbbVx1H8rIZUUCGQvsW/j3gF48T2Ea/CWgFu1O I9Naeba9H0I76TnpqQ+UlimvfzMahfalNYx17Dgwpb1XFwQw7Ul9big6pvyPf8LViAJOc/g7sy+8P nJ0DkW1OpNbL/pl3rC86J8zT2uhv7RCpK+zUzX7Ig0Fjcsl47jE82uuldUA8ToZjHCcGMET5UW5we NmGAkx3g==; Received: from hch by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1krhxu-0002DJ-GS; Tue, 22 Dec 2020 13:44:38 +0000 Date: Tue, 22 Dec 2020 13:44:38 +0000 From: Christoph Hellwig To: Jann Horn Cc: Minchan Kim , Christoph Hellwig , Suren Baghdasaryan , Andrew Morton , Michal Hocko , Michal Hocko , David Rientjes , Matthew Wilcox , Johannes Weiner , Roman Gushchin , Rik van Riel , Christian Brauner , Oleg Nesterov , Tim Murray , Linux API , Linux-MM , kernel list , kernel-team Subject: Re: [PATCH 1/2] mm/madvise: allow process_madvise operations on entire memory range Message-ID: <20201222134438.GA7170@infradead.org> References: <20201124053943.1684874-1-surenb@google.com> <20201124053943.1684874-2-surenb@google.com> <20201125231322.GF1484898@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Dec 11, 2020 at 09:27:46PM +0100, Jann Horn wrote: > > Can we just use one element in iovec to indicate entire address rather > > than using up the reserved flags? > > > > struct iovec { > > .iov_base = NULL, > > .iov_len = (~(size_t)0), > > }; > > In addition to Suren's objections, I think it's also worth considering > how this looks in terms of compat API. If a compat process does > process_madvise() on another compat process, it would be specifying > the maximum 32-bit number, rather than the maximum 64-bit number, so > you'd need special code to catch that case, which would be ugly. > > And when a compat process uses this API on a non-compat process, it > semantically gets really weird: The actual address range covered would > be larger than the address range specified. > > And if we want different access checks for the two flavors in the > future, gating that different behavior on special values in the iovec > would feel too magical to me. > > And the length value SIZE_MAX doesn't really make sense anyway because > the length of the whole address space would be SIZE_MAX+1, which you > can't express. > > So I'm in favor of a new flag, and strongly against using SIZE_MAX as > a magic number here. Yes, using SIZE_MAX is a horrible interface in this case. I'm not a huge fan of a flag either. What is the use case for the madvise to all of a processes address space anyway?