[Bug 221337] -fsanitize=address (asan) fails on i386
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Wed Aug 16 12:41:58 UTC 2017
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221337
--- Comment #3 from Ed Maste <emaste at freebsd.org> ---
Looking at libclang_rt.asan-i386.so it does have PT_TLS with 4-byte alignment,
and perhaps that should be changed on general principle:
% readelf -l /usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.asan-i386.so
Elf file type is DYN (Shared object file)
Entry point 0xbb80
There are 6 program headers, starting at offset 52
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x000000 0x00000000 0x00000000 0xc21c4 0xc21c4 R E 0x1000
LOAD 0x0c21c4 0x000c31c4 0x000c31c4 0x02f08 0x49a58c RW 0x1000
DYNAMIC 0x0c2470 0x000c3470 0x000c3470 0x000f8 0x000f8 RW 0x4
TLS 0x0c21c4 0x000c31c4 0x000c31c4 0x00000 0x00018 R 0x4
GNU_EH_FRAME 0x0b5a50 0x000b5a50 0x000b5a50 0x02934 0x02934 R 0x4
GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x4
Section to Segment mapping:
Segment Sections...
00 .hash .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.dyn
.rel.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame .comment
.gnu_debuglink .shstrtab
01 .tbss .ctors .dtors .jcr .data.rel.ro .dynamic .got .got.plt .data
.bss
02 .dynamic
03 .tbss .ctors
04 .eh_frame_hdr
05
ref12-i386%
but note that asan is not asserting that one of its symbols is not 8-byte
aligned but rather (some #ifdefs trimmed, showing only the FreeBSD/i386 path):
static void **ThreadSelfSegbase() {
void **segbase = 0;
// sysarch(I386_GET_GSBASE, segbase);
__asm __volatile("mov %%gs:0, %0" : "=r" (segbase));
return segbase;
}
uptr ThreadSelf() {
return (uptr)ThreadSelfSegbase()[2];
}
static void GetTls(uptr *addr, uptr *size) {
void** segbase = ThreadSelfSegbase();
*addr = 0;
*size = 0;
if (segbase != 0) {
// tcbalign = 16
// tls_size = round(tls_static_space, tcbalign);
// dtv = segbase[1];
// dtv[2] = segbase - tls_static_space;
void **dtv = (void**) segbase[1];
*addr = (uptr) dtv[2];
*size = (*addr == 0) ? 0 : ((uptr) segbase[0] - (uptr) dtv[2]);
}
}
and later asserts that the addr returned from GetTls is 8-byte aligned
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list