Thread (6 messages) flat view 6 messages, 2 authors, 2024-02-13

Re: [PATCH v4] ELF: AT_PAGE_SHIFT_MASK -- supply userspace with available page shifts

From: Kees Cook <hidden>
Date: 2024-02-10 00:41:38
Also in: linux-arch, linux-mm, lkml

On Fri, Feb 09, 2024 at 03:30:37PM +0300, Alexey Dobriyan wrote:
On Mon, Feb 05, 2024 at 04:48:08AM -0800, Kees Cook wrote:
quoted
On Mon, Feb 05, 2024 at 12:51:43PM +0300, Alexey Dobriyan wrote:
quoted
+#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?
Ehh, no, why? Inside x86_64 the page shifts are very specific numbers,
they won't change.
Well, it's nicer to have meaningful words to describe these things. In
fact, PAGE_SHIFT already exists for 12, and HPAGE_SHIFT already exists
for 21. Please use those, and add another, perhaps GBPAGE_SHIFT, for 30.

-Kees

-- 
Kees Cook
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help