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:
 <LV3P220MB18150CCCE6ADB3973208C245BAD22@LV3P220MB1815.NAMP220.PROD.OUTLOOK.COM>
Date: Thu, 13 Mar 2025 22:35:35 -0400
From: Marty Kareem <MartyKareem@...look.com>
To: linux-mm@...ck.org
Cc: linux-kernel@...r.kernel.org, peterx@...hat.com,
 akpm@...ux-foundation.org, shuah@...nel.org
Subject: [PATCH RESEND] mm/selftest: Replace static BASE_PMD_ADDR with dynamic
 address allocation

(RESEND: previous email accidentally sent in HTML format, resending in 
plain text)

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>

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