Skip to content

Instantly share code, notes, and snippets.

@shdown shdown/

Last active Aug 29, 2017
What would you like to do?

GSoC 2017 Work Product Submission

What is done

  • Modified strace to be able to implement a pull-style syscall tracing API for Lua scripting.
  • Added support for Lua scripting, implemented a pull-style C API. Lua scripts can select syscalls they want to be notified about; inspect PID of the traced process, syscall arguments, and return value (on syscall exit), inject return values and signals, read traced process’ memory, and make use of strace’ path-matching facilities.
  • Implemented a helper Lua library that provides useful wrappers for the C API and a push-style API for hooking events (syscall entry and/or exit).
  • Implemented upoken function and exposed it to Lua scripts, allowing them to write traced process’ memory. Implemented write_obj wrapper function in the helper library.
  • Added documentation (the “LUA SCRIPTING” section in the man page).
  • Added tests for all the functionality implemented.


Merged commits:

  • (6b4efe9f) strace.c: refactor trace into two functions
  • (0a9d8bfd) strace.c: move termination code to a separate function
  • (099124e8) syscall.c: split trace_syscall() into 6 functions

All commits

Not merged yet:

  • (061c6981) Initial support for LuaJIT scripting
  • (648ee571) Introduce upoken function and expose it to LuaJIT scripts
  • (3dd5543b) tests: check LuaJIT scripting support


  • Get unmerged code merged.
  • Probably, add more examples to the man page section.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.