svn commit: r339876 - head/libexec/rtld-elf
Mark Millard
marklmi26-fbsd at yahoo.com
Sat Nov 3 20:03:08 UTC 2018
On 2018-Nov-3, at 12:04 PM, Mark Millard <marklmi26-fbsd at yahoo.com> wrote:
> 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 . . .
>
> . . .
>
>
>>> 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.
I tried installing a buildworld that has the patches
via using the make arguments:
installworld distrib-dirs distribution DB_FROM_SRC=1 DESTDIR=/usr/obj/DESTDIRs/gcc421-powerpc-installworld-poud
(I normally have poudriere-devel use this gcc421-powerpc-installworld-poud
in this environment.)
Then:
# chroot /usr/obj/DESTDIRs/gcc421-powerpc-installworld-poud
# pwd
/
# ls
.cshrc COPYRIGHT boot etc libexec mnt proc root tmp var
.profile bin dev lib media net rescue sbin usr
# df -m
Filesystem 1M-blocks Used Avail Capacity Mounted on
/dev/ufs/FBSDG4Srootfs 95203 38217 49369 44% /
devfs 0 0 0 100% /dev
# ls -lTd /bin/ls
-r-xr-xr-x 1 root wheel 36816 Nov 3 19:19:26 2018 /bin/ls
# ls -lTd /libexec/ld-elf.so.1*
-r-xr-xr-x 1 root wheel 136100 Nov 3 19:17:53 2018 /libexec/ld-elf.so.1
-r-xr-xr-x 1 root wheel 135932 Nov 2 02:10:34 2018 /libexec/ld-elf.so.1.old
# /usr/libexec/gdb /libexec/ld-elf.so.1
. . .
(gdb) disass reloc_non_plt
Dump of assembler code for function reloc_non_plt:
. . .
0x00002b48 <reloc_non_plt+204>: bl 0xef78 <free>
0x00002b4c <reloc_non_plt+208>: lwz r31,64(r29)
0x00002b50 <reloc_non_plt+212>: lwz r9,68(r29)
0x00002b54 <reloc_non_plt+216>: mr r11,r31
0x00002b58 <reloc_non_plt+220>: add r0,r31,r9
0x00002b5c <reloc_non_plt+224>: cmplw cr7,r31,r0
0x00002b60 <reloc_non_plt+228>: blt+ cr7,0x2b78 <reloc_non_plt+252>
0x00002b64 <reloc_non_plt+232>: b 0x2bbc <reloc_non_plt+320>
0x00002b68 <reloc_non_plt+236>: addi r31,r31,32
0x00002b6c <reloc_non_plt+240>: add r0,r11,r9
0x00002b70 <reloc_non_plt+244>: cmplw cr7,r0,r31
0x00002b74 <reloc_non_plt+248>: ble- cr7,0x2bbc <reloc_non_plt+320>
0x00002b78 <reloc_non_plt+252>: lwz r0,0(r31)
0x00002b7c <reloc_non_plt+256>: cmpwi cr7,r0,1
0x00002b80 <reloc_non_plt+260>: bne+ cr7,0x2b68 <reloc_non_plt+236>
0x00002b84 <reloc_non_plt+264>: lwz r0,24(r31)
0x00002b88 <reloc_non_plt+268>: andi. r10,r0,1
---Type <return> to continue, or q <return> to quit---
0x00002b8c <reloc_non_plt+272>: beq+ 0x2b68 <reloc_non_plt+236>
0x00002b90 <reloc_non_plt+276>: lwz r0,52(r29)
0x00002b94 <reloc_non_plt+280>: lwz r3,8(r31)
0x00002b98 <reloc_non_plt+284>: lwz r4,20(r31)
0x00002b9c <reloc_non_plt+288>: addi r31,r31,32
0x00002ba0 <reloc_non_plt+292>: add r3,r0,r3
0x00002ba4 <reloc_non_plt+296>: bl 0x12858 <__syncicache>
0x00002ba8 <reloc_non_plt+300>: lwz r11,64(r29)
0x00002bac <reloc_non_plt+304>: lwz r9,68(r29)
0x00002bb0 <reloc_non_plt+308>: add r0,r11,r9
0x00002bb4 <reloc_non_plt+312>: cmplw cr7,r0,r31
0x00002bb8 <reloc_non_plt+316>: bgt+ cr7,0x2b78 <reloc_non_plt+252>
. . .
So, unless the chroot somehow bypasses use of that local
/libexec/ld-elf.so.1 , the __synicache in a loop seems to
be working under the chroot use.
Let me know if this test is insufficient for some reason.
===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)
More information about the svn-src-head
mailing list