[compiler-rt] Don't handle Linux-specific shmctl commands in sanitizer (#143116)
Despite being defined in the system headers, these commands are not in fact part of the FreeBSD system call interface. They exist solely for the Linuxulator, i.e. running Linux binaries on FreeBSD, and any attempt to use them from a FreeBSD binary will return EINVAL. The fact we needed to define _KERNEL (which, as the name implies, means we are compiling the kernel) to even get the definition of shminfo should have been a strong indicator that IPC_INFO at least was not a userspace interface.
This commit is contained in:
parent
a7091951f0
commit
9320d1d484
@ -29,6 +29,7 @@
|
||||
#include <sys/mtio.h>
|
||||
#include <sys/ptrace.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/shm.h>
|
||||
#include <sys/signal.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sockio.h>
|
||||
@ -87,10 +88,6 @@
|
||||
#include <wchar.h>
|
||||
#include <wordexp.h>
|
||||
|
||||
#define _KERNEL // to declare 'shminfo' structure
|
||||
#include <sys/shm.h>
|
||||
#undef _KERNEL
|
||||
|
||||
#undef IOC_DIRMASK
|
||||
|
||||
// Include these after system headers to avoid name clashes and ambiguities.
|
||||
@ -141,8 +138,6 @@ unsigned struct_timeb_sz = sizeof(struct timeb);
|
||||
unsigned struct_msqid_ds_sz = sizeof(struct msqid_ds);
|
||||
unsigned struct_mq_attr_sz = sizeof(struct mq_attr);
|
||||
unsigned struct_statvfs_sz = sizeof(struct statvfs);
|
||||
unsigned struct_shminfo_sz = sizeof(struct shminfo);
|
||||
unsigned struct_shm_info_sz = sizeof(struct shm_info);
|
||||
unsigned struct_regmatch_sz = sizeof(regmatch_t);
|
||||
unsigned struct_regex_sz = sizeof(regex_t);
|
||||
unsigned struct_fstab_sz = sizeof(struct fstab);
|
||||
@ -156,9 +151,6 @@ const uptr sig_err = (uptr)SIG_ERR;
|
||||
const uptr sa_siginfo = (uptr)SA_SIGINFO;
|
||||
|
||||
int shmctl_ipc_stat = (int)IPC_STAT;
|
||||
int shmctl_ipc_info = (int)IPC_INFO;
|
||||
int shmctl_shm_info = (int)SHM_INFO;
|
||||
int shmctl_shm_stat = (int)SHM_STAT;
|
||||
unsigned struct_utmpx_sz = sizeof(struct utmpx);
|
||||
|
||||
int map_fixed = MAP_FIXED;
|
||||
|
@ -419,12 +419,14 @@ struct __sanitizer_wordexp_t {
|
||||
|
||||
typedef void __sanitizer_FILE;
|
||||
|
||||
extern unsigned struct_shminfo_sz;
|
||||
extern unsigned struct_shm_info_sz;
|
||||
extern int shmctl_ipc_stat;
|
||||
extern int shmctl_ipc_info;
|
||||
extern int shmctl_shm_info;
|
||||
extern int shmctl_shm_stat;
|
||||
|
||||
// This simplifies generic code
|
||||
#define struct_shminfo_sz -1
|
||||
#define struct_shm_info_sz -1
|
||||
#define shmctl_shm_stat -1
|
||||
#define shmctl_ipc_info -1
|
||||
#define shmctl_shm_info -1
|
||||
|
||||
extern unsigned struct_utmpx_sz;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user