Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 05 May 2020 06:55:47 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 246215] [rtld] fails for i386 on amd64 if auxv does not contain PAGESIZES
Message-ID:  <bug-246215-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D246215

            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@FreeBSD.org
          Reporter: paulf@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 provi=
de
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 i38=
6.
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 o=
nly
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 kn=
ow
how to use gdb/lldb to step through rtld code).

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-246215-227>