lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID:
 <LV3P220MB18157A28154B376ABA8BDFDDBAD22@LV3P220MB1815.NAMP220.PROD.OUTLOOK.COM>
Date: Fri, 14 Mar 2025 01:34:25 +0000
From: Marty Kareem <MartyKareem@...look.com>
To: "linux-mm@...ck.org" <linux-mm@...ck.org>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, Peter Xu
	<peterx@...hat.com>, Andrew Morton <akpm@...ux-foundation.org>,
	"shuah@...nel.org" <shuah@...nel.org>
Subject: [PATCH] mm/selftest: Replace static BASE_PMD_ADDR with dynamic
 address allocation

This patch addresses a longstanding TODO comment in the userfaultfd tests,
'/linux/tools/testing/selftests/mm/uffd-common.c'
("/* Use a static addr is ugly */") by replacing hardcoded 1GB addresses
with dynamic allocation. I'd appreciate your review.

The Problem
------------
The current static address approach:
- Causes test failures when other mappings occupy the 1GB region
- Prevents parallel test execution (critical for modern CI/CD systems)
- Breaks on systems with unusual memory layouts

The Solution
------------
I implemented a find_suitable_area() helper that:
- Asks the kernel for suggested addresses via mmap(NULL)
- Automatically aligns for huge pages when needed
- Uses MAP_FIXED_NOREPLACE where available (graceful fallback otherwise)
- Adds guard pages between mappings to prevent VMA merging

Validation
----------
I did multiple tests on my implementation to make sure it worked like:
- Multiple parallel test runs
- Memory pressure scenarios
- Edge cases (unusual alignments, sizes, etc.)
- Race conditions and concurrent access

Performance impact is minimal , about 1.2x overhead compared to the static
approach in benchmarks.

Why This Matters
----------------
- Removes longstanding TODO from the codebase
- Enables safe parallel testing
- Makes tests portable to different environments and memory layouts
- Improves overall test reliability

This is my first PR for the Linux Kernel and I would be
grateful for your feedback!

Signed-off-by: MrMartyK <martykareem@...look.com>


Content of type "text/html" skipped

View attachment "0001-mm-selftest-Replace-static-BASE_PMD_ADDR-with-dynami.patch" of type "text/x-patch" (6089 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ