summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* tests: check Lua scripting supportVictorKrapivensky/luajitVictor Krapivensky2017-09-207-1/+697
| | | | | | | | | | | | | | * tests/.gitignore: Add lua. * tests/Makefile.am (check_PROGRAMS): Likewise. (LUAJIT_TESTS): New variable. (TESTS): Add LUAJIT_TESTS. (EXTRA_DIST): Add lua.sh, lua-basics.test, lua-qual.test, lua-tampering.test. * tests/lua-basics.test: New file. * tests/lua-qual.test: Likewise. * tests/lua-tampering.test: Likewise. * tests/lua.c: Likewise. * tests/lua.sh: Likewise.
* Introduce upoken function and expose it to Lua scriptsVictor Krapivensky2017-09-206-0/+223
| | | | | | | | | | | | | | | * configure.ac: check for process_vm_writev's availability. * defs.h: Add declaration for upoken. * luajit.h (func_upoke): New wrapper function. (init_luajit): Expose it as strace.C.upoke. * luajit_lib.lua (write_obj): New function. * strace.1 (LUA SCRIPTING): Describe new functions. * ucopy.c (process_vm_writev_not_supported): New global flag. (strace_process_vm_writev): New function. (vm_write_mem): Likewise. (partial_poke): Likewise. (upoken_peekpoke): Likewise. (upoken): Likewise.
* Add initial support for Lua scriptingVictor Krapivensky2017-09-2012-2/+1842
| | | | | | | | | | | | | | | | | | | | | | | * .gitignore: Add luajit_lib.h. * Makefile.am: Build with LuaJIT if configured so. (luajit_lib.h): Auto-generate from luajit_lib.lua. * NEWS: New entry. * configure.ac: Add new --with-luajit configure option. * defs_shared.h (struct tcb): If built with LuaJIT support, include currpers field even if SUPPORTED_PERSONALITIES is 1. If built with LuaJIT support, add new ad_hoc_inject_data field. * filter_qualify.c: (hook_entry_set, hook_exit_set): New sets (if built with LuaJIT support). * luajit.h: New file. * luajit_lib.h: Likewise. * strace.1.in (LUA SCRIPTING): New section. * strace.c (alloctcb): update the condition of presence of currpers field. (init): New -l option (if built with LuaJIT support). (main): run Lua script, if built with LuaJIT support and a script was provided. * syscall.c (tcb_inject_data): If built with LuaJIT support and, blend the result with tcp's ad_hoc_inject_data.
* Prepare for adding support for Lua scriptingVictor Krapivensky2017-09-2011-157/+430
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Makefile.am (strace_SOURCES): Add defs_shared.h and ffi.h. * basic_filters.c (syscall_classes): make global and terminate by a null entry. (lookup_class): use global null entry-terminated variable. * defs.h (TCB_AD_HOC_INJECT, TCB_HOOK): New TCB flags. (QUAL_HOOK_ENTRY, QUAL_HOOK_EXIT): New qualifier flags. (RVAL_HOOKED): New return value flag. (struct ioctlent, struct tcb): move to... * defs_shared.h: ...new file. * ffi.h: New file. * filter_qualify.c (qual_flags): Introduce QUALBIT macro and use it. * number_set.c (number_unsetbit, remove_number_from_set, extend_set_with_number, make_number_set_universal, extend_set_array_with_number, make_number_set_array_universal): New functions. * strace.c (enum trace_event): Introduce new TE_SYSCALL_STOP_HOOK_EXIT trace event. (enum hook_state): New enumeration. (trace_syscall): Add a hook state argument. (dispatch_event): Add a "hooked" argument, support invoking with TE_SYSCALL_STOP_HOOK_EXIT event. * syscall.c: (errnoent_vec, nerrnoent_vec, signalent_vec, nsignalent_vec, ioctlent_vec, nioctlent_vec, personality_wordsize, personality_klongsize, personality_names): New global variables. (update_personality): Use personality_names for reporting personality name. (tcb_inject_opts): Introduce step argument, change return type to struct inject_data, rename to tcb_inject_data. (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_data. (tamper_with_syscall_exiting): Pass false as a second argument to tcb_inject_data. (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 inclusing with FFI_CDEF defined.
* error_prints: fix potential program_invocation_name type conflictBaruch Siach2017-09-081-0/+2
| | | | | | | | | | | | | | | | uClibc-ng declares program_invocation_name as const. This causes the build failure below: error_prints.c:40:14: error: conflicting types for ‘program_invocation_name’ extern char *program_invocation_name; ^~~~~~~~~~~~~~~~~~~~~~~ In file included from error_prints.c:32:0: .../output/host/x86_64-buildroot-linux-uclibc/sysroot/usr/include/errno.h:54:20: note: previous declaration of ‘program_invocation_name’ was here extern const char *program_invocation_name, *program_invocation_short_name; ^~~~~~~~~~~~~~~~~~~~~~~ * error_prints.c (program_invocation_name): Declare only in case of [!HAVE_PROGRAM_INVOCATION_NAME].
* rtnl_tc_action: decode tcamsg netlink attributesJingPiao Chen2017-09-071-1/+11
| | | | | * rtnl_tc_action.c (tcamsg_nla_decoders): New array. (decode_tcamsg): Use it.
* tests: check decoding of TCA_STAB netlink attribute of tcmsgJingPiao Chen2017-09-075-0/+191
| | | | | | | | * tests/test_nlattr.h (TEST_NESTED_NLATTR_ARRAY): New macro. * tests/nlattr_tca_stab.c: New file. * tests/gen_tests.in (nlattr_tca_stab): New entry. * tests/pure_executables.list: Add nlattr_tca_stab. * tests/.gitignore: Likewise.
* tests: check decoding of TCA_STATS2 netlink attribute of tcmsgJingPiao Chen2017-09-074-0/+154
| | | | | | | * tests/nlattr_tc_stats.c: New file. * tests/gen_tests.in (nlattr_tc_stats): New entry. * tests/pure_executables.list: Add nlattr_tc_stats. * tests/.gitignore: Likewise.
* tests: check decoding of tcmsg netlink attributesJingPiao Chen2017-09-071-0/+38
| | | | | * tests/nlattr_tcmsg.c: Include <stddef.h> and <linux/pkt_sched.h>. (main): Check decoding of TCA_STATS and TCA_RATE.
* rtnl_tc: decode tcmsg netlink attributesJingPiao Chen2017-09-075-1/+281
| | | | | | | | | | | | | | | | | | | | * configure.ac (AC_CHECK_TYPES): Check for gnet_stats_basic, gnet_stats_queue, gnet_stats_rate_est, and gnet_stats_rate_est64 structures in <linux/gen_stats.h>. And check for struct tc_sizespec in <linux/pkt_sched.h>. * nlattr.h (tc_stats): New prototype. * rtnl_tc.c: Include <linux/gen_stats.h>, <linux/pkt_sched.h>, "xlat/rtnl_tca_stab_attrs.h" and "xlat/rtnl_tca_stats_attrs.h". (decode_tc_stats, decode_tc_estimator, decode_gnet_stats_basic, decode_gnet_stats_rate_est, decode_gnet_stats_queue, decode_gnet_stats_rate_est64, decode_nla_tc_stats, decode_tc_sizespec, print_stab_data, decode_tca_stab_data, decode_tca_stab): New functions. (tca_stats_nla_decoders, tca_stab_nla_decoders, tcmsg_nla_decoders): New arrays. (decode_tcmsg): Use tcmsg_nla_decoders. * xlat/rtnl_tca_stab_attrs.in: New file. * xlat/rtnl_tca_stats_attrs.in: Likewise.
* Update TCP_* constantsDmitry V. Levin2017-09-072-1/+3
| | | | | * xlat/socktcpoptions.in: Add TCP_ULP and TCP_MD5SIG_EXT. * NEWS: Mention this.
* Update SOL_* constantsDmitry V. Levin2017-09-072-0/+4
| | | | | * xlat/socketlayers.in: Add SOL_TLS. * NEWS: Mention this.
* Post-release administriviaDmitry V. Levin2017-09-063-0/+12
| | | | | | * NEWS: Add a header line for the next release. * debian/changelog.in: Add a changelog entry for 4.19-1. * strace.spec.in: Likewise.
* Prepare for 4.19 releasev4.19Dmitry V. Levin2017-09-051-1/+1
| | | | * NEWS: Update for 4.19 release.
* .mailmap: add canonical name and address of Edgar KaziakhmedovDmitry V. Levin2017-09-051-0/+1
| | | | | * .mailmap: Add canonical name and address of Edgar Kaziakhmedov here to avoid duplications in CREDITS file.
* maint: add gen-tag-message.sh scriptDmitry V. Levin2017-09-051-0/+68
| | | | * maint/gen-tag-message.sh: New file.
* maint: add gen-contributors-list.sh scriptDmitry V. Levin2017-09-051-0/+39
| | | | * maint/gen-contributors-list.sh: New file.
* Update copyright headersEugene Syromyatnikov2017-09-0544-0/+44
| | | | | | Headers updated automatically with maint/update_copyright_headers.sh -c
* update_copyright_years.sh: add ability to automatically commit resultsEugene Syromyatnikov2017-09-051-0/+15
| | | | | | | * maint/update_copyright_years.sh (DEFAULT_GIT_COMMIT_MESSAGE, GIT_COMMIT_MESSAGE): New variables. <-c>: New option, implies -a, calls git commit with GIT_COMMIT_TEMPLATE string as a template.
* configure.ac: specify minimal GNU Automake versionEugene Syromyatnikov2017-09-041-1/+1
| | | | | | | | | In order to provide better diagnostics. * configure.ac (AM_INIT_AUTOMAKE): Specify minimal GNU Automake version as 1.13 due to usage of AM_EXTRA_RECURSIVE_TARGETS macro. Closes: https://github.com/strace/strace/issues/11
* Update NEWSEugene Syromyatnikov2017-09-041-0/+36
|
* tests: check decoding of IFLA_XDP netlink attribute of ifinfomsgJingPiao Chen2017-09-034-0/+115
| | | | | | | * tests/nlattr_ifla_xdp.c: New file. * tests/gen_tests.in (nlattr_ifla_xdp): New entry. * tests/pure_executables.list: Add nlattr_ifla_xdp. * tests/.gitignore: Likewise.
* tests: check decoding of IFLA_PORT_SELF netlink attribute of ifinfomsgJingPiao Chen2017-09-034-0/+122
| | | | | | | * tests/nlattr_ifla_port.c: New file. * tests/gen_tests.in (nlattr_ifla_port): New entry. * tests/pure_executables.list: Add nlattr_ifla_port. * tests/.gitignore: Likewise.
* tests: check decoding of more ifinfomsg netlink attributesJingPiao Chen2017-09-031-0/+31
| | | | | | * tests/nlattr_ifinfomsg.c (IFLA_LINKINFO, IFLA_VF_PORTS, IFLA_INFO_KIND, IFLA_VF_PORT): New macros. (main): Check decoding of IFLA_LINKINFO and IFLA_VF_PORTS.
* rtnl_link: decode more ifinfomsg netlink attributesJingPiao Chen2017-09-037-4/+158
| | | | | | | | | | | | | | | | | | | | | | * configure.ac (AC_CHECK_TYPES): Check for struct ifla_port_vsi in <linux/if_link.h>. * rtnl_link.c: Include "xlat/rtnl_ifla_info_attrs.h", "xlat/rtnl_ifla_port_attrs.h", "xlat/rtnl_ifla_port_attrs.h", "xlat/rtnl_ifla_xdp_attrs.h", and "xlat/xdp_flags.h". (decode_ifla_linkinfo, decode_ifla_port_vsi, decode_ifla_port, decode_ifla_vf_ports, decode_ifla_xdp_flags, decode_ifla_xdp): New functions. (ifla_linkinfo_nla_decoders, ifla_port_nla_decoders, ifla_vf_port_nla_decoders, ifla_xdp_nla_decoders): New arrays. (ifinfomsg_nla_decoders) <IFLA_LINKINFO>: Use decode_ifla_linkinfo. <IFLA_VF_PORTS>: Use decode_ifla_vf_ports. <IFLA_PORT_SELF>: Use decode_ifla_port. <IFLA_XDP>: Use decode_ifla_xdp. * xlat/rtnl_ifla_info_attrs.in: New file. * xlat/rtnl_ifla_port_attrs.in: Likewise. * xlat/rtnl_ifla_vf_port_attrs.in: Likewise. * xlat/rtnl_ifla_xdp_attrs.in: Likewise. * xlat/xdp_flags.in: Likewise.
* keyctl: add support for KDF parameters decoding in KEYCTL_DH_COMPUTEEugene Syromyatnikov2017-09-027-9/+307
| | | | | | | | | | | | | | | | | | | | * fetch_struct_keyctl_kdf_params.c: New file. * keyctl_kdf_params.h: Likewise. * Makefile.am (strace_SOURCES): Add them. * configure.ac: Add check for struct keyctl_kdf_params presence in <linux/keyctl.h>. * defs.h (struct strace_keyctl_kdf_params): Add forward declaration. * keyctl.c (keyctl_dh_compute): Add new parameter kdf_addr, print it on exiting. (SYS_FUNC(keyctl)) <case KEYCTL_DH_COMPUTE>: Pass arg5 to keyctl_dh_compute. * tests/keyctl.c: Include assert.h. (struct keyctl_kdf_params) [!HAVE_STRUCT_KEYCTL_KDF_PARAMS]: New definition. (STR32): New definition, copied from ioctl_dm.c. (append_str, kckdfp_to_str): New functions. (main): Update expected output, add checks for struct keyctl_kdf_params decoding.
* tests/keyctl: improve readabilityEugene Syromyatnikov2017-09-021-101/+141
| | | | | | | | | | | * tests/keyctl.c: Since do_keyctl() has so convoluted calling convention and keyctl test is so complex, let's try to improve readability a bit with some conventions regarding do_keyctl() call formatting: arguments representing single keyctl argument should be put on the separate line, continuations of arguments related to the same keyctl argument should have additional indentation and termination 0UL should always be on a separate line. Also, while we are here, let's add spaces to two type casts that are missing them.
* s390: update ioctl entries from linux 4.13Gleb Fotengauer-Malinovskiy2017-09-011-0/+3
| | | | * linux/s390/ioctls_arch0.h: Update from linux v4.13-rc7 using ioctls_gen.sh.
* mpers.awk: fix regression introduced by the previous cleanupDmitry V. Levin2017-09-011-1/+1
| | | | | | * mpers.awk (what_is): Remove returned_size from local variables. Fixes: v4.18-308-gfd3447b5 ("mpers.awk: declare local variables consistently")
* rtnl_link: enhance decoding of struct rtnl_link_stats{,64}Dmitry V. Levin2017-09-011-8/+16
| | | | | | | | | | Enhance runtime detection of struct rtnl_link_stats.rx_nohandler and struct rtnl_link_stats64.rx_nohandler. * rtnl_link.c (decode_rtnl_link_stats): Do not accept structure length greater than min_size but less than sizeof(struct rtnl_link_stats). (decode_rtnl_link_stats64): Likewise, so not accept structure length greater than min_size but less than sizeof(struct rtnl_link_stats64).
* rtnl_neightbl: enhance decoding of struct ndt_statsDmitry V. Levin2017-09-011-4/+12
| | | | | | | | | Add support of kernels that operate with older definition of struct ndt_stats than the definition used to build strace. * rtnl_neightbl.c (decode_ndt_stats): Add runtime detection of struct ndt_stats.ndts_table_fulls field, print the field when it is available.
* tests: check decoding of IFLA_PROTINFO netlink attribute of ifinfomsgJingPiao Chen2017-09-015-0/+160
| | | | | | | | * tests/nlattr_ifla_brport.c: New file. * tests/gen_tests.in (nlattr_ifla_brport): New entry. * tests/pure_executables.list: Add nlattr_ifla_brport. * tests/.gitignore: Likewise. * tests/test_nlattr.h (TEST_NESTED_NLATTR_OBJECT): New macro.
* rtnl_link: decode IFLA_PROTINFO netlink attribute of ifinfomsgJingPiao Chen2017-09-013-2/+107
| | | | | | | | | | * configure.ac (AC_CHECK_TYPES): Check for ifla_bridge_id and rtnl_link_stats64 structures in <linux/if_link.h>. * rtnl_link.c: Include "xlat/rtnl_ifla_brport_attrs.h". (decode_ifla_bridge_id, decode_ifla_protinfo): New functions. (ifla_brport_nla_decoders): New array. (ifinfomsg_nla_decoders) <IFLA_PROTINFO>: Use decode_ifla_protinfo. * xlat/rtnl_ifla_brport_attrs.in: New file.
* tests: check decoding of ndtmsg netlink attributesJingPiao Chen2017-09-011-0/+75
| | | | | * tests/nlattr_ndtmsg.c (NDTA_PARMS, NDTPA_IFINDEX): New macros. (main): Check decoding of NDTA_CONFIG, NDTA_PARMS and NDTA_STATS.
* rtnl_neightbl: decode ndtmsg netlink attributesJingPiao Chen2017-09-013-1/+139
| | | | | | | | | | | * configure.ac (AC_CHECK_TYPES): Check for ndt_config and ndt_stats structures in <linux/neighbour.h>. (AC_CHECK_MEMBERS): Check for ndts_table_fulls field in struct ndt_stats. * rtnl_neightbl.c: Include "xlat/rtnl_neightbl_parms_attrs.h". (decode_ndt_config, decode_ndta_parms, decode_ndta_parms): New functions. (ndt_parms_nla_decoders, ndtmsg_nla_decoders): New arrays. (decode_ndtmsg): Use ndtmsg_nla_decoders. * xlat/rtnl_neightbl_parms_attrs.in: New file.
* tests: check decoding of ifaddrlblmsg netlink attributesJingPiao Chen2017-09-011-0/+5
| | | | * tests/nlattr_ifaddrlblmsg.c (main): Check decoding of IFAL_ADDRESS.
* rtnl_addrlabel: decode ifaddrlblmsg netlink attributesJingPiao Chen2017-09-011-1/+21
| | | | | | * rtnl_addrlabel.c (decode_ifal_address): New function. (ifaddrlblmsg_nla_decoders): New array. (decode_ifaddrlblmsg): Use it.
* alpha: wire up new syscallsDmitry V. Levin2017-09-011-0/+9
| | | | * linux/alpha/syscallent.h [514..522]: New entries.
* tests/.gitignore: add missing files that should be ignoredJingPiao Chen2017-08-311-0/+1
| | | | * tests/.gitignore: Add is_linux_mips_n64.
* mpers.awk: declare local variables consistentlyDmitry V. Levin2017-08-311-4/+8
| | | | | | * mpers.awk (compare_indices): Make c1 and c2 variables local. (enter): Make item variable local. (what_is): Make loc_diff, returned_size, and to_return local.
* mpers.awk: separate local variables from real parameters by newlineDmitry V. Levin2017-08-301-2/+4
| | | | | * mpers.awk (array_get, update_upper_bound): Separate local variables from real parameters by newline.
* rtnl_rule: enhance FRA_TABLE decodingDmitry V. Levin2017-08-292-1/+8
| | | | | | | | | | The attribute of FRA_TABLE is not just a 32-bit integer, some constants have well-known symbolic names like RT_TABLE_DEFAULT. * rtnl_rule.c (fib_rule_hdr_nla_decoders) <FRA_TABLE>: Use decode_nla_rt_class. * tests/nlattr_fib_rule_hdr.c (FRA_TABLE): New macro. (main): Check FRA_TABLE decoding.
* rtnl_route: enhance RTA_TABLE decodingDmitry V. Levin2017-08-293-1/+23
| | | | | | | | | | The attribute of RTA_TABLE is not just a 32-bit integer, some constants have well-known symbolic names like RT_TABLE_DEFAULT. * nlattr.h (decode_nla_rt_class): New prototype. * rtnl_route.c (decode_nla_rt_class): New function. (rtmsg_nla_decoders) <RTA_TABLE>: Use it. * tests/nlattr_rtmsg.c (main): Check RTA_TABLE decoding.
* rtnl_nsid: decode rtgenmsg netlink attributesJingPiao Chen2017-08-291-1/+9
| | | | | * rtnl_nsid.c (rtgenmsg_nla_decoders): New array. (decode_rtgenmsg): Use it.
* rtnl_netconf: decode netconfmsg netlink attributesJingPiao Chen2017-08-291-1/+12
| | | | | * rtnl_netconf.c (netconfmsg_nla_decoders): New array. (decode_netconfmsg): Use it.
* tests: check decoding of ndmsg netlink attributesJingPiao Chen2017-08-291-0/+31
| | | | | | * tests/nlattr_ndmsg.c: Include <netinet/in.h> and <arpa/inet.h>. (NDA_PORT): New macro. (main): Check decoding of NDA_DST, NDA_CACHEINFO and NDA_PORT.
* rtnl_neigh: decode ndmsg netlink attributesJingPiao Chen2017-08-293-1/+70
| | | | | | | | | | * nlattr.c: Include <netinet/in.h> and <arpa/inet.h>. (decode_nla_be16): New function. * nlattr.h (decode_nla_be16): New prototype. * rtnl_neigh.c (decode_neigh_addr, decode_nda_cacheinfo): New functions. (ndmsg_nla_decoders): New array. (decode_ndmsg): Use it.
* tests: check decoding of fib_rule_hdr netlink attributesJingPiao Chen2017-08-291-0/+29
| | | | | | * tests/nlattr_fib_rule_hdr.c: Include <inttypes.h>. (FRA_TUN_ID, FRA_UID_RANGE): New macros. (main): Check decoding of FRA_DST, FRA_UID_RANGE and FRA_TUN_ID.
* rtnl_rule: decode fib_rule_hdr netlink attributesJingPiao Chen2017-08-294-1/+83
| | | | | | | | | | | | | * configure.ac (AC_CHECK_FUNCS): Add be64toh. (AC_CHECK_TYPES): Check for struct fib_rule_uid_range in <linux/fib_rules.h>. * nlattr.c: Include <endian.h>. (decode_nla_be64): New function. * nlattr.h (decode_nla_be64): New prototype. * rtnl_rule.c (decode_rule_addr, decode_fib_rule_uid_range): New functions. (fib_rule_hdr_nla_decoders): New array. (decode_fib_rule_hdr): Use it.
* rtnl_neigh: fix ndm_type field decode in struct ndmsgJingPiao Chen2017-08-295-18/+6
| | | | | | | | * defs.h (routing_types): New xlat prototype. * rtnl_neigh.c (decode_ndmsg): Fix ndm_type decode. * xlat/nda_types.in: Remove it. * tests/netlink_route.c (test_rtnl_neigh): Update the test. * tests/nlattr_ndmsg.c (init_ndmsg, print_ndmsg): Likewise.