Bug 418756 - MAP_FIXED_NOREPLACE mmap flag unsupported
Summary: MAP_FIXED_NOREPLACE mmap flag unsupported
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (other bugs)
Version First Reported In: 3.15 SVN
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Mark Wielaard
URL:
Keywords:
Depends on:
Blocks: 506971
  Show dependency treegraph
 
Reported: 2020-03-12 00:23 UTC by Stas Sergeev
Modified: 2025-07-15 22:04 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stas Sergeev 2020-03-12 00:23:37 UTC
SUMMARY
valgrind doesn't support MAP_FIXED_NOREPLACE mmap flag,
causing the programs that use it, to misbehave.
Comment 1 Mark Wielaard 2025-07-15 19:47:31 UTC
This is also why the LTP testcase mmap17 fails.
mmap17.c:59: TFAIL: mmap failed, with unexpected error code, expected EEXIST:EACCES (13)
Uses MAP_FIXED_NOREPLACE. Tries to check that mmap at an exisiting mapping fails with EEXIST, not EACCES.
Comment 2 Mark Wielaard 2025-07-15 22:04:29 UTC
commit cad20f3e7d42e6371896e2492f0fc3a081314238
Author: Mark Wielaard <mark@klomp.org>
Date:   Tue Jul 15 23:49:36 2025 +0200

    Support mmap MAP_FIXED_NOREPLACE if defined
    
    Define VKI_MAP_FIXED_NOREPLACE for amd64-linux, arm-linux,
    arm64-linux, mips32-linux, mips64-linux, riscv64-linux and x86-linux.
    
    If it is defined then ML_(generic_PRE_sys_mmap) will also interpret
    VKI_MAP_FIXED_NOREPLACE as an MFixed hint. If the aspace manager
    doesn't find a MAP_FIXED_NOREPLACE ok, then fail with EEXIST. If the
    actual kernel mmap request fails and MAP_FIXED_NOREPLACE is set also
    immediately fail with EEXIST without retrying.
    
    This fixes the LTP mmap17 testcase.
    
    https://bugs.kde.org/show_bug.cgi?id=418756