Skip to contentSkip to conversation

vdso/datastore: Zero out newly allocated datastore pages

PATCH In review Thomas Weißschuh 2 participants 3 messages Apr 9 Generic VDSO library

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vdso/datastore: Zero out newly allocated datastore pages

The data pages need to be zeroed initially, as garbage data can break the vDSO userspace logic.

Fixes 05988dba1179 ("vdso/datastore: Allocate data pages dynamically")

---
I messed up and dropped __GFP_ZERO again when switching from folio_alloc() to alloc_pages() in v6 of "sparc64: vdso: Switch to the generic vDSO library" Previously the missing __GFP_ZERO triggered boot-failures in -next, but apparently with alloc_pages() we got "lucky" so far.

This could also be merged into the originally broken commit.

---
 lib/vdso/datastore.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/vdso/datastore.c +1 -1
index cf5d784a4a5a..55f1654624e0 100644
@@ -42,7 +42,7 @@ void __init vdso_setup_data_pages(void)
 	 * Do not use folios. In time namespaces the pages are mapped in a different order
 	 * to userspace, which is not handled by the folio optimizations in finish_fault().
 	 */
-	pages = alloc_pages(GFP_KERNEL, order);
+	pages = alloc_pages(GFP_KERNEL | __GFP_ZERO, order);
 	if (!pages)
 		panic("Unable to allocate VDSO storage pages");
 

---
base-commit: 7138a8698a39e81eb153e05500823fff76d5b3bd
change-id: 20260409-vdso-datastore-zero-87f0d2d482d6

Best regards,

Signature · 1 line
Thomas Weißschuh <[email protected]>
#1 lore raw

Hi,

please disregard this patch...

Quoted 11 lines · Thomas Weißschuh

The data pages need to be zeroed initially, as garbage data can break the vDSO userspace logic.

Fixes 05988dba1179 ("vdso/datastore: Allocate data pages dynamically")

---
I messed up and dropped __GFP_ZERO again when switching from folio_alloc() to alloc_pages() in v6 of "sparc64: vdso: Switch to the generic vDSO library" Previously the missing __GFP_ZERO triggered boot-failures in -next, but apparently with alloc_pages() we got "lucky" so far.

... I panicked a bit after looking at the code again and not seeing the explicit zeroing. The actually works fine, as the memcpy() from the static vdso_initdata will do the zeroing.

Sorry for the noise.

Thomas

maintainer
#2 lore raw
Quoted 12 lines · Thomas Weißschuh
Quoted 11 lines

The data pages need to be zeroed initially, as garbage data can break the vDSO userspace logic.

Fixes 05988dba1179 ("vdso/datastore: Allocate data pages dynamically")

---
I messed up and dropped __GFP_ZERO again when switching from folio_alloc() to alloc_pages() in v6 of "sparc64: vdso: Switch to the generic vDSO library" Previously the missing __GFP_ZERO triggered boot-failures in -next, but apparently with alloc_pages() we got "lucky" so far.

Quoted 5 lines

... I panicked a bit after looking at the code again and not seeing the explicit zeroing. The actually works fine, as the memcpy() from the static vdso_initdata will do the zeroing.

Sorry for the noise.

Happens to all of us. Better safe than sorry six weeks down the road.