aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Chagin <dchagin@FreeBSD.org>2023-04-22 19:17:17 +0000
committerDmitry Chagin <dchagin@FreeBSD.org>2023-04-22 19:17:17 +0000
commit40c36c4674eb9602709cf9d0483a4f34ad9753f6 (patch)
treec89b450133cc0856a8420b081cbe975b36fb8022
parent56c5230afdcf2b317d904009abe577e91b382542 (diff)
downloadsrc-40c36c4674eb9602709cf9d0483a4f34ad9753f6.tar.gz
src-40c36c4674eb9602709cf9d0483a4f34ad9753f6.zip
linux(4): Export the AT_RANDOM depending on the process osreldata
AT_RANDOM has appeared in the 2.6.30 Linux kernel first time. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D39646 MFC after: 1 month
-rw-r--r--sys/compat/linux/linux_elf.c3
-rw-r--r--sys/compat/linux/linux_mib.h1
2 files changed, 3 insertions, 1 deletions
diff --git a/sys/compat/linux/linux_elf.c b/sys/compat/linux/linux_elf.c
index 9b2c38aba444..d0e547c1b882 100644
--- a/sys/compat/linux/linux_elf.c
+++ b/sys/compat/linux/linux_elf.c
@@ -526,7 +526,8 @@ __linuxN(copyout_auxargs)(struct image_params *imgp, uintptr_t base)
AUXARGS_ENTRY(pos, AT_GID, imgp->proc->p_ucred->cr_rgid);
AUXARGS_ENTRY(pos, AT_EGID, imgp->proc->p_ucred->cr_svgid);
AUXARGS_ENTRY(pos, LINUX_AT_SECURE, issetugid);
- AUXARGS_ENTRY_PTR(pos, LINUX_AT_RANDOM, imgp->canary);
+ if (p->p_osrel >= LINUX_KERNVER_2006030 || p->p_osrel == 0)
+ AUXARGS_ENTRY_PTR(pos, LINUX_AT_RANDOM, imgp->canary);
if (imgp->execpathp != 0)
AUXARGS_ENTRY(pos, LINUX_AT_EXECFN, PTROUT(imgp->execpathp));
if (args->execfd != -1)
diff --git a/sys/compat/linux/linux_mib.h b/sys/compat/linux/linux_mib.h
index 615439b4d107..b1d5a0981a7d 100644
--- a/sys/compat/linux/linux_mib.h
+++ b/sys/compat/linux/linux_mib.h
@@ -58,6 +58,7 @@ int linux_kernver(struct thread *td);
#define LINUX_VERSION_STR LINUX_XKERNVERSTR(LINUX_KVERSION.LINUX_KPATCHLEVEL.LINUX_KSUBLEVEL)
#define LINUX_KERNVER_2004000 LINUX_KERNVER(2,4,0)
+#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)