Skip to contentSkip to conversation

add parameter to explicitly select 32 or 64 bit variant of syscalls

PATCH In review Ildar Muslukhov 2 participants 2 messages Sep 13, 2013 – Sep 16, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add parameter to explicitly select 32 or 64 bit variant of syscalls

This patch enables explicit selection of 32 or 64 bit version of syscall(s) via parameter.

---
 README           |  4 +++-
 include/params.h |  4 ++++
 params.c         | 22 ++++++++++++++++--
 tables.c         | 71 
+++++++++++++++++++++++++++++++++++++++++++++++++++-----
 4 files changed, 92 insertions(+), 9 deletions(-)
README +0 -0
index 3999c42..05a1ec3 100644
@@ -100,7 +100,9 @@ tmp directory. (Handy for cleaning up any garbage named files; just rm -rf tmp a
          what maps got set up etc. Does make things go considerably 

faster however,
as it no longer fsync()'s after every syscall

---ioctls/-I will dump all available ioctls.
+ --ioctls/-I will dump all available ioctls.
+
+ --arch/-a Explicit selection of 32 or 64 bit variant of system calls.

#######################################################################

include/params.h +4 -0
index 6fe7d29..53776bd 100644
@@ -7,6 +7,10 @@
 void parse_args(int argc, char *argv[]);
 
 extern bool debug;
+
+extern bool do_32_arch;
+extern bool do_64_arch;
+
 extern bool do_specific_syscall;
 extern bool do_exclude_syscall;
 extern unsigned int specific_proto;
params.c +3 -0
index e266c18..3c0ae0a 100644
@@ -17,6 +17,9 @@ bool debug = FALSE;
 bool do_specific_syscall = FALSE;
 bool do_exclude_syscall = FALSE;
 
+bool do_32_arch = TRUE;
+bool do_64_arch = TRUE;
+
 unsigned int specific_proto = 0;
 unsigned int user_specified_children = 0;
 
@@ -60,8 +63,9 @@ static void usage(void)
 	fprintf(stderr, " --syslog,-S: log important info to syslog. (useful 

if syslog is remote)\n");
fprintf(stderr, " --verbose,-v: increase output verbosity.\n"); fprintf(stderr, " --victims,-V: path to victim files.\n");
+ fprintf(stderr, " --arch, -a: selects syscalls for the specified architecture (32 or 64). Both by default.");
fprintf(stderr, "\n");
- fprintf(stderr, " -c#: target specific syscall (takes syscall name as parameter).\n");
+ fprintf(stderr, " -c#,@: target specific syscall (takes syscall name as parameter and @ as architecture. No @ defaults to both archs.).\n");
fprintf(stderr, " -N#: do # syscalls then exit.\n"); fprintf(stderr, " -p: pause after syscall.\n"); fprintf(stderr, " -s#: use # as random seed.\n");
@@ -86,6 +90,7 @@ static const struct option longopts[] = {
{ "syslog", no_argument, NULL, 'S' },
{ "victims", required_argument, NULL, 'V' },
{ "verbose", no_argument, NULL, 'v' },
+ { "arch", required_argument, NULL, 'a' },
{ NULL, 0, NULL, 0 } };

@@ -93,7 +98,7 @@ void parse_args(int argc, char *argv[])
{
int opt;

- while ((opt = getopt_long(argc, argv, "c:C:dDg:hIl:LN:mnP:pqr:s:SV:vx:", longopts, NULL)) != -1) {
+ while ((opt = getopt_long(argc, argv, "a:c:C:dDg:hIl:LN:mnP:pqr:s:SV:vx:", longopts, NULL)) != -1) {
switch (opt) {
default:
if (opt == '?')
@@ -111,6 +116,19 @@ void parse_args(int argc, char *argv[])
toggle_syscall(optarg, TRUE); break;

+ case 'a':
+ /* One of the architectures selected*/
+ do_32_arch = FALSE;
+ do_64_arch = FALSE;
+ if (strcmp(optarg, "64") == 0)
+ do_64_arch = TRUE;
+ else if (strcmp(optarg, "32") == 0)
+ do_32_arch = TRUE;
+ else
+ exit(EXIT_FAILURE);
+
+ break;
+
case 'C':
user_specified_children = strtoll(optarg, NULL, 10); break;

tables.c +65 -6

114 lines not on this page · raw message

Signature · 1 line
1.8.4
#1 lore raw
Quoted 2 lines · Ildar Muslukhov

This patch enables explicit selection of 32 or 64 bit version of syscall(s) via parameter.

This version gets the tab/spacing right, but is word-wrapped..

Quoted 16 lines
(quoted diff) +2 -1
@@ -60,8 +63,9 @@ static void usage(void)
  	fprintf(stderr, " --syslog,-S: log important info to syslog. (useful 
 if syslog is remote)\n");
  	fprintf(stderr, " --verbose,-v: increase output verbosity.\n");
  	fprintf(stderr, " --victims,-V: path to victim files.\n");
+	fprintf(stderr, " --arch, -a: selects syscalls for the specified 
 architecture (32 or 64). Both by default.");
  	fprintf(stderr, "\n");
-	fprintf(stderr, " -c#: target specific syscall (takes syscall name as 
 parameter).\n");
+	fprintf(stderr, " -c#,@: target specific syscall (takes syscall name 

as parameter and @ as architecture. No @ defaults to both archs.).\n");
fprintf(stderr, " -N#: do # syscalls then exit.\n"); fprintf(stderr, " -p: pause after syscall.\n"); fprintf(stderr, " -s#: use # as random seed.\n");

Review static const struct option longopts[] = { · line 94

Quoted 5 lines
(quoted diff) +1 -0
@@ -86,6 +90,7 @@ static const struct option longopts[] = {
  	{ "syslog", no_argument, NULL, 'S' },
  	{ "victims", required_argument, NULL, 'V' },
  	{ "verbose", no_argument, NULL, 'v' },
+	{ "arch", required_argument, NULL, 'a' },
  	{ NULL, 0, NULL, 0 } };

So I can't apply this.

Dave