Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2374786rdb; Mon, 5 Feb 2024 04:54:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IFLKzaOMGBZlA0qgHt4KjiyxkR0EDu+Ovmwv5WHyV31ybKETl9mhkF0bNW0w3PZZMSELlbE X-Received: by 2002:a05:6358:5e0d:b0:178:7554:df34 with SMTP id q13-20020a0563585e0d00b001787554df34mr5821299rwn.18.1707137667512; Mon, 05 Feb 2024 04:54:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707137667; cv=pass; d=google.com; s=arc-20160816; b=UMst/Gie0dRhh8cCajbK/y9Q/kf1hHlG1M6um4YefCj0emJvHnthlIBZ8MDf396dpp 27o6iVlH1aTe/7i0RZ/Hv0OJr1amayv2716QgemUq4fnqGOyULM/7xSz3H8cbKqUGAR+ Uuw4enBbxkEL1d8KC14g4SB6Z73vSm8PzI18crD9s5yshwro2407gEHLBuXUIuIkqrb2 OWEXIKIL6lEqtvKNaWtgQLvDsLQqpi+e4xjAELSbhvkuLW0nXCyOhuDF9J0vWW7OPMwk IGvYd5xVdpmfBa9qMoa8MkBiKtBkaPeJ6GODma/sHxDMXBmuwGKvNY3VDsCdybyKJzil V9Rw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=jp4Q5U+zIlzWB/BXVKcZBw8dz1qw2kebfH71OdMWBLA=; fh=SsF1k5QuJQpMM/HuG47s0UZog2caall0jVLCJXZxT5Q=; b=oGPfNBrOIAzq/FF/DsTJNnU4owEiB2VIUY0KDi15pVYJmW/GHdhfj+3yqWUmtSOKZ7 pK5eMcjfY4Hnp35oXWhQoZeI2CctnFti6cStK8A9Pg2bovURUWUv1SVgVcN3Znpc7EJX MCMpbsopf3YRHEuHfjSQ2LlUXcRiQzhUiB143V4ihXKHWQNItXx1c8mZuAWFHBv6Lx6F 2rlKLvujN6Mp9KpgsgJI4K8+pvMN1lSNpq/2Tko9mW6b/VZoEo1QMKga/SxhKWbyvKM1 RP5xHL77BMlVGUuJRcOOAGYYNcIg4zWJL6sRtfTOZK55yuTruF6wPrvsCXCz+MTmVlwI mnAw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="mfp/C/w0"; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-52655-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52655-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org X-Forwarded-Encrypted: i=1; AJvYcCWmIrHd3pl1SdC+XjpMqzqo93RY7spGX+30/HxmMF4WaTd801wh110/503djL66xcOK7jmFpb/GR32lRUALXzzXrT+fzRQB/r50HMAPxw== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id n128-20020a634086000000b005d553239b1asi5792794pga.535.2024.02.05.04.54.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 04:54:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-52655-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="mfp/C/w0"; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-52655-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52655-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2AA95281C72 for ; Mon, 5 Feb 2024 12:54:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 85EC32D04C; Mon, 5 Feb 2024 12:48:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="mfp/C/w0" Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2CB132DF87 for ; Mon, 5 Feb 2024 12:48:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707137291; cv=none; b=PFro7oINAlHUb7burJI52E787fdjIbcIEU+wFC5xd6DpEnG1YJ5TuHEE6a1ygh1bdJarqwyEXmxWq3EpHIMY38HwZLOm2qJVsAZP64uJ6h/kkrhgKMiTZUzy7SifdXWIa6AChTx/VauSubvBr16AYuAJ8Col6MqhYM2eeLHoBEk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707137291; c=relaxed/simple; bh=hMQsxleb2DgLiOtL+XcLnQPzsO2TotOD/Pmi3+oKloU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=k6sv0bpm3/uqeLSC882oaL6adC36Rnbv/hB2y/AFkoJ5hTt7urGgWAaphMvPaiYBikrkXAd/GbXdjBLaCHF8ncvMJQ/NlrcpojXxRx3mTFLOT7wpGbg5nlMUdIlX9oiwAQqvWKD1QSNzsS+t9YaeNayJoqgjpFZiHy7zU4vssbg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=mfp/C/w0; arc=none smtp.client-ip=209.85.214.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1d7881b1843so38087955ad.3 for ; Mon, 05 Feb 2024 04:48:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707137289; x=1707742089; 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=jp4Q5U+zIlzWB/BXVKcZBw8dz1qw2kebfH71OdMWBLA=; b=mfp/C/w0RUq0WdHImmd1e5PIByl8SjgLcocSUhdGKfJiLLA+Ej7uC5hh/b3uRhczvu HrZQmgZu+7H6Rb3L3SiEI8GKfAM1wIU6MTYMj2kfvrhxWvDOsH+bLufs2C1T4ajflRdl 6vmu4EWt5mfJdSJChg1xgzRCt4aedwf9PI3cw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707137289; x=1707742089; 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=jp4Q5U+zIlzWB/BXVKcZBw8dz1qw2kebfH71OdMWBLA=; b=tp1JRhnb9ZlATGp+mTpOC1aMZwBhG+Mna82BCsJ1ei6MHJzPXXwLQWwfwFm0vkVXx2 BVSd4UMSMkiHCtAQxaOYH7clwNrGeGxbu5LYKvCuDnH1AO1niQWoeKoxfe2vPspZdQ84 TYLkGn1FD4aC+u0jtH7Xx5vrXh4zANMYsIvFqHOidWEe/yU3Y4rXs+vgyiQmIRriqCzo wJYU4vY73G2Xm+4ix+m0N84VrQ//Tj5VEMs4jooEDG3uRrZrAiBQiR2x8mXAsGnCDmfm Fy4R4pDtqIbfmK7NpYlFS9xoOdtwlCznIoerL48+bz2QT1p7+j998R9G1Odu0ISR7kJ/ WvNw== X-Gm-Message-State: AOJu0Yyb8OUhFyGNqN4UR6V5/VHn4Z/M8kw8pPDTSthOCEazUPSUbilE vEs0l/ILjclfS2srzO6SMg01S3qQoJFeDWcCyOJwbPjt/9B/SRqVK8A5t78OtA== X-Received: by 2002:a17:902:650c:b0:1d7:5943:21b8 with SMTP id b12-20020a170902650c00b001d7594321b8mr10194131plk.16.1707137289454; Mon, 05 Feb 2024 04:48:09 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCUtCqunCXxFNFT2rH8Qo2NHg52HZy+4Sa2MQq2EyuiWJcNqHwBIykWLL0u4UqEOMaCvzCtpjJoWSPJUbo7DhzhZ89KO+u16Y1JBm7o5562Gp5pgdhGCm8ufKd7vcjieySULkIG/nzq0GkLQsstXEXl735jvLqddCGKwuHrNHkKp5ZiLBWIes7Vokht2n+r5MJeiPbiSiASXCuBhAAgdrAVebtCTsIVjqdKCwkMRQMYSwJsF6A0+Iz1F5wUcBFMa1Nqw08Pqw1euJtfaGsVLoDWOyTvqaNfiTKMjqmL/vrlUN5In9PeXNXXyH69zZaeBBLX2H/QFEFDCWpg/TUy18gJVkR0z9HhIcZhfZ7GxZndTXSPRoqSjSaq21UcPhGN2Z3TPQSo= Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id kh3-20020a170903064300b001d8f99e4737sm6318404plb.49.2024.02.05.04.48.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 04:48:08 -0800 (PST) Date: Mon, 5 Feb 2024 04:48:08 -0800 From: Kees Cook To: Alexey Dobriyan Cc: Andrew Morton , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Florian Weimer , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, x86@kernel.org, Eric Biederman , linux-mm@kvack.org Subject: Re: [PATCH v4] ELF: AT_PAGE_SHIFT_MASK -- supply userspace with available page shifts Message-ID: <202402050445.0331B94A73@keescook> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Feb 05, 2024 at 12:51:43PM +0300, Alexey Dobriyan wrote: > +#define ARCH_AT_PAGE_SHIFT_MASK \ > + do { \ > + u32 val = 1 << 12; \ > + if (boot_cpu_has(X86_FEATURE_PSE)) { \ > + val |= 1 << 21; \ > + } \ > + if (boot_cpu_has(X86_FEATURE_GBPAGES)) { \ > + val |= 1 << 30; \ > + } \ Can we use something besides literal "12", "21", and "30" values here? -Kees -- Kees Cook