changeset 13856:0a80ec57bcc9

3261 linker should ignore unknown hardware capabilities Reviewed by: Joshua M. Clulow <josh@sysmgr.org> Reviewed by: Gary Mills <gary_mills@fastmail.fm> Reviewed by: Eric Schrock <eric.schrock@delphix.com> Approved by: Gordon Ross <gwr@nexenta.com>
author Richard Lowe <richlowe@richlowe.net>
date Fri, 05 Oct 2012 17:35:59 -0400
parents 8fba982bba7d
children a4e0f94e01f4
files usr/src/cmd/sgs/packages/common/SUNWonld-README usr/src/cmd/sgs/rtld/common/cap.c usr/src/cmd/sgs/rtld/common/rtld.msg
diffstat 3 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/sgs/packages/common/SUNWonld-README	Fri Oct 05 17:07:38 2012 -0400
+++ b/usr/src/cmd/sgs/packages/common/SUNWonld-README	Fri Oct 05 17:35:59 2012 -0400
@@ -1638,3 +1638,4 @@
 3228	Want -zassert-deflib for ld
 3230	ld.so.1 should check default paths for DT_DEPAUDIT
 3260	linker is insufficiently careful with strtok
+3261	linker should ignore unknown hardware capabilities
--- a/usr/src/cmd/sgs/rtld/common/cap.c	Fri Oct 05 17:07:38 2012 -0400
+++ b/usr/src/cmd/sgs/rtld/common/cap.c	Fri Oct 05 17:35:59 2012 -0400
@@ -922,6 +922,8 @@
 		 * Invalid indexes are ignored.
 		 */
 		if (val == 0) {
+			char *end;
+
 			if ((*ptr == '[') && (*(ptr + 2) == ']')) {
 				if (*(ptr + 1) == '1') {
 					ndx = tag;
@@ -942,9 +944,21 @@
 				ndx = tag;
 
 			errno = 0;
-			if (((val = strtol(ptr, NULL, 16)) == 0) && errno)
+			if (((val = strtol(ptr, &end, 16)) == 0) && errno)
 				continue;
+
+			/*
+			 * If the value wasn't an entirely valid hexadecimal
+			 * integer, assume it was intended as a capability
+			 * name and skip it.
+			 */
+			if (*end != '\0') {
+				eprintf(NULL, ERR_WARNING,
+				    MSG_INTL(MSG_CAP_IGN_UNKCAP), ptr);
+				continue;
+			}
 		}
+
 		cap_settings[ndx - 1].cs_val[mode] |= val;
 		cap_settings[ndx - 1].cs_set[mode]++;
 
--- a/usr/src/cmd/sgs/rtld/common/rtld.msg	Fri Oct 05 17:07:38 2012 -0400
+++ b/usr/src/cmd/sgs/rtld/common/rtld.msg	Fri Oct 05 17:35:59 2012 -0400
@@ -300,6 +300,7 @@
 @ MSG_STR_ONE		"1"
 
 @ MSG_CAP_DELIMIT	","
+@ MSG_CAP_IGN_UNKCAP	"ignoring unknown capability: %s"
 
 @ MSG_SUNW_OST_SGS	"SUNW_OST_SGS"
 @ MSG_SUNW_OST_OSLIB	"SUNW_OST_OSLIB"