Skip to content

Commit eb1960c

Browse files
authored
[sanitizer] Handle nullptr name in prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME) (#160824)
### Summary This PR resolves #160562
1 parent 978644c commit eb1960c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1326,7 +1326,7 @@ PRCTL_INTERCEPTOR(int, prctl, int option, unsigned long arg2,
13261326
static const int PR_SET_SECCOMP = 22;
13271327
static const int SECCOMP_MODE_FILTER = 2;
13281328
# endif
1329-
if (option == PR_SET_VMA && arg2 == 0UL) {
1329+
if (option == PR_SET_VMA && arg2 == 0UL && arg5 != 0UL) {
13301330
char *name = (char *)arg5;
13311331
COMMON_INTERCEPTOR_READ_RANGE(ctx, name, internal_strlen(name) + 1);
13321332
}

compiler-rt/test/sanitizer_common/TestCases/Linux/prctl.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,8 @@ int main() {
8888
res = prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &pr);
8989
assert(res == -1);
9090

91+
unsigned long name = reinterpret_cast<unsigned long>(nullptr);
92+
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, 0, nullptr, name);
93+
9194
return 0;
9295
}

0 commit comments

Comments
 (0)