Files
clang-p2996/compiler-rt/test/msan/Linux/prctl.cpp
Chris Cotter 986ceae7c5 [msan] Support prctl PR_GET_NAME call (#98951)
Per the man page, PR_GET_NAME stores a null terminated string into the
input `char name[16]`.

This also adds prctl support in ASAN to detect freed memory being passed
to `prctl(PR_GET_NAME, ...)`:
2024-07-16 09:41:41 -07:00

24 lines
450 B
C++

// RUN: %clangxx_msan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
#include <linux/prctl.h>
#include <sys/prctl.h>
int main(void) {
prctl(PR_SET_NAME, "tname");
char name[16];
prctl(PR_GET_NAME, name);
if (name[0] == 'A') {
return 0;
}
if (name[5] != '\0') {
return 0;
}
if (name[6] != '\0') {
return 0;
}
// CHECK: SUMMARY: MemorySanitizer: use-of-uninitialized-value {{.*prctl.cpp}}:[[@LINE-3]]
return 0;
}