[Bug 284400] devel/valgrind: mmap() with MAP_ALIGNED() doesn't align

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 27 Jan 2025 19:28:45 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=284400

            Bug ID: 284400
           Summary: devel/valgrind: mmap() with MAP_ALIGNED() doesn't
                    align
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs@FreeBSD.org
          Reporter: shurd@FreeBSD.org
                CC: pjfloyd@wanadoo.fr
                CC: pjfloyd@wanadoo.fr
             Flags: maintainer-feedback?(pjfloyd@wanadoo.fr)
 Attachment #257045 text/plain
         mime type:

Created attachment 257045
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=257045&action=edit
Simple program to test alignment of mmap() result

File bug upstream as well.
https://bugs.kde.org/show_bug.cgi?id=499212

SUMMARY
When running under valgriund, the pointer returned by mmap(NULL, 1<<20,
PROT_WRITE | PROT_READ, MAP_PRIVATE | MAP_NOSYNC | MAP_ALIGNED(20), -1 ,0) is
not correctly aligned.

STEPS TO REPRODUCE
1. Call mmap() with MAP_ALIGNED(20) flag on FreeBSD

OBSERVED RESULT
Pointer is one page past alignment

EXPECTED RESULT
Pointer is aligned as requested

SOFTWARE/OS VERSIONS
FreeBSD: 14.2-RELEASE

ADDITIONAL INFORMATION
Test case attached.

-- 
You are receiving this mail because:
You are the assignee for the bug.