<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/strace.git, branch esyr/gdbserver-prep</title>
<subtitle>github.com: strace/strace.git
</subtitle>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/strace.git/'/>
<entry>
<title>Use call via structure only when multiple tracing backends are available</title>
<updated>2019-02-27T16:35:22+00:00</updated>
<author>
<name>Eugene Syromiatnikov</name>
<email>esyr@redhat.com</email>
</author>
<published>2017-12-25T23:48:42+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/strace.git/commit/?id=6ff6bdfafac76625bbc21502cf81457cf12e3439'/>
<id>6ff6bdfafac76625bbc21502cf81457cf12e3439</id>
<content type='text'>
Since dispatching function calls via the tracing backend structure
definitely imposes some overhead, let's try to minimise it for the
(pretty common) case of having only one tracing backend available.

* configure.ac (additional_tracing_backends): New m4 variable.
(ADDITIONAL_TRACING_BACKENDS): New AC_DEFINE, equal to
additional_tracing_backends.
* ptrace_backend.c: Put ptrace_backend definition under
"#if ADDITIONAL_TRACING_PACKENDS".
* ptrace_backend.h: Put ptrace_backend declaration under
"#if ADDITIONAL_TRACING_PACKENDS".
* tcb_wait_data.h [!ADDITIONAL_TRACING_PACKENDS]: Provide macros for
aliasing trace_wait_data_size, init_trace_wait_data,
copy_trace_wait_data, and free_trace_wait_data to ptrace-based tracing
backend definitions.
* tracing_backend.c: Put the contents, except local_open, under #if
ADDITIONAL_TRACING_PACKENDS.
* tracing_backend.h: Put the contents (except local_open) under #if
ADDITIONAL_TRACING_PACKENDS, provide macros for all the inline functions
that alias them to the respective functions in the ptrace-based tracing
backend in the opposite case.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since dispatching function calls via the tracing backend structure
definitely imposes some overhead, let's try to minimise it for the
(pretty common) case of having only one tracing backend available.

* configure.ac (additional_tracing_backends): New m4 variable.
(ADDITIONAL_TRACING_BACKENDS): New AC_DEFINE, equal to
additional_tracing_backends.
* ptrace_backend.c: Put ptrace_backend definition under
"#if ADDITIONAL_TRACING_PACKENDS".
* ptrace_backend.h: Put ptrace_backend declaration under
"#if ADDITIONAL_TRACING_PACKENDS".
* tcb_wait_data.h [!ADDITIONAL_TRACING_PACKENDS]: Provide macros for
aliasing trace_wait_data_size, init_trace_wait_data,
copy_trace_wait_data, and free_trace_wait_data to ptrace-based tracing
backend definitions.
* tracing_backend.c: Put the contents, except local_open, under #if
ADDITIONAL_TRACING_PACKENDS.
* tracing_backend.h: Put the contents (except local_open) under #if
ADDITIONAL_TRACING_PACKENDS, provide macros for all the inline functions
that alias them to the respective functions in the ptrace-based tracing
backend in the opposite case.
</pre>
</div>
</content>
</entry>
<entry>
<title>Introduce tracing backend abstraction layer (TraBAL, for short)</title>
<updated>2019-02-27T16:35:22+00:00</updated>
<author>
<name>Eugene Syromiatnikov</name>
<email>esyr@redhat.com</email>
</author>
<published>2017-12-25T23:17:36+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/strace.git/commit/?id=90288a1d91b11364171f56f1b4f82726e8fb1b95'/>
<id>90288a1d91b11364171f56f1b4f82726e8fb1b95</id>
<content type='text'>
So, all the ptrace-specific routines are now getting "ptrace_" prefix.
Wrappers for the old routines are provided, that call appropriate method
based on current tracing backend selection. Some auxiliary functions
are provided for getting backend name and selecting backend.

Based on "Implement gdbserver using backend dispatch table." and "Add
defaults for all backend methods." commits by Stanford Cox.

* Makefile.am (strace_SOURCES): Add ptrace_backend.c, ptrace_backend.h,
ptrace_wait_data.h, tcb_wait_data.h, tracing_backend.c, tracing_backend.h.
* defs.h: Add struct tcb_wait_data forward declaration; include
tracing_backend.h.
(generic_get_instruction_pointer): Rename from get_instruction_pointer,
the latter is now defined in tracing_backend.h.
(generic_get_stack_pointer): Rename from get_stack_pointer, the latter
is now defained in tracing_dackend.h.
(clear_regs, get_scno, umoven, umovestr, upeek, upoke): Remove
declarations, they are now defined in tracing_backend.h.
* pathtrace.c (getfdpath): Change readlink call to tracee_readlink.
(pathtrace_select_set): Change realpath call to tracee_realpath.
* ptrace_backend.c: New file.
* ptrace_backend.h: Likewise.
* ptrace_wait_data.h: Likewise.
* tcb_wait_data.h: Likewise.
* tracing_backend.c: Likewise.
* tracing_backend.h: Likewise.
* strace.c: Include "tcb_wait_data.h", "ptrace_wait_data.h".
(struct tcb_wait_data): Move to tcb_wait_data.h.
(struct ptrace_wait_data, to_ptrace_wait_data): Move to
ptrace_wait_data.h.
(detach, cleanup): Remove declarations (they are a part of
tracing_backend.h now).
(detach, attach_tcb, startup_child, init_trace_wait_data,
copy_trace_wait_data, free_trace_wait_data, next_event,
handle_group_stop, handle_exec, restart_process): Add "ptrace_" prefix.
Remove static qualifier.
(tracing_backend_init): Rename to ptrace_init.
(tracing_backend_name): Remove.
(trace_wait_data_size): Remove, it is now defined in
tracing_backend.h.
(init): Call tracing_backend_post_init() at the end of the routine.
* syscall.c (get_regs, get_syscall_args, get_syscall_result. get_error,
set_scno, set_error, set_success): Remove declarations (they are part
of tracing_backend.h now).
(clear_regs, get_regs, get_scno, set_scno, set_error, set_success,
get_syscall_args, get_syscall_result, get_syscall_regs, ): Add "ptrace_"
prefix, remove static qualifier.
(get_instruction_pointer): Split into ptrace_get_instruction_pointer
and generic_get_instruction_pointer.
(get_stack_pointer): Split into ptrace_get_stack_pointer
and generic_get_stack_pointer.
* ucopy.c (umoven, umovestr): Add "ptrace_" prefix.
* upeek.c (upeek): Likewise.
* upoke.c (upoke): Likewise.
* socketutils.c (send_query): Replace sendmsg call with tracee_sendmsg.
(receive_responses): Replace recvmsg call with tracee_recvmsg.
(get_sockaddr_by_inode_uncached, genl_families_xlat): Replace socket
call with tracee_socket.
* util.c (getfdproto): Replace getxattr call with tracee_getxattr.
(open_file): Move to is part of ptrace_backend.c.
(read_int_from_file): Replace open_file call with tracee_open. Replace
read call with tracee_pread. Replace close call with tracee_close.

Co-Authored-by: Stan Cox &lt;scox@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
So, all the ptrace-specific routines are now getting "ptrace_" prefix.
Wrappers for the old routines are provided, that call appropriate method
based on current tracing backend selection. Some auxiliary functions
are provided for getting backend name and selecting backend.

Based on "Implement gdbserver using backend dispatch table." and "Add
defaults for all backend methods." commits by Stanford Cox.

* Makefile.am (strace_SOURCES): Add ptrace_backend.c, ptrace_backend.h,
ptrace_wait_data.h, tcb_wait_data.h, tracing_backend.c, tracing_backend.h.
* defs.h: Add struct tcb_wait_data forward declaration; include
tracing_backend.h.
(generic_get_instruction_pointer): Rename from get_instruction_pointer,
the latter is now defined in tracing_backend.h.
(generic_get_stack_pointer): Rename from get_stack_pointer, the latter
is now defained in tracing_dackend.h.
(clear_regs, get_scno, umoven, umovestr, upeek, upoke): Remove
declarations, they are now defined in tracing_backend.h.
* pathtrace.c (getfdpath): Change readlink call to tracee_readlink.
(pathtrace_select_set): Change realpath call to tracee_realpath.
* ptrace_backend.c: New file.
* ptrace_backend.h: Likewise.
* ptrace_wait_data.h: Likewise.
* tcb_wait_data.h: Likewise.
* tracing_backend.c: Likewise.
* tracing_backend.h: Likewise.
* strace.c: Include "tcb_wait_data.h", "ptrace_wait_data.h".
(struct tcb_wait_data): Move to tcb_wait_data.h.
(struct ptrace_wait_data, to_ptrace_wait_data): Move to
ptrace_wait_data.h.
(detach, cleanup): Remove declarations (they are a part of
tracing_backend.h now).
(detach, attach_tcb, startup_child, init_trace_wait_data,
copy_trace_wait_data, free_trace_wait_data, next_event,
handle_group_stop, handle_exec, restart_process): Add "ptrace_" prefix.
Remove static qualifier.
(tracing_backend_init): Rename to ptrace_init.
(tracing_backend_name): Remove.
(trace_wait_data_size): Remove, it is now defined in
tracing_backend.h.
(init): Call tracing_backend_post_init() at the end of the routine.
* syscall.c (get_regs, get_syscall_args, get_syscall_result. get_error,
set_scno, set_error, set_success): Remove declarations (they are part
of tracing_backend.h now).
(clear_regs, get_regs, get_scno, set_scno, set_error, set_success,
get_syscall_args, get_syscall_result, get_syscall_regs, ): Add "ptrace_"
prefix, remove static qualifier.
(get_instruction_pointer): Split into ptrace_get_instruction_pointer
and generic_get_instruction_pointer.
(get_stack_pointer): Split into ptrace_get_stack_pointer
and generic_get_stack_pointer.
* ucopy.c (umoven, umovestr): Add "ptrace_" prefix.
* upeek.c (upeek): Likewise.
* upoke.c (upoke): Likewise.
* socketutils.c (send_query): Replace sendmsg call with tracee_sendmsg.
(receive_responses): Replace recvmsg call with tracee_recvmsg.
(get_sockaddr_by_inode_uncached, genl_families_xlat): Replace socket
call with tracee_socket.
* util.c (getfdproto): Replace getxattr call with tracee_getxattr.
(open_file): Move to is part of ptrace_backend.c.
(read_int_from_file): Replace open_file call with tracee_open. Replace
read call with tracee_pread. Replace close call with tracee_close.

Co-Authored-by: Stan Cox &lt;scox@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tests: add additional tests for strace's -E behaviour</title>
<updated>2019-02-27T16:35:22+00:00</updated>
<author>
<name>Eugene Syromyatnikov</name>
<email>evgsyr@gmail.com</email>
</author>
<published>2019-02-22T18:01:12+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/strace.git/commit/?id=a079570e372d9317a1f155eb61774da4e9433635'/>
<id>a079570e372d9317a1f155eb61774da4e9433635</id>
<content type='text'>
* tests/Makefile.am (MISC_TESTS): Add strace-E-override.test,
strace-E-unset.test.
(EXTRA_DIST): Add strace-E-unset.expected.
* tests/strace-E-override.test: New test.
* tests/strace-E-unset.test: Likewise.
* tests/strace-E-unset.expected: New file.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* tests/Makefile.am (MISC_TESTS): Add strace-E-override.test,
strace-E-unset.test.
(EXTRA_DIST): Add strace-E-unset.expected.
* tests/strace-E-override.test: New test.
* tests/strace-E-unset.test: Likewise.
* tests/strace-E-unset.expected: New file.
</pre>
</div>
</content>
</entry>
<entry>
<title>strace.c: construct and pass environment to startup_child</title>
<updated>2019-02-27T16:35:22+00:00</updated>
<author>
<name>Eugene Syromyatnikov</name>
<email>evgsyr@gmail.com</email>
</author>
<published>2019-02-22T17:51:30+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/strace.git/commit/?id=a135a7794d647ac7c0b28b58d8d51e8631bfedb1'/>
<id>a135a7794d647ac7c0b28b58d8d51e8631bfedb1</id>
<content type='text'>
The current approach with putenv() during parsing has two problems:
 - it changes tracer's own environment which may affect its behaviour
   and may be undesirable;
 - it's specific to ptrace tracing backend.

As a solution, let's apply an approach similar to path tracing option
parsing: collect the provided optarg's in an array and then pass it to
tracing-backend-specific routines.

* strace.c (struct exec_params): Add env field.
(exec_or_die): Call execve() instead of execv(); pass params-&gt;env
as the third argument.
(startup_child): Add env parameter, set params_for_tracee.env to it.
(add_to_env, make_env): New functions.
(init): Add env_changes, env_change_size, env_change_count local
variables; store optarg in env_changes array on -E option occurrence;
construct new environment using make_env and pass it to startup_child
in the second argument.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The current approach with putenv() during parsing has two problems:
 - it changes tracer's own environment which may affect its behaviour
   and may be undesirable;
 - it's specific to ptrace tracing backend.

As a solution, let's apply an approach similar to path tracing option
parsing: collect the provided optarg's in an array and then pass it to
tracing-backend-specific routines.

* strace.c (struct exec_params): Add env field.
(exec_or_die): Call execve() instead of execv(); pass params-&gt;env
as the third argument.
(startup_child): Add env parameter, set params_for_tracee.env to it.
(add_to_env, make_env): New functions.
(init): Add env_changes, env_change_size, env_change_count local
variables; store optarg in env_changes array on -E option occurrence;
construct new environment using make_env and pass it to startup_child
in the second argument.
</pre>
</div>
</content>
</entry>
<entry>
<title>tests: add support for negative match patterns to match_grep</title>
<updated>2019-02-27T16:35:22+00:00</updated>
<author>
<name>Eugene Syromyatnikov</name>
<email>evgsyr@gmail.com</email>
</author>
<published>2019-02-22T17:46:07+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/strace.git/commit/?id=4b74d78d05d902a6b7041e2d05ddc3965d3418c1'/>
<id>4b74d78d05d902a6b7041e2d05ddc3965d3418c1</id>
<content type='text'>
For the cases when we want that some patterns do not appear in the
output.

* tests/init.sh (match_grep): Add res and negated local variables; set
negated to 1 if pattern starts with "!", otherwise to 0; fail if negated
pattern has been matched.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
For the cases when we want that some patterns do not appear in the
output.

* tests/init.sh (match_grep): Add res and negated local variables; set
negated to 1 if pattern starts with "!", otherwise to 0; fail if negated
pattern has been matched.
</pre>
</div>
</content>
</entry>
<entry>
<title>Use xzalloc(sz) instead of xcalloc(1, sz)</title>
<updated>2019-02-27T16:35:22+00:00</updated>
<author>
<name>Eugene Syromyatnikov</name>
<email>evgsyr@gmail.com</email>
</author>
<published>2019-02-22T17:41:31+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/strace.git/commit/?id=683c556de49ceb1099d7ab8dc519669e3060b48a'/>
<id>683c556de49ceb1099d7ab8dc519669e3060b48a</id>
<content type='text'>
* aux_children.c (register_aux_child_ex): Use xzalloc instead of xcalloc
of one-item-sized array.
* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_OBJ_GET_INFO_BY_FD)): Likewise.
* kvm.c (vcpu_alloc): Likewise.
* perf.c (fetch_perf_event_attr): Likewise.
* syscall.c (ptrace_get_scno): Likewise.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* aux_children.c (register_aux_child_ex): Use xzalloc instead of xcalloc
of one-item-sized array.
* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_OBJ_GET_INFO_BY_FD)): Likewise.
* kvm.c (vcpu_alloc): Likewise.
* perf.c (fetch_perf_event_attr): Likewise.
* syscall.c (ptrace_get_scno): Likewise.
</pre>
</div>
</content>
</entry>
<entry>
<title>xmalloc: add zero-initialisation counterparts for xmalloc and xcalloc</title>
<updated>2019-02-27T16:35:22+00:00</updated>
<author>
<name>Eugene Syromyatnikov</name>
<email>evgsyr@gmail.com</email>
</author>
<published>2019-02-22T17:34:33+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/strace.git/commit/?id=f390ebdb891ba716abc05a6e1de4cfc328bc9d9e'/>
<id>f390ebdb891ba716abc05a6e1de4cfc328bc9d9e</id>
<content type='text'>
Specifically, array allocation without zero memory initialisation
and xmalloc with zero memory initialisation.

* xmalloc.c (xallocarray): New function.
* xmalloc.h (xcalloc): Document the function.
(xallocarray): New function declaration.
(xzalloc): New function, wrapper for xcalloc with xmalloc interface.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Specifically, array allocation without zero memory initialisation
and xmalloc with zero memory initialisation.

* xmalloc.c (xallocarray): New function.
* xmalloc.h (xcalloc): Document the function.
(xallocarray): New function declaration.
(xzalloc): New function, wrapper for xcalloc with xmalloc interface.
</pre>
</div>
</content>
</entry>
<entry>
<title>strace.c: print resolved path name when startup child's stat has failed</title>
<updated>2019-02-27T16:35:22+00:00</updated>
<author>
<name>Eugene Syromyatnikov</name>
<email>evgsyr@gmail.com</email>
</author>
<published>2019-02-22T12:22:17+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/strace.git/commit/?id=c5b2c5ec427b026cd680c499f9bf7735fcecc14d'/>
<id>c5b2c5ec427b026cd680c499f9bf7735fcecc14d</id>
<content type='text'>
* strace.c (ptrace_startup_child): Print resolved pathname in the stat
error message.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* strace.c (ptrace_startup_child): Print resolved pathname in the stat
error message.
</pre>
</div>
</content>
</entry>
<entry>
<title>syscall.c: wrap arch_set_scno in TraBAL-specific wrapper</title>
<updated>2019-02-27T16:35:22+00:00</updated>
<author>
<name>Eugene Syromiatnikov</name>
<email>esyr@redhat.com</email>
</author>
<published>2017-12-25T23:15:33+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/strace.git/commit/?id=631b1abf76ad5b49c51ace229d79d3318962cb37'/>
<id>631b1abf76ad5b49c51ace229d79d3318962cb37</id>
<content type='text'>
* syscall.c (tamper_with_syscall_entering): Change arch_set_scno call to
set_scno.
(set_scno): New function.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* syscall.c (tamper_with_syscall_entering): Change arch_set_scno call to
set_scno.
(set_scno): New function.
</pre>
</div>
</content>
</entry>
<entry>
<title>Pass tcp argument to pathtrace_select_set</title>
<updated>2019-02-27T16:35:22+00:00</updated>
<author>
<name>Eugene Syromiatnikov</name>
<email>esyr@redhat.com</email>
</author>
<published>2017-12-25T23:11:27+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/strace.git/commit/?id=07ad67ad62a2adc11349e5e7b71624f9a026a080'/>
<id>07ad67ad62a2adc11349e5e7b71624f9a026a080</id>
<content type='text'>
As it will pass tcp to tracee-related syscalls.

* defs.h (pathtrace_select_set, pathtrace_select): Add tcp argument.
* pathtrace.c (pathtrace_select_set): Likewise.
* strace.c (init): Pass current_tcp to pathtrace_select call.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As it will pass tcp to tracee-related syscalls.

* defs.h (pathtrace_select_set, pathtrace_select): Add tcp argument.
* pathtrace.c (pathtrace_select_set): Likewise.
* strace.c (init): Pass current_tcp to pathtrace_select call.
</pre>
</div>
</content>
</entry>
</feed>
