Paul Floyd 3e7774ea5a Bug 452274 memcheck crashes with Assertion 'sci->status.what == SsIdle' failed
FreeBSD (and Darwin) use the carry flag for syscall syscall status.
That means that in the assembler for do_syscall_for_client_WRK
they have a call to LibVEX_GuestAMD64_put_rflag_c (amd64) or
LibVEX_GuestX86_put_eflag_c (x86). These also call WRK functions.

The problem is that do_syscall_for_client_WRK has carefully crafted
labels correspinding to IP addresses. If a signal interrupts
processdings, IP can be compared to these addresses so that
VG_(fixup_guest_state_after_syscall_interrupted) can work
out how to resume the syscall. But if IP is in the save
carry flag functions, the address is not recognized and
VG_(fixup_guest_state_after_syscall_interrupted) fails.

The crash in the title happens because the interrupted
syscall does not reset its status, and on the next syscall
it is expected that the status be idle.

To fix this I added global variables that get set to 1
just before calling the save carry flag functions, and cleared
just after. VG_(fixup_guest_state_after_syscall_interrupted)
can then check this and work out which section we are in
and resume the syscall correctly.

Also:

Start a new NEWS section for 3.20

Add a regtest for this and also a similar one for Bug 445032
(x86-freebsd only, new subdir).

I saw that this problem also probably exists with macOS, so I made
the same changes there (not yet tested)
2022-04-12 23:50:48 +02:00

43 lines
986 B
Makefile

include $(top_srcdir)/Makefile.tool-tests.am
dist_noinst_SCRIPTS = filter_stderr test.sh filter_452275
EXTRA_DIST = \
auxv.vgtest \
auxv.stderr.exp \
auxv.stderr.exp-32on64 \
auxv.stderr.exp-freebsd13 \
osrel.vgtest \
osrel.stderr.exp \
osrel.stdout.exp \
swapcontext.vgtest \
swapcontext.stderr.exp \
swapcontext.stdout.exp \
fexecve_hw1.vgtest \
fexecve_hw1.stdout.exp \
fexecve_hw1.stderr.exp \
fexecve_hw2.vgtest \
fexecve_hw2.stdout.exp \
fexecve_hw2.stderr.exp \
fexecve_script1.vgtest \
fexecve_script1.stderr.exp \
fexecve_script2.vgtest \
fexecve_script2.stdout.exp \
fexecve_script2.stderr.exp \
fexecve_txt.vgtest \
fexecve_txt.stderr.exp \
452275.vgtest \
452275.stderr.out
check_PROGRAMS = \
auxv osrel swapcontext hello_world fexecve 452275
AM_CFLAGS += $(AM_FLAG_M3264_PRI)
AM_CXXFLAGS += $(AM_FLAG_M3264_PRI)
auxv_CFLAGS = ${AM_CFLAGS}
osrel_CFLAGS = ${AM_CFLAGS}
swapcontext_CFLAGS = ${AM_CFLAGS}
hello_world_SOURCES = hello_world.cpp