Some system calls require capturing the stacktrace before they are processed in kernel. Typical one is execve. Some system calls require invalidating mmap cache after they are processed in kernel.
In current implementation these requirements are handled in each sys_* functions: e.g. in sys_mmap. However, it is difficult to keep the source code maintainable in this approach to cover all system calls which have such requirements. In next patch set, I propose more generic way to handle the requirements. Two points are changed as part of the proposal: (1) put markers to syscallent.h to specifying the needs of special care in capturing the stacktrace, and (2) add code to handle the requirements at `trace_syscall_entering' instead of changing each sys_* functions. Newly added code in (2) refers markers put in (1). This patch just defines the markers(`STACKTRACE_INVALIDATE_CACHE' and `STACKTRACE_CAPTURE_ON_ENTER'). Many patches to support each CPU types follows this patch. At the last patch `trace_syscall_entering' is changed. The names of macros are suggested by Dmitry V. Levin <[email protected]>. Signed-off-by: Masatake YAMATO <[email protected]> --- defs.h | 2 ++ syscall.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/defs.h b/defs.h index cfd767d..42bc1ea 100644 --- a/defs.h +++ b/defs.h @@ -546,6 +546,8 @@ extern const struct xlat whence_codes[]; #define TRACE_DESC 040 /* Trace file descriptor-related syscalls. */ #define TRACE_MEMORY 0100 /* Trace memory mapping-related syscalls. */ #define SYSCALL_NEVER_FAILS 0200 /* Syscall is always successful. */ +#define STACKTRACE_INVALIDATE_CACHE 0400 /* Trigger proc/maps cache updating */ +#define STACKTRACE_CAPTURE_ON_ENTER 01000 /* Capture stacktrace on "entering" stage */ typedef enum { CFLAG_NONE = 0, diff --git a/syscall.c b/syscall.c index f2ade51..45714bf 100644 --- a/syscall.c +++ b/syscall.c @@ -98,6 +98,8 @@ #define TM TRACE_MEMORY #define NF SYSCALL_NEVER_FAILS #define MA MAX_ARGS +#define SI STACKTRACE_INVALIDATE_CACHE +#define SE STACKTRACE_CAPTURE_ON_ENTER const struct_sysent sysent0[] = { #include "syscallent.h" @@ -125,6 +127,8 @@ static const struct_sysent sysent2[] = { #undef TM #undef NF #undef MA +#undef SI +#undef SE /* * `ioctlent.h' may be generated from `ioctlent.raw' by the auxiliary -- 1.9.0 ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/NeoTech _______________________________________________ Strace-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/strace-devel
