]> granicus.if.org Git - strace/commitdiff
unwind: introduce markers specifying the needs of special care in unwinding
authorMasatake YAMATO <yamato@redhat.com>
Wed, 16 Apr 2014 06:33:11 +0000 (15:33 +0900)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 30 May 2014 22:57:56 +0000 (22:57 +0000)
Some system calls require capturing the stack trace 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 directly by
appropriate syscall handlers.  However, it is difficult to keep the
source code maintainable using this approach to cover all system calls
which have such requirements.

A more generic way to implement this is to flag all syscalls that
require special processing, and handle these flags right in
trace_syscall_entering instead of changing syscall handlers.

This patch just defines new flags: STACKTRACE_INVALIDATE_CACHE and
STACKTRACE_CAPTURE_ON_ENTER.

The names of macros are suggested by Dmitry Levin.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
defs.h
syscall.c

diff --git a/defs.h b/defs.h
index 464a968aad3e1f85012b44447fca714662fd9d81..c862de5a726b6c457aa5b7a1d1b0bd426b0edff3 100644 (file)
--- 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,
index 4ed971f071c0d5a973f5305149286b2b53a020ab..f8165510206d6e0a775246af4a9c4c82040fc6d7 100644 (file)
--- 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