[libc] Unpoison epoll structs (#94536)

The epoll wait functions return structs via pointer, but those structs
need to be unpoisoned before return. This patch adds that unpoisoning.
This commit is contained in:
Michael Jones 2024-06-05 15:02:28 -07:00 committed by GitHub
parent a74348ca66
commit 20483edd27
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 17 additions and 2 deletions

View File

@ -48,6 +48,7 @@ add_entrypoint_object(
libc.hdr.types.struct_timespec
libc.include.sys_syscall
libc.src.__support.OSUtil.osutil
libc.src.__support.macros.sanitizer
libc.src.errno.errno
)
@ -65,6 +66,7 @@ add_entrypoint_object(
libc.hdr.signal_macros
libc.include.sys_syscall
libc.src.__support.OSUtil.osutil
libc.src.__support.macros.sanitizer
libc.src.errno.errno
)
@ -82,5 +84,6 @@ add_entrypoint_object(
libc.hdr.signal_macros
libc.include.sys_syscall
libc.src.__support.OSUtil.osutil
libc.src.__support.macros.sanitizer
libc.src.errno.errno
)

View File

@ -13,6 +13,7 @@
#include "hdr/types/struct_epoll_event.h"
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
#include "src/__support/macros/sanitizer.h"
#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
@ -33,6 +34,8 @@ LLVM_LIBC_FUNCTION(int, epoll_pwait,
return -1;
}
MSAN_UNPOISON(events, ret * sizeof(struct epoll_event));
return ret;
}

View File

@ -14,6 +14,7 @@
#include "hdr/types/struct_timespec.h"
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
#include "src/__support/macros/sanitizer.h"
#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
@ -35,6 +36,8 @@ LLVM_LIBC_FUNCTION(int, epoll_pwait2,
return -1;
}
MSAN_UNPOISON(events, ret * sizeof(struct epoll_event));
return ret;
}

View File

@ -13,6 +13,7 @@
#include "hdr/types/struct_epoll_event.h"
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"
#include "src/__support/macros/sanitizer.h"
#include "src/errno/libc_errno.h"
#include <sys/syscall.h> // For syscall numbers.
@ -39,6 +40,8 @@ LLVM_LIBC_FUNCTION(int, epoll_wait,
return -1;
}
MSAN_UNPOISON(events, ret * sizeof(struct epoll_event));
return ret;
}

View File

@ -1111,7 +1111,7 @@ libc_support_library(
],
defines = [
"LIBC_COPT_TIMEOUT_ENSURE_MONOTONICITY",
"LIBC_COPT_RAW_MUTEX_DEFAULT_SPIN_COUNT"
"LIBC_COPT_RAW_MUTEX_DEFAULT_SPIN_COUNT",
],
target_compatible_with = select({
"@platforms//os:linux": [],
@ -1119,9 +1119,9 @@ libc_support_library(
}),
deps = [
":__support_cpp_optional",
":__support_time_linux",
":__support_threads_linux_futex_utils",
":__support_threads_sleep",
":__support_time_linux",
":types_pid_t",
],
)
@ -3580,6 +3580,7 @@ libc_function(
}),
weak = True,
deps = [
":__support_macros_sanitizer",
":__support_osutil_syscall",
":errno",
":hdr_signal_macros",
@ -3599,6 +3600,7 @@ libc_function(
}),
weak = True,
deps = [
":__support_macros_sanitizer",
":__support_osutil_syscall",
":errno",
":hdr_signal_macros",
@ -3620,6 +3622,7 @@ libc_function(
# }),
# weak = True,
# deps = [
# ":__support_macros_sanitizer",
# ":__support_osutil_syscall",
# ":errno",
# ":hdr_signal_macros",