diff --git a/compiler-rt/lib/dfsan/dfsan_custom.cpp b/compiler-rt/lib/dfsan/dfsan_custom.cpp --- a/compiler-rt/lib/dfsan/dfsan_custom.cpp +++ b/compiler-rt/lib/dfsan/dfsan_custom.cpp @@ -799,6 +799,16 @@ return ret; } +SANITIZER_INTERFACE_ATTRIBUTE +int __dfsw_sigaltstack(const stack_t *ss, stack_t *old_ss, dfsan_label ss_label, + dfsan_label old_ss_label, dfsan_label *ret_label) { + int ret = sigaltstack(ss, old_ss); + if (ret != -1 && old_ss) + dfsan_set_label(0, old_ss, sizeof(*old_ss)); + *ret_label = 0; + return ret; +} + SANITIZER_INTERFACE_ATTRIBUTE int __dfsw_gettimeofday(struct timeval *tv, struct timezone *tz, dfsan_label tv_label, dfsan_label tz_label, diff --git a/compiler-rt/lib/dfsan/done_abilist.txt b/compiler-rt/lib/dfsan/done_abilist.txt --- a/compiler-rt/lib/dfsan/done_abilist.txt +++ b/compiler-rt/lib/dfsan/done_abilist.txt @@ -200,6 +200,7 @@ fun:pread=custom fun:read=custom fun:recvmsg=custom +fun:sigaltstack=custom fun:socketpair=custom fun:stat=custom fun:time=custom diff --git a/compiler-rt/test/dfsan/custom.cpp b/compiler-rt/test/dfsan/custom.cpp --- a/compiler-rt/test/dfsan/custom.cpp +++ b/compiler-rt/test/dfsan/custom.cpp @@ -762,6 +762,15 @@ ASSERT_READ_ZERO_LABEL(&oldact, sizeof(oldact)); } +void test_sigaltstack() { + stack_t old_altstack = {}; + dfsan_set_label(j_label, &old_altstack, sizeof(old_altstack)); + int ret = sigaltstack(NULL, &old_altstack); + assert(ret == 0); + ASSERT_ZERO_LABEL(ret); + ASSERT_READ_ZERO_LABEL(&old_altstack, sizeof(old_altstack)); +} + void test_gettimeofday() { struct timeval tv; struct timezone tz; @@ -1172,6 +1181,7 @@ test_sched_getaffinity(); test_select(); test_sigaction(); + test_sigaltstack(); test_sigemptyset(); test_snprintf(); test_socketpair();