giuseppe / easyseccomp

DSL language to write seccomp filters
GNU General Public License v2.0
35 stars 2 forks source link

some SECCOMP_RET_ values do not exist in older kernels #7

Closed pkolano closed 2 years ago

pkolano commented 2 years ago

Some of the definitions assumed in the code don't exist on older systems (e.g. kernel 3.10.0). Had to remove them from generator.c and sim/sim.c. Would be nice if they were only used when available...

$ make CC src/libeasyseccomp_a-libeasyseccomp_a-parser.o CC src/libeasyseccomp_a-libeasyseccomp_a-lexer.o CC src/libeasyseccomp_a-generator.o src/generator.c: In function 'generate_action': src/generator.c:385:36: error: 'SECCOMP_RET_USER_NOTIF' undeclared (first use in this function) emit_stmt (ctx, BPF_RET|BPF_K, SECCOMP_RET_USER_NOTIF); ^ src/generator.c:385:36: note: each undeclared identifier is reported only once for each function it appears in src/generator.c:387:36: error: 'SECCOMP_RET_LOG' undeclared (first use in this function) emit_stmt (ctx, BPF_RET|BPF_K, SECCOMP_RET_LOG); ^ src/generator.c:391:36: error: 'SECCOMP_RET_KILL_THREAD' undeclared (first use in this function) emit_stmt (ctx, BPF_RET|BPF_K, SECCOMP_RET_KILL_THREAD); ^ src/generator.c:393:36: error: 'SECCOMP_RET_KILL_PROCESS' undeclared (first use in this function) emit_stmt (ctx, BPF_RET|BPF_K, SECCOMP_RET_KILL_PROCESS); ^ src/generator.c: In function 'generate_condition_and_action': src/generator.c:795:9: warning: empty declaration [enabled by default] attribute ((fallthrough)); ^ make: *** [src/libeasyseccomp_a-generator.o] Error 1

make CC src/libeasyseccomp_a-generator.o src/generator.c: In function 'generate_condition_and_action': src/generator.c:795:9: warning: empty declaration [enabled by default] attribute ((fallthrough)); ^ CC src/libeasyseccomp_a-types.o CC src/syscall-versions/libeasyseccomp_a-syscall-versions.o AR libeasyseccomp.a CC src/main.o CCLD easyseccomp CC src/sim/sim.o In file included from src/sim/bpf.h:59:0, from src/sim/sim.c:31: src/sim/glue.h:11:0: warning: "__bounded" redefined [enabled by default]

define __bounded(args)

^ In file included from /usr/include/features.h:375:0, from /usr/include/sys/types.h:25, from /usr/include/sys/param.h:25, from src/sim/sim.c:19: /usr/include/sys/cdefs.h:134:0: note: this is the location of the previous definition

define __bounded / nothing /

^ src/sim/sim.c: In function 'get_seccomp_action': src/sim/sim.c:167:17: error: 'SECCOMP_RET_USER_NOTIF' undeclared (first use in this function) if (action == SECCOMP_RET_USER_NOTIF) ^ src/sim/sim.c:167:17: note: each undeclared identifier is reported only once for each function it appears in src/sim/sim.c:171:17: error: 'SECCOMP_RET_KILL_THREAD' undeclared (first use in this function) if (action == SECCOMP_RET_KILL_THREAD) ^ src/sim/sim.c:173:17: error: 'SECCOMP_RET_KILL_PROCESS' undeclared (first use in this function) if (action == SECCOMP_RET_KILL_PROCESS) ^ make: *** [src/sim/sim.o] Error 1

giuseppe commented 2 years ago

pushed b6cd479104a4cc2da52cadf3d1bfff487d5bb040 to address this issue