Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2857385rdb; Sat, 9 Dec 2023 01:46:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IHMabkAUQOT4WBypH3nkd/+g2cVry2hAl1n6sc4Xt3iDprYSLbjCR2rRbLJDJOAU8WeIGmq X-Received: by 2002:a05:6870:c14f:b0:1fb:75b:2fbc with SMTP id g15-20020a056870c14f00b001fb075b2fbcmr1985464oad.83.1702115187560; Sat, 09 Dec 2023 01:46:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702115187; cv=none; d=google.com; s=arc-20160816; b=ZOb0gaRJII1NGGXNtKd0K3bd1OpMbcl/BjWlhHjzgU3ou6hP8kADKPAPNUsT87XzNR vtgAdyOWHZXQ50vF5dXlskWEvQ1u9gEizS4xcMNM5sImiJQhqNdo2OE8JRZgKkWv1ZO8 fnc1/P9wWFak1Ro08N4IOiFHo4LgoJ+BZLcQUCvWrE1n7d64XWqtIHKYWC8uYUlt2VYp pufCljRxFbJd6L01nLsUWaNsmQaCnoujkAHcYsXObRkjdt0Y1H6tG0fHTcHqcNcrzLGJ Y8OpN8d3TfcSzdVrAnsLNZ7txZ/CifZ/tR8pD1P990rJG/gDDsq1oxB9N31gvPVERK/D C3aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=L11kNgG7F7jZItjchNT9t/Go/mxOmM6TSGE5IwyttvY=; fh=Ckv9/PdOFaG/HNTvAN3SU0CoKNIF5EOUjFi94JLLtN4=; b=UfVgp9n2O22J8PUeyoNzWtJRkoTPIZzdykL8QKx8zDhpna8xfapxF0En2+vKwipOp+ mVsBAWEGk0XJdsnODhSSNFkfVmmg8N9SlIhpNRJdkrWGMUhKBczC9yUXkISSwkUYTZOg deThRK1tnbjH8Ai545K8UlWB18d5lmPId2q2aCAKOcnCHN97gbIplEqPTjBx5wI/J0Fw qDVT0JBiltRuQF5NyztmNt185OOwjThgH56NwUM5n/b2O4EFndZqWXKQnXwo9G4xLsH1 uw1cqG3WhTC1StTizjooA96/raJnupHFqLlcKgjOdXOYXbEsklpcRpnq2LwVVTeuJYyP DWyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ROQw2ngJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id j21-20020a635955000000b005c668a5a90dsi2756411pgm.290.2023.12.09.01.46.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Dec 2023 01:46:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ROQw2ngJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 129008080D7F; Sat, 9 Dec 2023 01:45:32 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229563AbjLIJow (ORCPT + 99 others); Sat, 9 Dec 2023 04:44:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbjLIJov (ORCPT ); Sat, 9 Dec 2023 04:44:51 -0500 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDB5910C9; Sat, 9 Dec 2023 01:44:57 -0800 (PST) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-40c256ffdbcso30547565e9.2; Sat, 09 Dec 2023 01:44:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702115096; x=1702719896; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=L11kNgG7F7jZItjchNT9t/Go/mxOmM6TSGE5IwyttvY=; b=ROQw2ngJaKnunF7hSSO0l+XG6+NnPJ1Eo/+8qgHEbTEl4GJx4mPXtNinN2fQ+inDyd C++tnCbcuHxs06LuztoUT2RadmgtzlZT/1vsZh/kVObk1i0PjY532byz6si/FaSqACq4 AI8oM83ptQjIGL1RYpw9AwuNHtrHd03WfsYKQpua3OeEyEKIVL2erxbWkocStfZl+UB8 YfoDHDyZK9KH3cjQSsTaNg1HXtvY6nMr15LKyxQCVcuT5LbYG4xGxC7Sjg/z+ASMy39Z D7TF0h0JIKNqXm3Hl0hx9oB0g4a/Vm8EITvka6/F1+Dg9U3b3RLqftIhe+cP/fP5tC4T RS1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702115096; x=1702719896; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=L11kNgG7F7jZItjchNT9t/Go/mxOmM6TSGE5IwyttvY=; b=wy+TlioELPjBPIBjqSsXTZ0nN/bhFA35AoSMr65zMrsA09fL1fO3z9KnHxtM8veJCj A45CJ6tcqMMSsJIFcT7u6ywqZoXmrFjQE5SzJEG0GzddJ6D5SeJlAWw/f8IrXgE2CZx9 puiBXbBZUIyrr0Kl3rkdVtg+i1fOVRucLWCJAF/i7fhBlBpXAA93mOfo3yMJoH7AB6h8 1DpJ/7sYaQBmIOqkjkvhEg+mWl16kS3O5QqlFZmjmH3bImWO/AOx5ypDgnUv4nyNAtOh wT+Q9xDMb2cWiYd63slE6ZjL2rRsvt5lWtiZIdpJl9E4rq7MCdhvhxCHnCB0986PWbPe zyHQ== X-Gm-Message-State: AOJu0YzDdt9LAPBdpNbqQ+NQ/wpcOZomwxjFFBED9Gk6SnKE2rFjLLT8 mz6LhI13ha3a/LzyLJkjE03uDjHCcQ== X-Received: by 2002:a7b:cd12:0:b0:40b:5e59:c570 with SMTP id f18-20020a7bcd12000000b0040b5e59c570mr665346wmj.154.1702115096070; Sat, 09 Dec 2023 01:44:56 -0800 (PST) Received: from p183 ([46.53.250.155]) by smtp.gmail.com with ESMTPSA id tk3-20020a170907c28300b00a1cd54ec021sm2023235ejc.57.2023.12.09.01.44.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Dec 2023 01:44:55 -0800 (PST) Date: Sat, 9 Dec 2023 12:44:53 +0300 From: Alexey Dobriyan To: Kees Cook Cc: Andrew Morton , Florian Weimer , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH v2] ELF: supply userspace with available page shifts (AT_PAGE_SHIFT_MASK) Message-ID: References: <6b399b86-a478-48b0-92a1-25240a8ede54@p183> <87v89dvuxg.fsf@oldenburg.str.redhat.com> <1d679805-8a82-44a4-ba14-49d4f28ff597@p183> <202312061236.DE847C52AA@keescook> <4f5f29d4-9c50-453c-8ad3-03a92fed192e@p183> <202312081027.BA44B7B3@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <202312081027.BA44B7B3@keescook> X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Sat, 09 Dec 2023 01:45:32 -0800 (PST) On Fri, Dec 08, 2023 at 10:29:25AM -0800, Kees Cook wrote: > On Thu, Dec 07, 2023 at 05:57:05PM +0300, Alexey Dobriyan wrote: > > On Wed, Dec 06, 2023 at 12:47:27PM -0800, Kees Cook wrote: > > > Can't we have a generic ARCH_AT_PAGE_SHIFT_MASK too? Something like: > > > > > > #ifndef ARCH_AT_PAGE_SHIFT_MASK > > > #define ARCH_AT_PAGE_SHIFT_MASK > > > NEW_AUX_ENT(AT_PAGE_SHIFT_MASK, 1 << PAGE_SHIFT) > > > #endif > > > > > > Or am I misunderstanding something here? > > > > 1) Arch maintainers can opt into this new way to report information at > > their own pace. > > > > 2) AT_PAGE_SHIFT_MASK is about _all_ pagesizes supported by CPU. > > Reporting just one is missing the point. > > > > I'll clarify comment: mmap() support require many things including > > tests for hugetlbfs being mounted, this is about CPU support. > > I significantly prefer APIs not being arch-specific, It will become arch-independent once all relevant archs opt-in. I doubt anyone is writing new software for sparc or alpha. > so I'd prefer we > always include AT_PAGE_SHIFT_MASK. For an architecture that doesn't > define its own ARCH_AT_PAGE_SHIFT_MASK, it's not _inaccurate_ to report > 1 << PAGE_SHIFT, but it might be incomplete. It is inaccurate if ARCH_AT_PAGE_SHIFT_MASK is defined as "_all_ page shift CPU supports". Inaccurate version is called AT_PAGESZ which lists just 1 page size, there is no need for 2 inaccurate APIs.