Skip to content

Commit

Permalink
[compiler-rt] fix __sanitizer_siginfo type on freebsd. (#77379)
Browse files Browse the repository at this point in the history
mostly interested in the first half of the type, adding also compile
time check.
  • Loading branch information
devnexen committed Mar 1, 2024
1 parent 012b697 commit 43bcedd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,8 @@ CHECK_TYPE_SIZE(nfds_t);
CHECK_TYPE_SIZE(sigset_t);

COMPILER_CHECK(sizeof(__sanitizer_sigaction) == sizeof(struct sigaction));
COMPILER_CHECK(sizeof(__sanitizer_siginfo) == sizeof(siginfo_t));
CHECK_SIZE_AND_OFFSET(siginfo_t, si_value);
// Can't write checks for sa_handler and sa_sigaction due to them being
// preprocessor macros.
CHECK_STRUCT_SIZE_AND_OFFSET(sigaction, sa_mask);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,29 @@ struct __sanitizer_sigset_t {

typedef __sanitizer_sigset_t __sanitizer_kernel_sigset_t;

union __sanitizer_sigval {
int sival_int;
void *sival_ptr;
};

struct __sanitizer_siginfo {
// The size is determined by looking at sizeof of real siginfo_t on linux.
u64 opaque[128 / sizeof(u64)];
int si_signo;
int si_errno;
int si_code;
pid_t si_pid;
u32 si_uid;
int si_status;
void *si_addr;
union __sanitizer_sigval si_value;
# if SANITIZER_WORDSIZE == 64
char data[40];
# else
char data[32];
# endif
};

typedef __sanitizer_siginfo __sanitizer_siginfo_t;

using __sanitizer_sighandler_ptr = void (*)(int sig);
using __sanitizer_sigactionhandler_ptr = void (*)(int sig,
__sanitizer_siginfo *siginfo,
Expand Down

0 comments on commit 43bcedd

Please sign in to comment.