Skip to content

Commit 99ade15

Browse files
committed
Revert "[compiler-rt] prctl interception update, SECCOMP_MODE_FILTER support. (#107722)"
This reverts commit b75174d. Does not build on Android, see comments on #107722
1 parent fa17977 commit 99ade15

File tree

4 files changed

+12
-31
lines changed

4 files changed

+12
-31
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,9 +1289,6 @@ INTERCEPTOR(int, prctl, int option, unsigned long arg2, unsigned long arg3,
12891289
static const int PR_SCHED_CORE = 62;
12901290
static const int PR_SCHED_CORE_GET = 0;
12911291
static const int PR_GET_PDEATHSIG = 2;
1292-
static const int PR_SET_SECCOMP = 22;
1293-
1294-
static const int SECCOMP_MODE_FILTER = 2;
12951292
if (option == PR_SET_VMA && arg2 == 0UL) {
12961293
char *name = (char *)arg5;
12971294
COMMON_INTERCEPTOR_READ_RANGE(ctx, name, internal_strlen(name) + 1);
@@ -1310,9 +1307,6 @@ INTERCEPTOR(int, prctl, int option, unsigned long arg2, unsigned long arg3,
13101307
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, (u64 *)(arg5), sizeof(u64));
13111308
} else if (res != -1 && option == PR_GET_PDEATHSIG) {
13121309
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, (u64 *)(arg2), sizeof(int));
1313-
} else if (res != -1 && option == PR_SET_SECCOMP &&
1314-
arg2 == SECCOMP_MODE_FILTER) {
1315-
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, (u64 *)(arg3), struct_sock_fprog_sz);
13161310
}
13171311
return res;
13181312
}

compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,15 @@ typedef struct user_fpregs elf_fpregset_t;
117117
#if SANITIZER_LINUX
118118
#if SANITIZER_GLIBC
119119
#include <fstab.h>
120-
# include <linux/filter.h>
121-
# include <net/if_ppp.h>
122-
# include <netax25/ax25.h>
123-
# include <netipx/ipx.h>
124-
# include <netrom/netrom.h>
125-
# include <obstack.h>
126-
# if HAVE_RPC_XDR_H
127-
# include <rpc/xdr.h>
128-
# endif
129-
# include <scsi/scsi.h>
120+
#include <net/if_ppp.h>
121+
#include <netax25/ax25.h>
122+
#include <netipx/ipx.h>
123+
#include <netrom/netrom.h>
124+
#include <obstack.h>
125+
#if HAVE_RPC_XDR_H
126+
# include <rpc/xdr.h>
127+
#endif
128+
#include <scsi/scsi.h>
130129
#else
131130
#include <linux/if_ppp.h>
132131
#include <linux/kd.h>
@@ -532,10 +531,9 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
532531

533532
unsigned struct_audio_buf_info_sz = sizeof(struct audio_buf_info);
534533
unsigned struct_ppp_stats_sz = sizeof(struct ppp_stats);
535-
unsigned struct_sock_fprog_sz = sizeof(struct sock_fprog);
536-
# endif // SANITIZER_GLIBC
534+
#endif // SANITIZER_GLIBC
537535

538-
# if !SANITIZER_ANDROID && !SANITIZER_APPLE
536+
#if !SANITIZER_ANDROID && !SANITIZER_APPLE
539537
unsigned struct_sioc_sg_req_sz = sizeof(struct sioc_sg_req);
540538
unsigned struct_sioc_vif_req_sz = sizeof(struct sioc_vif_req);
541539
#endif

compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,8 +1050,7 @@ extern unsigned struct_serial_struct_sz;
10501050
extern unsigned struct_sockaddr_ax25_sz;
10511051
extern unsigned struct_unimapdesc_sz;
10521052
extern unsigned struct_unimapinit_sz;
1053-
extern unsigned struct_sock_fprog_sz;
1054-
# endif // SANITIZER_LINUX && !SANITIZER_ANDROID
1053+
#endif // SANITIZER_LINUX && !SANITIZER_ANDROID
10551054

10561055
extern const unsigned long __sanitizer_bufsiz;
10571056

compiler-rt/test/sanitizer_common/TestCases/Linux/prctl.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
#include <assert.h>
66
#include <errno.h>
7-
#include <linux/filter.h>
8-
#include <linux/seccomp.h>
97
#include <stdint.h>
108
#include <string.h>
119
#include <sys/mman.h>
@@ -80,13 +78,5 @@ int main() {
8078
}
8179
}
8280

83-
sock_filter f[] = {{.code = (BPF_LD | BPF_W | BPF_ABS),
84-
.k = (uint32_t)(SKF_AD_OFF | SKF_AD_CPU)},
85-
{.code = (BPF_RET | BPF_A), .k = 0}};
86-
sock_fprog pr = {.len = 2, .filter = f};
87-
88-
res = prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &pr);
89-
assert(res == -1);
90-
9181
return 0;
9282
}

0 commit comments

Comments
 (0)