[PATCH v11 1/3] Initial support for LuaJIT scripting
Dmitry V. Levin
ldv at altlinux.org
Sat Aug 26 09:58:48 UTC 2017
On Tue, Aug 15, 2017 at 01:09:23AM +0300, Victor Krapivensky wrote:
> * .gitignore: Add luajit_lib.h.
> * Makefile.am: Build with LuaJIT if configured so.
> (strace_SOURCES): Add defs_shared.h, ffi.h.
> (luajit_lib.h): Auto-generate from luajit_lib.lua.
> * basic_filters.c (make_number_set_universal, is_number_set_universal):
> New functions.
> (syscall_classes): Make global and terminate wit a null entry.
> (lookup_class): Use global syscall_classes.
> * configure.ac: Add new --with-luajit configure option.
> * defs.h (struct inject_opts): Move inject values to...
> (struct inject_values): ...new struct.
> (TCB_AD_HOC_INJECT, TCB_HOOK): New TCB flags.
> (QUAL_HOOK_ENTRY, QUAL_HOOK_EXIT): New qual flags.
> (RVAL_HOOKED): New return value flag.
> (struct tcb): If built with LuaJIT support, include currpers field even
> if SUPPORTED_PERSONALITIES is 1.
> If built with LuaJIT support, include new ad_hoc_inject_vals field.
> Move definitions that need to be fed to LuaJIT's FFI to...
> * defs_shared.h: ...new file.
> * ffi.h: New file.
> * luajit.h: Likewise.
> * luajit_lib.lua: Likewise.
> * filter_qualify.c: (hook_entry_set, hook_exit_set): New sets (if built
> with LuaJIT support).
> (parse_inject_token, qualify_inject_common): Update for new layout of
> struct inject_opts.
> (set_hook_qual, set_hook_qual_all): New functions (if built with LuaJIT
> support).
> (qual_flags): If built with LuaJIT support, return QUAL_HOOK_ENTRY and
> QUAL_HOOK_EXIT flags.
> * strace.1 (LUA SCRIPTING): New section.
> * strace.c (alloctcb): update the condition of presence of currpers
> field.
> (init): New -l option (if built with LuaJIT support).
> (enum trace_event): New TE_SYSCALL_STOP_HOOK_EXIT entry.
> (enum hook_state): New enum.
> (trace_syscall): Introduce state argument.
> (dispatch_event): Introduce hooked argument, support
> TE_SYSCALL_STOP_HOOK_EXIT as first argument.
> (main): run Lua script, if built with LuaJIT support and a script
> was provided.
> * syscall.c (errnoent_vec, nerrnoent_vec, signalent_vec,
> nsignalent_vec, ioctlent_vec, nioctlent_vec, personality_wordsize,
> personality_klongsize): New global variables.
> (personality_names): New global variable (if SUPPORTED_PERSONALITIES >
> 1).
> (update_personality): use personality_names for reporting personality
> name.
> (tcb_inject_opts): Introduce step argument, change return type to struct
> inject_values, rename to tcb_inject_values.
> If built with LuaJIT support and TCB_AD_HOC_INJECT flag is set, blend
> the result with tcp's ad_hoc_inject_vals.
> (tamper_with_syscall_entering): Don't copy inject_vec here and do
> counter decrement logic here; pass true as a second argument to
> tcb_inject_values.
> (tamper_with_syscall_exiting): Pass false as a second argument to
> tcb_inject_values.
> (syscall_ad_hoc_inject): New function.
> (syscall_entering_trace): perform ad hoc injection even if the syscall
> is not traced.
> (syscall_exiting_decode): don't return 0 ("bail out") if exiting hook is
> set up for this syscall, or if an ad hoc injection was performed.
> Call tamper_with_syscall_exiting on success.
> (syscall_exiting_trace): Don't call tamper_with_syscall_exiting, check
> if the syscall is not traced again.
> (syscall_exiting_finish): Clear TCB_AD_HOC_INJECT bit.
> * sysent.h: Modify to support inclusion with FFI_CDEF.
> ---
> .gitignore | 1 +
> Makefile.am | 17 ++
> basic_filters.c | 84 ++++---
> configure.ac | 36 +++
> defs.h | 73 +++---
> defs_shared.h | 66 +++++
> ffi.h | 19 ++
> filter_qualify.c | 57 ++++-
> luajit.h | 311 ++++++++++++++++++++++++
> luajit_lib.lua | 383 +++++++++++++++++++++++++++++
> strace.1 | 724 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> strace.c | 95 ++++++--
> syscall.c | 234 +++++++++++++-----
> sysent.h | 24 +-
> 14 files changed, 1961 insertions(+), 163 deletions(-)
> create mode 100644 defs_shared.h
> create mode 100644 ffi.h
> create mode 100644 luajit.h
> create mode 100644 luajit_lib.lua
Could you split this huge patch into two parts, please,
the first one with preparatory changes that introduce no luajit support,
and the second one with all the rest?
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20170826/d76d2250/attachment.bin>
More information about the Strace-devel
mailing list