Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Apr 2020 20:26:41 +0000 (UTC)
From:      Brooks Davis <brooks@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r359990 - head/lib/libc/gen
Message-ID:  <202004152026.03FKQf3B095733@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brooks
Date: Wed Apr 15 20:26:41 2020
New Revision: 359990
URL: https://svnweb.freebsd.org/changeset/base/359990

Log:
  Support AT_PS_STRINGS in _elf_aux_info().
  
  This will be used by setproctitle().
  
  Reviewed by:	kib
  Obtained from:	CheriBSD
  Sponsored by:	DARPA
  Differential Revision:	https://reviews.freebsd.org/D24407

Modified:
  head/lib/libc/gen/auxv.c

Modified: head/lib/libc/gen/auxv.c
==============================================================================
--- head/lib/libc/gen/auxv.c	Wed Apr 15 20:25:38 2020	(r359989)
+++ head/lib/libc/gen/auxv.c	Wed Apr 15 20:26:41 2020	(r359990)
@@ -70,7 +70,7 @@ static pthread_once_t aux_once = PTHREAD_ONCE_INIT;
 static int pagesize, osreldate, canary_len, ncpus, pagesizes_len, bsdflags;
 static int hwcap_present, hwcap2_present;
 static char *canary, *pagesizes, *execpath;
-static void *timekeep;
+static void *ps_strings, *timekeep;
 static u_long hwcap, hwcap2;
 
 #ifdef __powerpc__
@@ -135,6 +135,10 @@ init_aux(void)
 		case AT_TIMEKEEP:
 			timekeep = aux->a_un.a_ptr;
 			break;
+
+		case AT_PS_STRINGS:
+			ps_strings = aux->a_un.a_ptr;
+			break;
 #ifdef __powerpc__
 		/*
 		 * Since AT_STACKPROT is always set, and the common
@@ -334,6 +338,16 @@ _elf_aux_info(int aux, void *buf, int buflen)
 		if (buflen == sizeof(int)) {
 			*(int *)buf = bsdflags;
 			res = 0;
+		} else
+			res = EINVAL;
+		break;
+	case AT_PS_STRINGS:
+		if (buflen == sizeof(void *)) {
+			if (ps_strings != NULL) {
+				*(void **)buf = ps_strings;
+				res = 0;
+			} else
+				res = ENOENT;
 		} else
 			res = EINVAL;
 		break;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202004152026.03FKQf3B095733>