On 05/21/2018 09:01 PM, Amit Malav wrote:

Hi Pautl.
Thanks for the swift response.
But i'm getting following error while compiling above code.

#gcc test-seccomp.c -l seccomp -o seccomp

In file included from test-seccomp.c:6:0:
test-seccomp.c: In function ‘main’:
test-seccomp.c:37:51: error: ‘__NR_argv’ undeclared (first use in this function)
              seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(argv[iterator]), 
0);
                                                    ^
test-seccomp.c:37:51: note: each undeclared identifier is reported only once 
for each function it appears in

Am i doing something wrong here? Can this be achieved differently?

I admit I didn't look through the entire thread, so my apologies
up front.

SCMP_SYS() is a helper macro that converts syscall names (read,
write, open, mmap, etc.) into their respective numbers for that
particular architecture (0, 1, 2, 9, etc. for the aforementioned
list on x86_64).

    /**
     * Convert a syscall name into the associated syscall number
     * @param x the syscall name
     */
    #define SCMP_SYS(x) (__NR_##x)

Passing argv[] into SCMP_SYS will be stringified into __NR_argv[]
which is not a valid syscall number.

Regards.

Tom

--
You received this message because you are subscribed to the Google Groups 
"libseccomp" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to