From: Thomas M. <th...@m3...> - 2016-05-23 18:42:50
|
Am Sonntag, den 22.05.2016, 17:39 +0200 schrieb Vegard Nossum: > On 21 May 2016 at 20:18, Thomas Meyer <th...@m3...> wrote: > > > > Am 21.05.2016 um 15:51 schrieb Vegard Nossum <vegard.nossum@gmail.c > > om>: > > > > > > I'm having some trouble with using current_thread_info() during > > > UML > > > early boot. Sometimes it works just fine, but often I get > > > segfaults > > > because current_thread_info() is returning an invalid pointer. It > > > looks random: 0x202118, 0x1003e0003, 0xd33b90b3, 0x6db043, etc. > > Mhh. Strange. Do you have a stack trace to call to current thread > > info which ends up with a wrong value. I wonder from were it > > originates. > One such trace would be: > > #2 0x000000006026652c in snprintf (buf=<optimized out>, > size=<optimized out>, fmt=<optimized out>) at lib/vsprintf.c:2181 > #3 0x00000000600046f8 in setup_env_path () at arch/um/os- > Linux/main.c:109 > #4 main (argc=3, argv=0x7ffc3d8c23e8, envp=<optimized out>) at > arch/um/os-Linux/main.c:125 > > I wonder why setup_env_path() ends up calling the kernel's > snprintf(), > I thought that it would be using the glibc snprintf() at this point? Mhh. Good question! Doing a make ARCH=um V=1 arch/um/os-Linux/main.o results in: gcc -Wp,-MD,arch/um/os-Linux/.main.o.d -Wall -Wundef -Wstrict- prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror- implicit-function-declaration -Wno-format-security -std=gnu89 -mcmodel=large -fno-builtin -m64 -funit-at-a-time -D__arch_um__ -Dvmap=kernel_vmap -Din6addr_loopback=kernel_in6addr_loopback -Din6addr_any=kernel_in6addr_any -Dstrrchr=kernel_strrchr -D_LARGEFILE64_SOURCE -fno-delete-null-pointer-checks -O2 -- param=allow-store-data-races=0 -fno-reorder-blocks -fno-ipa-cp-clone -fno-partial-inlining -Wframe-larger-than=1024 -fno-stack-protector -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize- sibling-calls -fno-var-tracking-assignments -g -gdwarf-4 -Wdeclaration- after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -Werror=incompatible-pointer-types -DCC_HAVE_ASM_GOTO -I./arch/um/include/shared -I./arch/x86/um/shared -I./arch/um/include/shared/skas -D_FILE_OFFSET_BITS=64 -idirafter ./include -idirafter ./include -D__KERNEL__ -D__UM_HOST__ -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -include ./include/linux/kern_levels.h -include user.h -c -o arch/um/os-Linux/main.o arch/um/os-Linux/main.c so it includes user.h and is under os-Linux. So I guess it should actually call the glibc version, I'm not sure why it doesn't. with kind regards thomas > > > Vegard > |