From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) (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 9B1B03385A1 for ; Tue, 25 Aug 2026 16:17:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787674662; cv=none; b=eLvZb7yRrVvjswzmy1tywCpc4Poqpj0Sht5mnMfXqMXKqFQs4KSOfTGGxUHpbM5lC0E7gOStH5IayseH0U3yNoxeksD12NyFJlXm2MD5R54u4Ot2nBSFxUvQs1XbiFeijS4iIxScDubXCBikCV+79YlC3R0U1J9TKMnmLH7VnOg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787674662; c=relaxed/simple; bh=9OPqxgBu15Idq5/Ok/0spEv15fcFq2gn1247wFrxgNY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=LmL95/moj2wUrXdE0KIyzNJRLRLfdBxLbrGpDGwCB+RKatPtcTahum2Q/HTG9ydpOrar1vscNOjk/6xFVibJ5cIiqYD5dPIMQxDYW2F625Fm0wuQcbQxFUFNcM7q7Ljcnw8Nq/COsZiwfbM0br+mu3x5t7sFEVh41zqhFhLBfIQ= 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=SYPOFoWS; arc=none smtp.client-ip=209.85.216.54 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="SYPOFoWS" Received: by mail-pj1-f54.google.com with SMTP id 98e67ed59e1d1-39266382df6so22773a91.3 for ; Tue, 25 Aug 2026 09:17:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787674660; x=1788279460; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=pnKpvcq+eFIIrOJcljhlMUuTfIvczUf3J7EXGDw1e2A=; b=SYPOFoWSq0xM4Y7Jc2CxtO5IjZ9IEuUYcblZBbPGdrXSCIQibQVBGuN9d3UXm/Awxd +Fnf0Hi1N8uXqbNOJs7iqYrInVm0l5wEvqLn5GFdlIs7SrmCQ0CnzdHvG+F+0Op3izfF ou61FX/dA0lQOpY5MrtrOS+r2NTWy8Nx5WOjwr1lZDFf85b24M64uI61a24kOP1mfRQB yMPmN1DQS4EWEtPQfo4T5YQLkYnrfWK5o78YYTevyymVn4nsxlczta4eWqqYpQRXvCc/ WmEEG5VX54NSiUEjZw27PQGSSccpKuayVKZrTVQEI9z2gJOLe9saBqJ6YfXujlTF6y8U ZcQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787674660; x=1788279460; h=content-transfer-encoding:mime-version: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=pnKpvcq+eFIIrOJcljhlMUuTfIvczUf3J7EXGDw1e2A=; b=Pj8kQJ3vaPoah6GeOKQHjsz1my5ygOA7H4dEYQfnUGhfPpOqLV8b5mnn4CusmDJ4PN gDb5NgVFKXL0TeGMCv0fRpXwLfSUyV7jZGIFd3ll7pZcrIa5RLxBOMBkAo7g4oEN888b Vbbjq5ILYbb0xs3YqhzMzj8RjdzgoGjbRAJL8qkLTPXk5fHsIlgGwEWF2bYCvsnjAj6t NDkp/4BGgvUarmSHvWY0FEOfZWO0NEStgq/yhju3S4C/F+97Ks3dy4eVdkBdQ8eFDPM6 SZ85QR1dqcqir9EzO3KjLyAc5WoyUG7Y0+lHrGlyd3CtarvBn/JZ+jO9+CUNaTLJfqWq 7ogA== X-Forwarded-Encrypted: i=1; AHgh+Rq7IhxE2022AiYX9jkxOYTtFpP3goeRzj0cr2KQSgLRb8EHI0PNPhHTYtToIBrdId3yE+qBc4lopLxt2iE=@vger.kernel.org X-Gm-Message-State: AFuF++niZSslUoapyOE8x8J5kDBNCyNAfMfzipSA6X/p2FNlVYWBs2+c B2uAkkyNBEx1VOTiQSMz1BZRBm1AFnlp1i9zWDIykPDl/r5P5E84boQC X-Gm-Gg: AR+sD10vbLAP391VvFozp3hT8s9q4v/zPDehUcs4TKgxBhJISq0NjG5ux5Z9oPpM8Q7 N27UH3kuDv8x5Bl6+mO4k8443xXrQxmq082StKarOQrxA8J+0/lvzZ6Gd12vsG9Dc7k/POkSZrA rR4HT6qhzd8THTFbDUrxNWX5aC6cZ8tduT+D/NKaHdIpHsk7frSmCB0Ti8GtAVrW6J+LnvcqKuw 0nQ2KlckgxgINGqFq1O+2+qxTAoPkLY7N/gzMu6WCv5jCGfqkrr4B8Pfqpq6JBDue0FdQJSZEku QNXptfwb7QOiWW07PU7KHQYve/BGgLCdyCQQ5eF+nXzGmXAPeS/hg6g5zoDYRBdNKvVotvtDTcP NvDz5WYwf8PHrHnIwCMljdOz6YrrZ22iET7Rcz86VzvhSdKrJKsVldDRMaNzAYJKllfuwNe0MW9 zsvjKUEyOcoAEL7uS1uuCK0pkipVsQMzgAspQh0F3nwuWTQ2/DogFtRbgkwNwXoKkfz1+SuDSXo Kn5TEr0nA4= X-Received: by 2002:a17:90b:5291:b0:38e:e9b:ffa4 with SMTP id 98e67ed59e1d1-3966d45a53dmr525079a91.6.1787674659810; Tue, 25 Aug 2026 09:17:39 -0700 (PDT) Received: from volcano9f8e-host.amd.com ([165.204.217.251]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3282afb407bsm8786745eec.30.2026.08.25.09.17.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Aug 2026 09:17:39 -0700 (PDT) From: Hemanth Selam To: akpm@linux-foundation.org, david@kernel.org, shuah@kernel.org Cc: ljs@kernel.org, yury.khrustalev@arm.com, kevin.brodsky@arm.com, liam@infradead.org, vbabka@kernel.org, rppt@kernel.org, surenb@google.com, mhocko@suse.com, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3] selftests/mm: remove the local PKEY_UNRESTRICTED fallback Date: Tue, 25 Aug 2026 21:47:15 +0530 Message-ID: <20260825161715.2807297-1-hemanth.selam@gmail.com> X-Mailer: git-send-email 2.43.7 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. Assisted-by: Cursor:claude-opus-5 Signed-off-by: Hemanth Selam Acked-by: David Hildenbrand (Arm) Acked-by: Lorenzo Stoakes (ARM) --- Changes in v3: - Add the Assisted-by tag Lorenzo asked for; an AI assistant was used while tracing the include path and preparing the patch. The builds and the cpp output quoted below were run and checked by me. - Pick up the acks from David and Lorenzo. - Sent as a new mail rather than in reply to v2, as both asked. 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 (-isystem puts it ahead of the system one) -> -> PKEY_UNRESTRICTED 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