From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) (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 1A74A3DC857 for ; Wed, 19 Aug 2026 07:47:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787125655; cv=none; b=uYbvEoOcfFQaMhsmmKMTLJqnC16wDFAr53xGAy1LPF1j3NncOEqZ/zWr3KfI/2eZym7crfAJS99lVnDaSu44uAU4macv+E4Vl4YTxSJuU1sqr3B55GMfbg/8+MC8YWCVg1sDZc6VM+qtdLxOnY0zX+mVJTccCnyAQdZ8G5DrIu0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787125655; c=relaxed/simple; bh=mH70SGDQEUYRC4bGuNd2bC5s+eoBqF4ZRPpvz/uTY0U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ABTlGfBHSXQxodIUnXJBMU+hzn3ULdIF82H2dRGohzwO30NYC0Pbm6T7bRFq2OEzyKFHyzsUE3ROb7InIYD13YqmS14K0h3Y2oZwV7xZ1iFkmJr0pNa0caWwi+42iOsf8GUkyI5IbH3wiccKbYaly+oDL7bapN4s87ijG2+lPlU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Vh1E658H; arc=none smtp.client-ip=209.85.216.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Vh1E658H" Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-384930ca5e2so1031273a91.3 for ; Wed, 19 Aug 2026 00:47:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787125653; x=1787730453; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=EM9mPI9yixDIV/dQKvKcahELWkdUTMep2I+eKhwYYKU=; b=Vh1E658HXj4fob5N6BlhS1othFvhOdnJKBC5vcdYOD4kSpYlFOxcfpIwmba3ipR0qP OAQvzucJkHFA1vjWeRGXLWwYZpQFsmOI+fg3p6MFQj0RITqRW4/BKieqZHrYy0JpUaqQ QmHCk/JBUx6C6uElZeDnPEGHaclsq9foSZoHbL3IqewC55l3ArW8sifgy2xbecWs0jTi waEqFW9MqNXWEI2Ew/AqOKS+mXyJh9dD5cwwy+lvgd7LovBSksIeG/61eKmgZeHx9b1z 5DqS07+ZL0xXNPeST5828ur+VEjKWOxYiAefx3lIOMswXhS/DXoRHvfkBN+BO1wo7tVH /4Ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787125653; x=1787730453; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=EM9mPI9yixDIV/dQKvKcahELWkdUTMep2I+eKhwYYKU=; b=doX5rRvJ2rwucLog7UAAHZmmhz1UR31s2DCDYKZu/27fsd9KaqSEQZO6ctYu5+uJfS 1FWrIhnXNXjs7R3cLUmk51s7fUsE4GDRS7KE+PCKr6KEoVdFVhPeP16OlmXALnNlWv4L lCpiACRQEvfOw6EtlOXGtWJor8bRn8+pKTwTexn1Gj3F7glOwrmJeF513vz1VKDKv1Xt nuAFs+kK4O/vD2hwOqkWUpzmjBcS27HsHIjrS4qDqvVckxNK2hMdEv6bFSpuHMC4ZdOY O4vmPLa5CaERvL84UkHwBFAyO7pFDJ/3QK/UXDLn5lGUHqUpa80j5or6lUaTTG+QgBCT Pp8A== X-Forwarded-Encrypted: i=1; AHgh+RoF0rvG+WPt2q1uXPzTyifx0f8yjv/xjc944WYmTWvB5dLJMHBoe8KY+DCUsE8dUVIXPgU98YD5JT/FAJM=@vger.kernel.org X-Gm-Message-State: AOJu0Yy5mSCRIduVYtIa2p+u5MOXkDLyD5mM+tZCdPOG5likt9B8pCpO /20+kpxRxX8xQzQHhNTcTMJKMRVw+q49D9dHHOwCq4ra1vY5UcnnV/iu X-Gm-Gg: AR+sD13xQ5TNuDbRaGUfqpHqoC7I6Sh38moDrxcTQls8CHT0i3UoV8DIA/RE7UbHrlz mMAa48JS/Y+jMefhxGLuYqBQCaojJivLsnIokq3sX6iA6Lt56hSsxR++uIcq9JgF3vVGpNg30V8 LYsExqyQFVHZ5H9Qh1Tgj8A6nc8Qv4ZPmV9lo6avf329bBXZJqz/57IdrfjNCeSN0UvN8pJ2zYh KLv4+MxV0KOygAcvrEAfGXL4vB/NK2AyVWAUvkyhKelpEJ8NSJTMJ1aSd54KurEhSGx+O6AOpFK ZmTO6iCSsn2W7k0y9/Kg8I+VlXeHr7YguwRd2mXvB647MjqUWnYi0lIEb96mZCzNOiorJR4I7fD 0iIPIATdE2FiZKGbEjDuhYlxlfvPII0Ad8XaI+dzX9jHqvEuF3HgJ5PGmMxrdhZXWYDNjpgKfH5 lbRceD043TpLlBDc5GD43bBxF7aOE59wJiIxqQcOOALgqIPjlsfwkruzMIPDPNJKWhM6N09/PK1 8EjDyoydcD1/xfJA9azQA== X-Received: by 2002:a17:90b:5250:b0:381:9028:5945 with SMTP id 98e67ed59e1d1-3958125375amr5603472a91.14.1787125653369; Wed, 19 Aug 2026 00:47:33 -0700 (PDT) Received: from volcano9f8e-host.amd.com ([165.204.217.251]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-1416ad3dd15sm3927299c88.2.2026.08.19.00.47.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Aug 2026 00:47:33 -0700 (PDT) From: Hemanth Selam To: Andrew Morton , David Hildenbrand , Shuah Khan Cc: Lorenzo Stoakes , Yury Khrustalev , Kevin Brodsky , "Liam R . Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Hemanth Selam Subject: [PATCH v2] selftests/mm: remove the local PKEY_UNRESTRICTED fallback Date: Wed, 19 Aug 2026 13:17:17 +0530 Message-ID: <20260819074717.1345749-1-hemanth.selam@gmail.com> X-Mailer: git-send-email 2.43.7 In-Reply-To: <20260818114945.1312987-1-hemanth.selam@gmail.com> References: <20260818114945.1312987-1-hemanth.selam@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit pkey-helpers.h defines PKEY_UNRESTRICTED itself when the macro is not already known, a stopgap from when the generic definition was still under review. It has been merged since, commit 6d61527d931b ("mm/pkey: Add PKEY_UNRESTRICTED macro"), so the guard is never taken and the FIXME can be honoured. The definition comes from tools/include/uapi/asm-generic/mman-common.h via TOOLS_INCLUDES, which commit e076eaca5906 ("selftests: break the dependency upon local header files") added so that the mm selftests build without "make headers". It is reached through the that the system includes. Building the pkey tests with KHDR_INCLUDES pointing at an empty directory confirms that; emptying TOOLS_INCLUDES as well is what makes the macro go missing. No functional change intended. Signed-off-by: Hemanth Selam --- Changes in v2: - Drop the incorrect claim that the mm selftests are built against the headers of the kernel source and would fail without "make headers". They are not, as Lorenzo pointed out; describe where the definition really comes from instead. - Leave tools/testing/selftests/powerpc/include/pkeys.h alone, as discussed with David on v1. Unlike the mm one it is an unconditional #undef/#define next to other powerpc specific overrides, and that header only includes , which does not provide PKEY_UNRESTRICTED with or without TOOLS_INCLUDES, so its definition is load bearing. The full include path, for reference: pkey-helpers.h -> tools/include/uapi/linux/mman.h -> /usr/include/asm/mman.h (tools/include/uapi/asm/mman.h does not exist) -> tools/include/uapi/asm-generic/mman.h -> -> PKEY_UNRESTRICTED With KHDR_INCLUDES pointing at an empty directory the tests still build, and cpp -dD reports the macro coming from tools/include/uapi/asm-generic/mman-common.h. Emptying TOOLS_INCLUDES as well gives: pkey-helpers.h:188:30: error: 'PKEY_UNRESTRICTED' undeclared pkey_sighandler_tests and mseal_test are byte identical before and after; protection_keys differs only in the __LINE__ values that pkey-helpers.h embeds into its debug output. v1: https://lore.kernel.org/all/20260818114945.1312987-1-hemanth.selam@gmail.com/ tools/testing/selftests/mm/pkey-helpers.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tools/testing/selftests/mm/pkey-helpers.h b/tools/testing/selftests/mm/pkey-helpers.h index 2c377f4e9df1..626c2e1655dc 100644 --- a/tools/testing/selftests/mm/pkey-helpers.h +++ b/tools/testing/selftests/mm/pkey-helpers.h @@ -112,13 +112,6 @@ void record_pkey_malloc(void *ptr, long size, int prot); #define PKEY_MASK (PKEY_DISABLE_ACCESS | PKEY_DISABLE_WRITE) #endif -/* - * FIXME: Remove once the generic PKEY_UNRESTRICTED definition is merged. - */ -#ifndef PKEY_UNRESTRICTED -#define PKEY_UNRESTRICTED 0x0 -#endif - #ifndef set_pkey_bits static inline u64 set_pkey_bits(u64 reg, int pkey, u64 flags) { -- 2.43.7