Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102114887
D28284.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D28284.diff
View Options
diff --git a/usr.bin/elfctl/elfctl.1 b/usr.bin/elfctl/elfctl.1
--- a/usr.bin/elfctl/elfctl.1
+++ b/usr.bin/elfctl/elfctl.1
@@ -26,7 +26,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd January 12, 2021
+.Dd January 22, 2021
.Dt ELFCTL 1
.Os
.Sh NAME
@@ -64,7 +64,8 @@
to turn off the features,
.Dq Li =
to only turn on the given features.
-A comma separated list of feature names follows the operation.
+A comma separated list of feature names or numeric values follows the
+operation.
.El
.Pp
If
@@ -86,6 +87,16 @@
elfctl file
elfctl -e +aslr file
.Ed
+.Pp
+Features may be specified as numerical values:
+.Bd -literal -offset -indent
+elfctl -e =0x0001,0x0004 file
+.Ed
+.Pp
+Features may also be specified as a single combined value:
+.Bd -literal -offset -indent
+elfctl -e =0x5 file
+.Ed
.Sh HISTORY
.Nm
first appeared in
diff --git a/usr.bin/elfctl/elfctl.c b/usr.bin/elfctl/elfctl.c
--- a/usr.bin/elfctl/elfctl.c
+++ b/usr.bin/elfctl/elfctl.c
@@ -33,7 +33,9 @@
#include <sys/endian.h>
#include <sys/stat.h>
+#include <ctype.h>
#include <err.h>
+#include <errno.h>
#include <fcntl.h>
#include <gelf.h>
#include <getopt.h>
@@ -245,9 +247,26 @@
}
}
if (i == len) {
- warnx("%s is not a valid feature", feature);
- if (!iflag)
- return (false);
+ if (isdigit(feature[0])) {
+ char *eptr;
+ long val;
+
+ errno = 0;
+ val = strtol(feature, &eptr, 0);
+ if (eptr == feature || *eptr != '\0')
+ errno = EINVAL;
+ else if (val > UINT_MAX)
+ errno = ERANGE;
+ if (errno != 0) {
+ warn("%s invalid", feature);
+ return (false);
+ }
+ input != val;
+ } else {
+ warnx("%s is not a valid feature", feature);
+ if (!iflag)
+ return (false);
+ }
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 8, 7:26 PM (21 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14541280
Default Alt Text
D28284.diff (1 KB)
Attached To
Mode
D28284: elfctl: allow features to be specified by value
Attached
Detach File
Event Timeline
Log In to Comment