git: 390c9ea029fd - main - linux(4): Add AT_MINSIGSTKSZ to arm64 port

From: Dmitry Chagin <dchagin_at_FreeBSD.org>
Date: Sun, 15 May 2022 18:12:31 UTC
The branch main has been updated by dchagin:

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

commit 390c9ea029fdd3fb2ce61fc6b48617f0f7cd8754
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2022-05-15 18:12:03 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2022-05-15 18:12:03 +0000

    linux(4): Add AT_MINSIGSTKSZ to arm64 port
    
    MFC after:      2 weeks
---
 sys/arm64/linux/linux.h          | 5 +----
 sys/arm64/linux/linux_sigframe.h | 2 ++
 sys/arm64/linux/linux_sysvec.c   | 1 +
 sys/compat/linux/linux_misc.h    | 4 ++++
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/sys/arm64/linux/linux.h b/sys/arm64/linux/linux.h
index dafec928c7e4..bf6e092f3bf8 100644
--- a/sys/arm64/linux/linux.h
+++ b/sys/arm64/linux/linux.h
@@ -81,7 +81,7 @@ typedef struct {
 #define	l_fd_set	fd_set
 
 /* Miscellaneous */
-#define	LINUX_AT_COUNT		20
+#define	LINUX_AT_COUNT		21
 
 struct l___sysctl_args
 {
@@ -163,9 +163,6 @@ struct l_newstat {
 #define	LINUX_SIG_UNBLOCK	1
 #define	LINUX_SIG_SETMASK	2
 
-/* sigaltstack */
-#define	LINUX_MINSIGSTKSZ	5664		/* sigframe */
-
 typedef void	(*l_handler_t)(l_int);
 
 typedef struct {
diff --git a/sys/arm64/linux/linux_sigframe.h b/sys/arm64/linux/linux_sigframe.h
index d0d870e51375..3b125efc8781 100644
--- a/sys/arm64/linux/linux_sigframe.h
+++ b/sys/arm64/linux/linux_sigframe.h
@@ -81,4 +81,6 @@ struct l_sigframe {
 	ucontext_t	uc;
 };
 
+#define	LINUX_MINSIGSTKSZ	roundup(sizeof(struct l_sigframe), 16)
+
 #endif /* _ARM64_LINUX_SIGFRAME_H_ */
diff --git a/sys/arm64/linux/linux_sysvec.c b/sys/arm64/linux/linux_sysvec.c
index 461a00bf5b33..e82539b9c5b1 100644
--- a/sys/arm64/linux/linux_sysvec.c
+++ b/sys/arm64/linux/linux_sysvec.c
@@ -197,6 +197,7 @@ linux_copyout_auxargs(struct image_params *imgp, uintptr_t base)
 
 	issetugid = p->p_flag & P_SUGID ? 1 : 0;
 	AUXARGS_ENTRY(pos, LINUX_AT_SYSINFO_EHDR, linux_vdso_base);
+	AUXARGS_ENTRY(pos, LINUX_AT_MINSIGSTKSZ, LINUX_MINSIGSTKSZ);
 	AUXARGS_ENTRY(pos, LINUX_AT_HWCAP, *imgp->sysent->sv_hwcap);
 	AUXARGS_ENTRY(pos, AT_PAGESZ, args->pagesz);
 	AUXARGS_ENTRY(pos, LINUX_AT_CLKTCK, stclohz);
diff --git a/sys/compat/linux/linux_misc.h b/sys/compat/linux/linux_misc.h
index 0f134fc62e72..7a8073539e87 100644
--- a/sys/compat/linux/linux_misc.h
+++ b/sys/compat/linux/linux_misc.h
@@ -95,6 +95,10 @@
 
 #define	LINUX_AT_RANDOM_LEN	16	/* size of random bytes */
 
+#ifndef LINUX_AT_MINSIGSTKSZ
+#define	LINUX_AT_MINSIGSTKSZ	51	/* min stack size required by the kernel */
+#endif
+
 /* Linux sets the i387 to extended precision. */
 #if defined(__i386__) || defined(__amd64__)
 #define	__LINUX_NPXCW__		0x37f