git: ccbef519e0c6 - stable/13 - linux(4): wait4() returns ESRCH if pid is INT_MIN.

From: Dmitry Chagin <dchagin_at_FreeBSD.org>
Date: Fri, 17 Jun 2022 19:38:51 UTC
The branch stable/13 has been updated by dchagin:

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

commit ccbef519e0c69cc19af2e56bd7ce307ca6daefee
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2022-03-31 17:49:39 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2022-06-17 19:33:46 +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
    
    (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 ea7dafec0849..fa7d364681dc 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);