svn commit: r339876 - head/libexec/rtld-elf
Mark Millard
marklmi26-fbsd at yahoo.com
Sat Nov 3 19:05:07 UTC 2018
On 2018-Nov-3, at 8:49 AM, Konstantin Belousov <kostikbel at gmail.com> wrote:
> On Fri, Nov 02, 2018 at 05:51:25PM -0700, Mark Millard wrote:
>> On 2018-Nov-2, at 11:50 AM, Konstantin Belousov <kostikbel at gmail.com> wrote:
>>
>>> On Fri, Nov 02, 2018 at 10:38:08AM -0700, Mark Millard wrote:
>>>> . . .
>>>
>>> There seems to be an issue with the direct execution mode on ppc.
>>> Even otherwise working ld-elf.so.1 segfaults if I try to use it as
>>> standalone binary.
>>>
>>> But if I specify patched ld-elf.so.1 as the interpreter for some program,
>>> using 'cc -Wl,-I,<path>/ld-elf.so.1' it works. So I see there two bugs,
>>> one is regression due to textsize calculation, which should be fixed by
>>> my patch. Another is the direct exec problem.
>>
>> My head -r339076 based powerpc64 and armv7 contexts also
>> fail for:
>>
>> # /libexec/ld-elf.so.1 /bin/ls
>>
>> The armv7 (a Cortext-A7 context) is interestingly different
>> in how it fails:
>>
>> # /libexec/ld-elf.so.1 /bin/ls
>> ld-elf.so.1: /bin/ls: mmap of entire address space failed: Cannot allocate memory
> Can you show the ktrace/kdump for this ?
Sure, in the Cortex-A7 context . . .
# ktrace -t+ /libexec/ld-elf.so.1 /bin/ls
ld-elf.so.1: /bin/ls: mmap of entire address space failed: Cannot allocate memory
# kdump | less
80903 ktrace RET ktrace 0
80903 ktrace CALL execve(0xbfbfee23,0xbfbfecf0,0xbfbfecfc)
80903 ktrace NAMI "/libexec/ld-elf.so.1"
80903 ld-elf.so.1 RET execve JUSTRETURN
80903 ld-elf.so.1 CALL mmap(0,0x20000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,0xffffffff,0,0,0)
80903 ld-elf.so.1 RET mmap 537071616/0x20031000
80903 ld-elf.so.1 CALL issetugid
80903 ld-elf.so.1 RET issetugid 0
80903 ld-elf.so.1 CALL openat(AT_FDCWD,0xbfbfee2d,0x300000<O_RDONLY|O_CLOEXEC|O_VERIFY>)
80903 ld-elf.so.1 NAMI "/bin/ls"
80903 ld-elf.so.1 RET openat 3
80903 ld-elf.so.1 CALL fstat(0x3,0xbfbfe638)
80903 ld-elf.so.1 STRU struct stat {dev=95, ino=2568217, mode=0100555, nlink=1, uid=0, gid=0, rdev=5140776, atime=1538464078.957949000, mtime=1538464078.958055000, ctime=1538464078.958810000, birthtime=1538464078.957947000, size=39440, blksize=32768, blocks=80, flags=0x0 }
80903 ld-elf.so.1 RET fstat 0
80903 ld-elf.so.1 CALL geteuid
80903 ld-elf.so.1 RET geteuid 0
80903 ld-elf.so.1 CALL mmap(0,0x1000,0x1<PROT_READ>,0x40002<MAP_PRIVATE|MAP_PREFAULT_READ>,0x3,0,0,0)
80903 ld-elf.so.1 RET mmap 537202688/0x20051000
80903 ld-elf.so.1 CALL mmap(0x10000,0xb000,0<PROT_NONE>,0x6010<MAP_FIXED|MAP_GUARD|MAP_EXCL>,0xffffffff,0x10000,0,0)
80903 ld-elf.so.1 RET mmap -1 errno 12 Cannot allocate memory
80903 ld-elf.so.1 CALL munmap(0x20051000,0x1000)
80903 ld-elf.so.1 RET munmap 0
80903 ld-elf.so.1 CALL close(0x3)
80903 ld-elf.so.1 RET close 0
80903 ld-elf.so.1 CALL write(0x2,0x12e38,0xd)
80903 ld-elf.so.1 GIO fd 2 wrote 13 bytes
"ld-elf.so.1: "
80903 ld-elf.so.1 RET write 13/0xd
80903 ld-elf.so.1 CALL write(0x2,0x33238,0x44)
80903 ld-elf.so.1 GIO fd 2 wrote 68 bytes
"/bin/ls: mmap of entire address space failed: Cannot allocate memory"
80903 ld-elf.so.1 RET write 68/0x44
80903 ld-elf.so.1 CALL write(0x2,0xbfbfe1e7,0x1)
80903 ld-elf.so.1 GIO fd 2 wrote 1 byte
"
"
80903 ld-elf.so.1 RET write 1
80903 ld-elf.so.1 CALL exit(0x1)
>> My aarch64 context (a Cortext-A53 context) had no problem.
>>
>> (All 3 examples are without any of the the recent updates
>> or patches to ld-elf.so.1 source code.)
>
> And still, does the patch for isync range works ? You can test the new
> ld-elf.so.1 standalone by hard-coding its path into the binary. Build e.g.
> only ls(1) by using make in its directory, then re-issue the linking
> command with the additional flag '-Wl,-I,<path to patched ld-elf.so.1>
> and try to run ls.full.
Looks like the old PowerMac is available again for
such activity. So I'll see about testing.
===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)
More information about the svn-src-head
mailing list