mirror of
https://github.com/intel/llvm.git
synced 2026-01-22 23:49:22 +08:00
[sanitizer] Handle nullptr name in prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME) (#160824)
### Summary This PR resolves https://github.com/llvm/llvm-project/issues/160562
This commit is contained in:
@@ -1326,7 +1326,7 @@ PRCTL_INTERCEPTOR(int, prctl, int option, unsigned long arg2,
|
||||
static const int PR_SET_SECCOMP = 22;
|
||||
static const int SECCOMP_MODE_FILTER = 2;
|
||||
# endif
|
||||
if (option == PR_SET_VMA && arg2 == 0UL) {
|
||||
if (option == PR_SET_VMA && arg2 == 0UL && arg5 != 0UL) {
|
||||
char *name = (char *)arg5;
|
||||
COMMON_INTERCEPTOR_READ_RANGE(ctx, name, internal_strlen(name) + 1);
|
||||
}
|
||||
|
||||
@@ -88,5 +88,8 @@ int main() {
|
||||
res = prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &pr);
|
||||
assert(res == -1);
|
||||
|
||||
unsigned long name = reinterpret_cast<unsigned long>(nullptr);
|
||||
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, 0, nullptr, name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user