[Bug 246215] [rtld] fails for i386 on amd64 if auxv does not contain PAGESIZES

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue May 5 06:55:48 UTC 2020


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=246215

            Bug ID: 246215
           Summary: [rtld] fails for i386 on amd64 if auxv does not
                    contain PAGESIZES
           Product: Base System
           Version: 12.1-RELEASE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs at FreeBSD.org
          Reporter: paulf at free.fr

I came across this issue whilst working on getting Valgrind to work.

When Valgrind runs, the guest application is loaded by Valgrind rather than the
usual FreeBSD mechanisms. Thus Valgrind will synthesize an auxv, mmap rtld and
run the rtld text in Valgrind's JIT compiled virtual CPU. However, to avoid
memory space issues between the host and the guest, Valgrind does not provide
auxv entries that contain pointers. This includes PAGESIZES.

Normally rtld obtains the pagesizes from auxv, but it has fallback code to use
syscalls. This works OK for an amd64 exe on an amd64 kernel and i386 on i386.
But there is a problem for i386 on amd64. The i386 application will see
MAXPAGESLEN as 3 from the amd64 headers. But the i386 kernel sees this as only
2 [I might have gotten this the wrong way around]. The sysctl copy out code
sees this discrepancy and sets ENOMEM and the application terminates without
finishing the execution of rtld.

(I analysed all this with dtrace and looking at the source code, I don't know
how to use gdb/lldb to step through rtld code).

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


More information about the freebsd-bugs mailing list