Skip to content

Commit 61eeae9

Browse files
committed
subprocess-posix: MP_NO_ASAN
1 parent 753a71d commit 61eeae9

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

osdep/compiler.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99
#define MP_NORETURN __attribute__((noreturn))
1010
#define MP_FALLTHROUGH __attribute__((fallthrough))
1111
#define MP_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
12+
#define MP_NO_ASAN __attribute__((no_sanitize("address")))
1213
#else
1314
#define PRINTF_ATTRIBUTE(a1, a2)
1415
#define SCANF_ATTRIBUTE(a1, a2)
1516
#define MP_NORETURN
1617
#define MP_FALLTHROUGH do {} while (0)
1718
#define MP_WARN_UNUSED_RESULT
19+
#define MP_NO_ASAN
1820
#endif
1921

2022
// Broken crap with __USE_MINGW_ANSI_STDIO

osdep/subprocess-posix.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ static int as_execvpe(const char *path, const char *file, char *const argv[],
7979
static void reset_signals_child(void)
8080
{
8181
#if !HAVE_RFORK
82+
// RFSPAWN has reset all signal actions in the child to default already
8283
struct sigaction sa = { 0 };
8384
sigset_t sigmask;
8485
sa.sa_handler = SIG_DFL;
@@ -104,10 +105,9 @@ static pid_t spawn_process_inner(const char *path, struct mp_subprocess_opts *op
104105
int src_fds[], bool detach, void *stacks[]);
105106

106107
// This function is called from a clone(CLONE_VM)/rfork_thread context where
107-
// the child shares the parent's address space. Use no_sanitize to avoid false
108+
// the child shares the parent's address space. Use MP_NO_ASAN to avoid false
108109
// positives from ASan when the child writes to shared memory.
109-
__attribute__((no_sanitize("address")))
110-
static int child_main(void* args)
110+
MP_NO_ASAN static int child_main(void* args)
111111
{
112112
struct child_args *child_args = args;
113113
const char *path = child_args->path;
@@ -124,7 +124,6 @@ static int child_main(void* args)
124124
return 0;
125125
}
126126

127-
// RFSPAWN has reset all signal actions in the child to default
128127
reset_signals_child();
129128

130129
for (int n = 0; n < opts->num_fds; n++) {

0 commit comments

Comments
 (0)