[Ltrace-devel] [PATCH] check return value of unw_get_reg and unw_get_proc_name

Petr Machata pmachata at redhat.com
Tue Jan 7 10:36:21 UTC 2014


Juan Cespedes <cespedes at debian.org> writes:

> On Mon, Jan 06, 2014 at 07:28:11PM +0100, Petr Machata wrote:
>> About that continue, if this errors out, we never change the
>> unwind_depth, nor call unw_step.  I suspect that should end it endless
>> loop--doesn't it?
>
> Uh, I don't know, you could be right.

It's not very hard to simulate this:

diff --git a/output.c b/output.c
index f804cd0..64081ff 100644
--- a/output.c
+++ b/output.c
@@ -662,7 +662,8 @@ output_right(enum tof type, struct process *proc, struct library_symbol *libsym,
 		unw_init_remote(&cursor, proc->unwind_as, proc->unwind_priv);
 		while (unwind_depth) {
 
-			if (unw_get_reg(&cursor, UNW_REG_IP, (unw_word_t *) &ip)) {
+			if (unw_get_reg(&cursor, UNW_REG_IP, (unw_word_t *) &ip)
+			    || 1) {
 				fprintf(options.output, " > stacktrace_error\n");
 				continue;
 			}

$ ./64/ltrace -w1 echo 2>&1 | head
__libc_start_main([ "echo" ] <unfinished ...>
getenv(0x404325, 0x7fff3488f1f8, 0x7fff3488f208, 0x403af0) = 0
 > stacktrace_error
 > stacktrace_error
 > stacktrace_error
[... etc ...]

So yeah, it's broken.  Luca, can you please post a follow-up patch that
fixes the points that I raised in my other mail, including this one?

> BTW, would it be ok for you if I add hooks to send all the commits to
> the list?

I'm afraid this would add a lot of noise to the list.  How about adding
a separate commits@ ML though?

Thanks,
PM



More information about the Ltrace-devel mailing list