bdwgc
bdwgc copied to clipboard
Support incremental collection on E2K
If MPROTECT_VDB is defined, then SIGILL is raised sometimes instead of SIGSEGV on a page fault. (Unless the library and the test are compiled with -O0.)
Commit c5c7c5324 supports mprotect-based VDB but only if no THREAD_LOCAL_ALLOC.
Note about SOFT_VDB: soft dirty bit is not supported by Linux kernel on e2k.
About SIGILL (why -O0 or -fsemi-spec-ld is needed): http://ftp.altlinux.com/pub/people/mike/elbrus/docs/elbrus_prog/html/chapter2.html
It could be easily reproduced on master (commit 308aafa40) with the following command: ./autogen.sh && ./configure && make check CFLAGS_EXTRA="-D MPROTECT_VDB" Repeat ./gctest several times. (Rate: ~1/4)
Minimal configuration (no threads) to reproduce the issue: gcc -I include -O1 -D MPROTECT_VDB -D NO_TEST_HANDLE_FORK -o gctest tests/gctest.c extra/gc.c && ./gctest (probably retry ./gctest several times) Output: Switched to incremental mode Emulating dirty bits with mprotect/signals Недопустимая инструкция
In gdb, it additionally reports: Program received signal SIGILL, Illegal instruction exc_diag_operand at 0x15d48 ALS0
(gdb) p $_siginfo
$1 = {si_signo = 4, si_errno = 0, si_code = 2, _sifields = {_pad = {89416, 0, 15, 0 <repeats 25 times>}, _kill = {
si_pid = 89416, si_uid = 0}, _timer = {si_tid = 89416, si_overrun = 0, si_sigval = {sival_int = 15,
sival_ptr = 0xf}}, _rt = {si_pid = 89416, si_uid = 0, si_sigval = {sival_int = 15, sival_ptr = 0xf}},
_sigchld = {si_pid = 89416, si_uid = 0, si_status = 15, si_utime = 0, si_stime = 0}, _sigfault = {
si_addr = 0x15d48 <typed_test+1464>}, _sigpoll = {si_band = 89416, si_fd = 15}}}