Page MenuHomeFreeBSD

D22353.id64288.diff
No OneTemporary

D22353.id64288.diff

Index: head/lib/libc/gen/auxv.3
===================================================================
--- head/lib/libc/gen/auxv.3
+++ head/lib/libc/gen/auxv.3
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 25, 2019
+.Dd November 13, 2019
.Dt ELF_AUX_INFO 3
.Os
.Sh NAME
@@ -48,6 +48,10 @@
.Bl -tag -width AT_OSRELDATE
.It AT_CANARY
The canary value for SSP.
+.It AT_EXECPATH
+The path of executed program.
+This will not be present if the process was initialized by
+.Xr fexecve 2 .
.It AT_HWCAP
CPU / hardware feature flags.
.It AT_HWCAP2
Index: head/lib/libc/gen/auxv.c
===================================================================
--- head/lib/libc/gen/auxv.c
+++ head/lib/libc/gen/auxv.c
@@ -69,7 +69,7 @@
static pthread_once_t aux_once = PTHREAD_ONCE_INIT;
static int pagesize, osreldate, canary_len, ncpus, pagesizes_len;
static int hwcap_present, hwcap2_present;
-static char *canary, *pagesizes;
+static char *canary, *pagesizes, *execpath;
static void *timekeep;
static u_long hwcap, hwcap2;
@@ -88,6 +88,10 @@
canary_len = aux->a_un.a_val;
break;
+ case AT_EXECPATH:
+ execpath = (char *)(aux->a_un.a_ptr);
+ break;
+
case AT_HWCAP:
hwcap_present = 1;
hwcap = (u_long)(aux->a_un.a_val);
@@ -146,6 +150,18 @@
res = 0;
} else
res = ENOENT;
+ break;
+ case AT_EXECPATH:
+ if (execpath == NULL)
+ res = ENOENT;
+ else if (buf == NULL)
+ res = EINVAL;
+ else {
+ if (strlcpy(buf, execpath, buflen) >= buflen)
+ res = EINVAL;
+ else
+ res = 0;
+ }
break;
case AT_HWCAP:
if (hwcap_present && buflen == sizeof(u_long)) {
Index: head/sys/sys/param.h
===================================================================
--- head/sys/sys/param.h
+++ head/sys/sys/param.h
@@ -60,7 +60,7 @@
* in the range 5 to 9.
*/
#undef __FreeBSD_version
-#define __FreeBSD_version 1300056 /* Master, propagated to newvers */
+#define __FreeBSD_version 1300057 /* Master, propagated to newvers */
/*
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,

File Metadata

Mime Type
text/plain
Expires
Tue, Feb 11, 10:58 PM (15 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16602590
Default Alt Text
D22353.id64288.diff (2 KB)

Event Timeline