git: 9103c5582a2d - main - linux(4): wait4() returns ESRCH if pid is INT_MIN.

From: Dmitry Chagin <dchagin_at_FreeBSD.org>
Date: Thu, 31 Mar 2022 17:50:43 UTC
The branch main has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=9103c5582a2d271fa8f4df136ae511da572c660f

commit 9103c5582a2d271fa8f4df136ae511da572c660f
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2022-03-31 17:49:39 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2022-03-31 17:49:39 +0000

    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
---
 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 a4e5f913d03b..f4ea92941720 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);