Re: installworld breaks my FreeBSD/powerpc system!!!

From: Maxim Sobolev <sobomax_at_FreeBSD.org>
Date: Wed, 25 Jul 2007 16:34:59 -0700
Maxim Sobolev wrote:
> Marcel Moolenaar wrote:
>>
>> On Jul 25, 2007, at 12:35 PM, Maxim Sobolev wrote:
>>
>>> It seems that installworld from yesterday sources severely corrupted 
>>> my 7-CURRENT FreeBSD/ppc installation. :(
>>>
>>> I believe this is caused by the recent libc changes that go together 
>>> with dynamic linker changes, but since dynamic linker is installed 
>>> *after* libc in installworld process, one who does source upgrade 
>>> ends up with broken system containing old dynamic linker, while new 
>>> libc after installworld explodes! :(((
>>
>> I think it's a mmap(2) problem, rather than a libc/ld-elf problem. I 
>> suspect
>> that the peter_at_'s change to not align arguments is causing the 
>> problem. It's
>> difficult to analyze because I don't trust the output of truss and ktrace
>> anymore in this case: the file offset argument is garbage according to 
>> those
>> tools. The file offset is garbage on all platforms, not just PowerPC :-/
>>
>> Other signs of mmap problems: dhclient complaining about a corrupted 
>> lease
>> file and rpc.statd complaining about an invalid database file...
>>
>> Unfortunately, I don't have the time to look into it right now.
> 
> Yes, looks like you are right. I've booted into single-user and copied 
> both libc.so.7 and ld-elf.so.1 by hand and everything works now. I think 
> that the problem happens when install(8) invokes strip(1) to get rid of 
> debug symbols and strip(1) uses mmap(), which messes up the library.
> 
> This has to be resolved ASAP.

Yes, indeed, apparently the new kernel doesn't work with old libc on 
PowerPC and consequently statically linked bootstrap binaries from 
/usr/obj produce incorrect results:

[sobomax_at_sobomac /tmp]$ ktrace /usr/obj/usr/src/tmp/usr/bin/strip libc.so.7
BFD: stUwcDGK: warning: allocated section `.hash' not in segment
BFD: stUwcDGK: warning: allocated section `.dynsym' not in segment
BFD: stUwcDGK: warning: allocated section `.dynstr' not in segment
BFD: stUwcDGK: warning: allocated section `.gnu.version' not in segment
BFD: stUwcDGK: warning: allocated section `.gnu.version_d' not in segment
BFD: stUwcDGK: warning: allocated section `.rela.dyn' not in segment
BFD: stUwcDGK: warning: allocated section `.rela.plt' not in segment
BFD: stUwcDGK: warning: allocated section `.init' not in segment
BFD: stUwcDGK: warning: allocated section `.text' not in segment
BFD: stUwcDGK: warning: allocated section `.fini' not in segment
BFD: stUwcDGK: warning: allocated section `.rodata' not in segment
BFD: stUwcDGK: warning: allocated section `.data' not in segment
BFD: stUwcDGK: warning: allocated section `.tbss' not in segment
BFD: stUwcDGK: warning: allocated section `.eh_frame' not in segment
BFD: stUwcDGK: warning: allocated section `.dynamic' not in segment
BFD: stUwcDGK: warning: allocated section `.ctors' not in segment
BFD: stUwcDGK: warning: allocated section `.dtors' not in segment
BFD: stUwcDGK: warning: allocated section `.jcr' not in segment
BFD: stUwcDGK: warning: allocated section `.got' not in segment
BFD: stUwcDGK: warning: allocated section `.sdata2' not in segment
BFD: stUwcDGK: warning: allocated section `.sdata' not in segment
BFD: stUwcDGK: warning: allocated section `.sbss' not in segment
BFD: stUwcDGK: warning: allocated section `.plt' not in segment
BFD: stUwcDGK: warning: allocated section `.bss' not in segment
/usr/obj/usr/src/tmp/usr/bin/strip: unable to copy file 'libc.so.7' 
reason: Permission denied
[sobomax_at_sobomac /tmp]$ kdump | grep freebsd6_mmap
    746 strip    CALL 
freebsd6_mmap(0,0x200000,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,0xffffffff,0,0,0)
    746 strip    RET   freebsd6_mmap 562896896/0x218d2000
 
che_read\0_savefpr_17\0__collate_err\0__sys_sctp_peeloff\0_reclaim_telldir\0_sseek\0__xprt_unregister_unlocked\0freebsd6_mmap\0\
 
authsvc_lock\0__bt_dleaf\0_savefpr_19\0__sys_freebsd6_mmap\0__rpc_taddr2uaddr_af\0freebsd4_fstatfs\0__pow5mult_D2A\0_sctp_gener\
 
r\0__fputwc\0_freebsd6_mmap\0_sigintr\0__cached_mp_write\0_endnetdnsent\0__rec_ret\0_sctp_generic_sendmsg\0__vfwprintf\0_nsyy_c\
    746 strip    CALL 
freebsd6_mmap(0,0x200000,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,0xffffffff,0,0,0)
    746 strip    RET   freebsd6_mmap 564133888/0x21a00000

New libc seems to be OK:

[sobomax_at_sobomac /tmp]$ strip libc.so.7
strip: unable to copy file 'libc.so.7' reason: Permission denied
[sobomax_at_sobomac /tmp]$ kdump | grep -w mmap
    749 strip    CALL 
mmap(0,0x8000,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,0xffffffff,0,0,0)
    749 strip    RET   mmap 562847744/0x218c6000
    749 strip    CALL 
mmap(0,0x127000,PROT_READ|PROT_EXEC,MAP_PRIVATE|MAP_NOCORE,0x3,0x7fffd860,0,0)
    749 strip    RET   mmap 562941952/0x218dd000
    749 strip    CALL 
mmap(0x219e5000,0x7000,PROT_READ|PROT_WRITE|PROT_EXEC,MAP_PRIVATE|MAP_FIXED,0x3,0x218d8c4c,0,0xf8000)
    749 strip    RET   mmap 564023296/0x219e5000
    749 strip    CALL 
mmap(0x219ec000,0x18000,PROT_READ|PROT_WRITE|PROT_EXEC,MAP_PRIVATE|MAP_FIXED|MAP_ANON,0xffffffff,0x218d8c4c,0,0)
    749 strip    RET   mmap 564051968/0x219ec000
    749 strip    CALL 
mmap(0,0x328,PROT_READ|PROT_WRITE,MAP_ANON,0xffffffff,0x1000,0,0)
    749 strip    RET   mmap 562880512/0x218ce000
    749 strip    CALL 
mmap(0,0x51c8,PROT_READ|PROT_WRITE,MAP_ANON,0xffffffff,0xffffffc4,0,0)
    749 strip    RET   mmap 562880512/0x218ce000
    749 strip    CALL 
mmap(0,0x200000,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,0xffffffff,0,0,0)
    749 strip    RET   mmap 564150272/0x21a04000
    749 strip    CALL 
mmap(0,0x200000,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,0xffffffff,0xfffffffe,0,0)
    749 strip    RET   mmap 566231040/0x21c00000

Please investigate and fix

-Maxim
Received on Wed Jul 25 2007 - 21:35:14 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:15 UTC