From ccbef519e0c69cc19af2e56bd7ce307ca6daefee Mon Sep 17 00:00:00 2001 From: Dmitry Chagin Date: Thu, 31 Mar 2022 20:49:39 +0300 Subject: [PATCH] linux(4): wait4() returns ESRCH if pid is INT_MIN. Weird and undocumented patch was added to the Linux kernel in 2017, fixes wait403 LTP test. MFC after: 2 weeks (cherry picked from commit 9103c5582a2d271fa8f4df136ae511da572c660f) --- sys/compat/linux/linux_misc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index ea7dafec084..fa7d364681d 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -1054,6 +1054,10 @@ linux_wait4(struct thread *td, struct linux_wait4_args *args) LINUX_WCONTINUED | __WCLONE | __WNOTHREAD | __WALL)) return (EINVAL); + /* -INT_MIN is not defined. */ + if (args->pid == INT_MIN) + return (ESRCH); + options = 0; linux_to_bsd_waitopts(args->options, &options);