diff options
author | Paul Moore <pmoore@redhat.com> | 2012-04-10 17:38:57 -0400 |
---|---|---|
committer | Paul Moore <pmoore@redhat.com> | 2012-04-11 10:51:53 -0400 |
commit | d3f6e644dca2a405ce60db994beb4502aa184a8f (patch) | |
tree | 0abbd9fde7754d9ffcbfd5c093db002f55b7b300 | |
parent | 2506b35ade4165bc4e198d5d8e29a429e7725d18 (diff) | |
download | libseccomp-d3f6e644dca2a405ce60db994beb4502aa184a8f.tar.gz |
bpf_sim: fix some problems with syscall arguments and 64bit architectures
Reported-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
Signed-off-by: Paul Moore <pmoore@redhat.com>
-rw-r--r-- | tools/bpf.h | 5 | ||||
-rw-r--r-- | tools/bpf_sim.c | 12 |
2 files changed, 8 insertions, 9 deletions
diff --git a/tools/bpf.h b/tools/bpf.h index 49c24e6..4fb4c4f 100644 --- a/tools/bpf.h +++ b/tools/bpf.h @@ -37,13 +37,12 @@ */ #define BPF_SYS_ARG_MAX 6 struct seccomp_data { - int nr; + int32_t nr; uint32_t arch; uint64_t instruction_pointer; uint64_t args[BPF_SYS_ARG_MAX]; }; -#define BPF_SYSCALL_MAX \ - (offsetof(struct seccomp_data, args[BPF_SYS_ARG_MAX])) +#define BPF_SYSCALL_MAX (sizeof(struct seccomp_data)) /** * BPF instruction format diff --git a/tools/bpf_sim.c b/tools/bpf_sim.c index d55247a..6bd1f20 100644 --- a/tools/bpf_sim.c +++ b/tools/bpf_sim.c @@ -258,22 +258,22 @@ int main(int argc, char *argv[]) opt_verbose = 1; break; case '0': - sys_data.args[0] = strtol(optarg, NULL, 0); + sys_data.args[0] = strtoull(optarg, NULL, 0); break; case '1': - sys_data.args[1] = strtol(optarg, NULL, 0); + sys_data.args[1] = strtoull(optarg, NULL, 0); break; case '2': - sys_data.args[2] = strtol(optarg, NULL, 0); + sys_data.args[2] = strtoull(optarg, NULL, 0); break; case '3': - sys_data.args[3] = strtol(optarg, NULL, 0); + sys_data.args[3] = strtoull(optarg, NULL, 0); break; case '4': - sys_data.args[4] = strtol(optarg, NULL, 0); + sys_data.args[4] = strtoull(optarg, NULL, 0); break; case '5': - sys_data.args[5] = strtol(optarg, NULL, 0); + sys_data.args[5] = strtoull(optarg, NULL, 0); break; case 'h': default: |