On Wed, Jul 22, 2015 at 11:46:35AM +0200, Andre Meiser
wrote:> On Sun, Jul 19, 2015 at 22:57 +0200, Konstantin Belousov wrote:
> > It seems that besides sigreturn(), ucontext symbols must be
pre-resolved
> > as well. Try this update (it includes the previous change).
>
> thanks for looking into this, but this patch wasn't funny at all. Did
you tested your patch? Almost every programme crashed with a core dump. Here
the example for simply starting vim:
>
> % readelf -d vim | grep NEEDED
> 0x0000000000000001 (NEEDED) Shared library: [libm.so.5]
> 0x0000000000000001 (NEEDED) Shared library: [libncurses.so.8]
> 0x0000000000000001 (NEEDED) Shared library: [libintl.so.8]
> 0x0000000000000001 (NEEDED) Shared library:
[libpython2.7.so.1]
> 0x0000000000000001 (NEEDED) Shared library: [libthr.so.3]
> 0x0000000000000001 (NEEDED) Shared library: [libc.so.7]
>
>
> (gdb) bt
> #0 0x00000008014a30d4 in _thr_rtld_init () at
/usr/src/lib/libthr/thread/thr_rtld.c:239
> #1 0x00000008014a2f03 in _libpthread_init (curthread=<value optimized
out>) at /usr/src/lib/libthr/thread/thr_init.c:372
> #2 0x00000008014a5c22 in _thread_printf () from /lib/libthr.so.3
> #3 0x0000000801498d06 in _init () from /lib/libthr.so.3
> #4 0x00007fffffffe000 in ?? ()
> #5 0x000000080083d6bf in r_debug_state () from /libexec/ld-elf.so.1
> #6 0x000000080083cd17 in __tls_get_addr () from /libexec/ld-elf.so.1
> #7 0x000000080083b129 in .text () from /libexec/ld-elf.so.1
> #8 0x0000000000000000 in ?? ()
>
>
> (gdb) info locals
> li = {rtli_version = 0, lock_create = 0x8014a30f0
<_thr_rtld_lock_create>, lock_destroy = 0x8014a3160
<_thr_rtld_lock_destroy>,
> rlock_acquire = 0x8014a31b0 <_thr_rtld_rlock_acquire>,
wlock_acquire = 0x8014a3270 <_thr_rtld_wlock_acquire>,
> lock_release = 0x8014a3300 <_thr_rtld_lock_release>,
thread_set_flag = 0x8014a33c0 <_thr_rtld_set_flag>,
> thread_clr_flag = 0x8014a33d0 <_thr_rtld_clr_flag>, at_fork = 0}
> dummy = -1
> curthread = (struct pthread *) 0x7fffff0f2650
> uc_len = <value optimized out
>
>
> (gdb) info registers
> rax 0xf0b470 15774832
> rbx 0x7fffff0f2650 140737472570960
> rcx 0x0 0
> rdx 0xca0000 13238272
> rsi 0x8024064e8 34397512936
> rdi 0x7fffff0f2650 140737472570960
> rbp 0x7fffffffdb20 0x7fffffffdb20
> rsp 0x7fffff0f2650 0x7fffff0f2650
> r8 0x0 0
> r9 0xfffff8000e35f4c0 -8795854605120
> r10 0x0 0
> r11 0x246 582
> r12 0x800a54a28 34370570792
> r13 0x800a545b0 34370569648
> r14 0x1 1
> r15 0x800855420 34368476192
> rip 0x8014a30d4 0x8014a30d4 <_thr_rtld_init+244>
> eflags 0x10206 66054
> cs 0x43 67
> ss 0x3b 59
> ds 0x0 0
> es 0x0 0
> fs 0x0 0
> gs 0x0 0
%rbp-%rsp == 0xf0b4d0 == 15774928
Can you do the following:
1. Compile and run the program at the end of the message and send me
the output.
2. Also send me the first 40 lines of the dmesg for bootverbose boot.
3. (Optional) Install x86info program, compiled from the sources on
github, https://github.com/dankamongmen/x86info, then run, as root
kldload cpuctl
x86info -a
#include <stdio.h>
extern int __getcontextx_size(void);
int main(void)
{
printf("%#x\n", __getcontextx_size());
}