FreeBSD Bugzilla – Attachment 245855 Details for
Bug 274705
unreasonably large stack reservation for armv7 processes on arm64
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
arm64: improve UVA layout for 32bit processes
1.patch (text/plain), 3.22 KB, created by
Konstantin Belousov
on 2023-10-25 01:40:17 UTC
(
hide
)
Description:
arm64: improve UVA layout for 32bit processes
Filename:
MIME Type:
Creator:
Konstantin Belousov
Created:
2023-10-25 01:40:17 UTC
Size:
3.22 KB
patch
obsolete
>commit 4b674f0031fbeb983422615a4d1d5773c0f54fc9 >Author: Konstantin Belousov <kib@FreeBSD.org> >Date: Wed Oct 25 04:03:09 2023 +0300 > > arm64: improve UVA layout for 32bit processes > > Add compat.armv7 tunables for maxssiz, maxdsiz, and maxvmem. > Set the default values same as for amd64. > Fix freebsd32 sysentvec on arm64 to provide sv_maxssiz, and sv_fixlimit. > >diff --git a/sys/arm64/arm64/elf32_machdep.c b/sys/arm64/arm64/elf32_machdep.c >index 4161f9d44ae7..ddaa54329e7f 100644 >--- a/sys/arm64/arm64/elf32_machdep.c >+++ b/sys/arm64/arm64/elf32_machdep.c >@@ -61,6 +61,9 @@ > #define FREEBSD32_MAXUSER ((1ul << 32) - PAGE_SIZE) > #define FREEBSD32_SHAREDPAGE (FREEBSD32_MAXUSER - PAGE_SIZE) > #define FREEBSD32_USRSTACK FREEBSD32_SHAREDPAGE >+#define AARCH32_MAXDSIZ (512*1024*1024) >+#define AARCH32_MAXSSIZ (64*1024*1024) >+#define AARCH32_MAXVMEM 0 > > extern const char *freebsd32_syscallnames[]; > >@@ -74,12 +77,26 @@ static void freebsd32_set_syscall_retval(struct thread *, int); > > static bool elf32_arm_abi_supported(struct image_params *, int32_t *, > uint32_t *); >+static void elf32_fixlimit(struct rlimit *rl, int which); > > extern void freebsd32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask); > > u_long __read_frequently elf32_hwcap; > u_long __read_frequently elf32_hwcap2; > >+static SYSCTL_NODE(_compat, OID_AUTO, aarch32, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, >+ "aarch32 mode"); >+ >+static u_long aarch32_maxdsiz = AARCH32_MAXDSIZ; >+SYSCTL_ULONG(_compat_aarch32, OID_AUTO, maxdsiz, CTLFLAG_RWTUN, >+ &aarch32_maxdsiz, 0, ""); >+u_long aarch32_maxssiz = AARCH32_MAXSSIZ; >+SYSCTL_ULONG(_compat_aarch32, OID_AUTO, maxssiz, CTLFLAG_RWTUN, >+ &aarch32_maxssiz, 0, ""); >+static u_long aarch32_maxvmem = AARCH32_MAXVMEM; >+SYSCTL_ULONG(_compat_aarch32, OID_AUTO, maxvmem, CTLFLAG_RWTUN, >+ &aarch32_maxvmem, 0, ""); >+ > static struct sysentvec elf32_freebsd_sysvec = { > .sv_size = SYS_MAXSYSCALL, > .sv_table = freebsd32_sysent, >@@ -102,8 +119,8 @@ static struct sysentvec elf32_freebsd_sysvec = { > .sv_copyout_auxargs = elf32_freebsd_copyout_auxargs, > .sv_copyout_strings = freebsd32_copyout_strings, > .sv_setregs = freebsd32_setregs, >- .sv_fixlimit = NULL, // XXX >- .sv_maxssiz = NULL, >+ .sv_fixlimit = elf32_fixlimit, >+ .sv_maxssiz = &aarch32_maxssiz, > .sv_flags = SV_ABI_FREEBSD | SV_ILP32 | SV_SHP | SV_TIMEKEEP | > SV_RNG_SEED_VER | SV_SIGSYS, > .sv_set_syscall_retval = freebsd32_set_syscall_retval, >@@ -284,3 +301,35 @@ void > elf32_dump_thread(struct thread *td, void *dst, size_t *off) > { > } >+ >+static void >+elf32_fixlimit(struct rlimit *rl, int which) >+{ >+ >+ switch (which) { >+ case RLIMIT_DATA: >+ if (aarch32_maxdsiz != 0) { >+ if (rl->rlim_cur > aarch32_maxdsiz) >+ rl->rlim_cur = aarch32_maxdsiz; >+ if (rl->rlim_max > aarch32_maxdsiz) >+ rl->rlim_max = aarch32_maxdsiz; >+ } >+ break; >+ case RLIMIT_STACK: >+ if (aarch32_maxssiz != 0) { >+ if (rl->rlim_cur > aarch32_maxssiz) >+ rl->rlim_cur = aarch32_maxssiz; >+ if (rl->rlim_max > aarch32_maxssiz) >+ rl->rlim_max = aarch32_maxssiz; >+ } >+ break; >+ case RLIMIT_VMEM: >+ if (aarch32_maxvmem != 0) { >+ if (rl->rlim_cur > aarch32_maxvmem) >+ rl->rlim_cur = aarch32_maxvmem; >+ if (rl->rlim_max > aarch32_maxvmem) >+ rl->rlim_max = aarch32_maxvmem; >+ } >+ break; >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 274705
:
245854
| 245855