Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFE: improve the internal syscall tables (gperf,CSV) #223

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ addons:
- valgrind
- clang
- lcov
- gperf

env:
global:
Expand Down
5 changes: 5 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ AC_DEFINE_UNQUOTED([ENABLE_PYTHON],
[$(test "$enable_python" = yes && echo 1 || echo 0)],
[Python bindings build flag.])

AC_CHECK_TOOL(GPERF, gperf)
if test -z "$GPERF"; then
AC_MSG_ERROR([please install gperf])
fi

dnl ####
dnl coverity checks
dnl ####
Expand Down
7 changes: 7 additions & 0 deletions include/seccomp-syscalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@
#define __PNR_utimensat_time64 -10240
#define __PNR_ppoll -10241
#define __PNR_renameat -10242
#define __PNR_riscv_flush_icache -10243

/*
* libseccomp syscall definitions
Expand Down Expand Up @@ -1507,6 +1508,12 @@

#define __SNR_restart_syscall __NR_restart_syscall

#ifdef __NR_riscv_flush_icache
#define __SNR_riscv_flush_icache __NR_riscv_flush_icache
#else
#define __SNR_riscv_flush_icache __PNR_riscv_flush_icache
#endif

#ifdef __NR_rmdir
#define __SNR_rmdir __NR_rmdir
#else
Expand Down
2 changes: 2 additions & 0 deletions src/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
libseccomp.a
arch-syscall-check
arch-syscall-dump
syscalls.perf
syscalls.perf.c
45 changes: 29 additions & 16 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,25 @@ SOURCES_ALL = \
hash.h hash.c \
db.h db.c \
arch.c arch.h \
arch-x86.h arch-x86.c arch-x86-syscalls.c \
arch-x86_64.h arch-x86_64.c arch-x86_64-syscalls.c \
arch-x32.h arch-x32.c arch-x32-syscalls.c \
arch-arm.h arch-arm.c arch-arm-syscalls.c \
arch-aarch64.h arch-aarch64.c arch-aarch64-syscalls.c \
arch-mips.h arch-mips.c arch-mips-syscalls.c \
arch-mips64.h arch-mips64.c arch-mips64-syscalls.c \
arch-mips64n32.h arch-mips64n32.c arch-mips64n32-syscalls.c \
arch-parisc.h arch-parisc.c arch-parisc64.c arch-parisc-syscalls.c \
arch-ppc.h arch-ppc.c arch-ppc-syscalls.c \
arch-ppc64.h arch-ppc64.c arch-ppc64-syscalls.c \
arch-riscv64.h arch-riscv64.c arch-riscv64-syscalls.c \
arch-s390.h arch-s390.c arch-s390-syscalls.c \
arch-s390x.h arch-s390x.c arch-s390x-syscalls.c

EXTRA_DIST = arch-syscall-validate
arch-x86.h arch-x86.c \
arch-x86_64.h arch-x86_64.c \
arch-x32.h arch-x32.c \
arch-arm.h arch-arm.c \
arch-aarch64.h arch-aarch64.c \
arch-mips.h arch-mips.c \
arch-mips64.h arch-mips64.c \
arch-mips64n32.h arch-mips64n32.c \
arch-parisc.h arch-parisc.c arch-parisc64.c \
arch-ppc.h arch-ppc.c \
arch-ppc64.h arch-ppc64.c \
arch-riscv64.h arch-riscv64.c \
arch-s390.h arch-s390.c \
arch-s390x.h arch-s390x.c \
syscalls.h syscalls.c syscalls.perf.c

EXTRA_DIST = \
arch-syscall-validate arch-gperf-generate \
syscalls.csv syscalls.perf.template

TESTS = arch-syscall-check

Expand All @@ -67,5 +70,15 @@ libseccomp_la_CFLAGS = ${AM_CFLAGS} ${CODE_COVERAGE_CFLAGS} ${CFLAGS} \
libseccomp_la_LDFLAGS = ${AM_LDFLAGS} ${CODE_COVERAGE_LDFLAGS} ${LDFLAGS} \
-version-number ${VERSION_MAJOR}:${VERSION_MINOR}:${VERSION_MICRO}

EXTRA_DIST += syscalls.perf.c syscalls.perf
CLEANFILES = syscalls.perf.c syscalls.perf

syscalls.perf: syscalls.csv syscalls.perf.template
${AM_V_GEN} ${srcdir}/arch-gperf-generate \
${srcdir}/syscalls.csv ${srcdir}/syscalls.perf.template

syscalls.perf.c: syscalls.perf
${GPERF} -m 100 --null-strings --pic -tCEG -T -S1 $< > $@

check-build:
${MAKE} ${AM_MAKEFLAGS} ${check_PROGRAMS}
Loading