Skip to contentSkip to conversation

syscalls/prctl04: Allow __NR_waitid in the syscall filter

PATCH In review Randolph Lin 2 participants 3 messages Jun 27, 2023 – Jun 29, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 syscalls/prctl04: Allow __NR_waitid in the syscall filter

From: Randolph <[email protected]>

The __NR_wait4 syscall is not available in y2038 safe 32-bit systems, waitid should be used instead. In the 32ABI system, the __NR_waitid must be allowed as well in the filter.

refer:
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9b2cf9482a9397c4711c9e7f42f8d718b6306bdc
linux: Use waitid on wait4 if __NR_wait4 is not defined

---
 testcases/kernel/syscalls/prctl/prctl04.c | 1 +
 1 file changed, 1 insertion(+)
testcases/kernel/syscalls/prctl/prctl04.c +1 -0
index f6e1f0fea..8b135d611 100644
@@ -45,6 +45,7 @@
 static const struct sock_filter  strict_filter[] = {
 	BPF_STMT(BPF_LD | BPF_W | BPF_ABS, (offsetof(struct seccomp_data, nr))),
 
+	BPF_JUMP(BPF_JMP | BPF_JEQ, __NR_waitid, 7, 0),
 	BPF_JUMP(BPF_JMP | BPF_JEQ, __NR_rt_sigprocmask, 6, 0),
 	BPF_JUMP(BPF_JMP | BPF_JEQ, __NR_close, 5, 0),
 	BPF_JUMP(BPF_JMP | BPF_JEQ, __NR_exit,  4, 0),
Signature · 5 lines
2.34.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Acked-by on v1 1/1
#1 lore raw

Hi Randolph,

Quoted 5 lines

From: Randolph <[email protected]>

The __NR_wait4 syscall is not available in y2038 safe 32-bit systems, waitid should be used instead. In the 32ABI system, the __NR_waitid must be allowed as well in the filter.

LGTM, thanks!

Kind regards,
Petr

Quoted 22 lines

refer:
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9b2cf9482a9397c4711c9e7f42f8d718b6306bdc
linux: Use waitid on wait4 if __NR_wait4 is not defined

---
 testcases/kernel/syscalls/prctl/prctl04.c | 1 +
 1 file changed, 1 insertion(+)
testcases/kernel/syscalls/prctl/prctl04.c +1 -0
index f6e1f0fea..8b135d611 100644
@@ -45,6 +45,7 @@
 static const struct sock_filter  strict_filter[] = {
 	BPF_STMT(BPF_LD | BPF_W | BPF_ABS, (offsetof(struct seccomp_data, nr))),
 
+	BPF_JUMP(BPF_JMP | BPF_JEQ, __NR_waitid, 7, 0),
 	BPF_JUMP(BPF_JMP | BPF_JEQ, __NR_rt_sigprocmask, 6, 0),
 	BPF_JUMP(BPF_JMP | BPF_JEQ, __NR_close, 5, 0),
 	BPF_JUMP(BPF_JMP | BPF_JEQ, __NR_exit,  4, 0),
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw

Hi Randolph, all,

thanks, merged.

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp