git: 8dc4c073cdd1 - stable/13 - linux(4): Export the AT_MINSIGSTKSZ depending on the process osreldata

From: Dmitry Chagin <dchagin_at_FreeBSD.org>
Date: Thu, 29 Jun 2023 08:20:08 UTC
The branch stable/13 has been updated by dchagin:

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

commit 8dc4c073cdd1e2452dd725bc324977038366f3e6
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2023-04-22 19:17:52 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2023-06-29 08:15:27 +0000

    linux(4): Export the AT_MINSIGSTKSZ depending on the process osreldata
    
    AT_MINSIGSTKSZ has appeared in the 5.13.0 Linux kernel first time.
    
    Differential Revision:  https://reviews.freebsd.org/D39648
    MFC after:              1 month
    
    (cherry picked from commit b7a6bcdd1319b4e5da0bfc5e7790cbf26efe9892)
---
 sys/compat/linux/linux_elf.c | 3 ++-
 sys/compat/linux/linux_mib.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/compat/linux/linux_elf.c b/sys/compat/linux/linux_elf.c
index a1a04e23d43d..9db599d83bac 100644
--- a/sys/compat/linux/linux_elf.c
+++ b/sys/compat/linux/linux_elf.c
@@ -533,7 +533,8 @@ __linuxN(copyout_auxargs)(struct image_params *imgp, uintptr_t base)
 		AUXARGS_ENTRY(pos, LINUX_AT_EXECFN, PTROUT(imgp->execpathp));
 	if (args->execfd != -1)
 		AUXARGS_ENTRY(pos, AT_EXECFD, args->execfd);
-	AUXARGS_ENTRY(pos, LINUX_AT_MINSIGSTKSZ, LINUX_MINSIGSTKSZ);
+	if (p->p_osrel >= LINUX_KERNVER_5013000 || p->p_osrel == 0)
+		AUXARGS_ENTRY(pos, LINUX_AT_MINSIGSTKSZ, LINUX_MINSIGSTKSZ);
 	AUXARGS_ENTRY(pos, AT_NULL, 0);
 
 	free(imgp->auxargs, M_TEMP);
diff --git a/sys/compat/linux/linux_mib.h b/sys/compat/linux/linux_mib.h
index 05068bbf1029..ae650934273e 100644
--- a/sys/compat/linux/linux_mib.h
+++ b/sys/compat/linux/linux_mib.h
@@ -62,6 +62,7 @@ int	linux_kernver(struct thread *td);
 #define	LINUX_KERNVER_2006030	LINUX_KERNVER(2,6,30)
 #define	LINUX_KERNVER_2006039	LINUX_KERNVER(2,6,39)
 #define	LINUX_KERNVER_5004000	LINUX_KERNVER(5,4,0)
+#define	LINUX_KERNVER_5013000	LINUX_KERNVER(5,13,0)
 
 #define	linux_use54(t)		(linux_kernver(t) >= LINUX_KERNVER_5004000)