[Ltrace-devel] [RFC 0/5] Fix for sprintf like functions

edgar.iglesias at gmail.com edgar.iglesias at gmail.com
Fri Oct 5 13:36:25 UTC 2012


From: "Edgar E. Iglesias" <edgar at axis.com>

Hi,

I ran into an issue while testing ltrace on our mips targets with
sprintf functions. It is possible to reproduce the issue on x86
aswell.

I debugged it down to the point that our param specs in the internal
representation of functions can sometime missmatch with the argument
dictionaries we instantiate while tracing. This happes if the param
spec has STOP entries early in the argument list. Expressions in the
param spec will then point to indexes that will be off in the
argument dictionary (that doesn't have any STOP entries).

There are probably multiple ways of fixing this. One is to keep the
argument dictionary on par with the param spec by adding
dummy/padding entries to fill up the space of the equivalent STOP
entries. Another is to fix up the indexes in the param spec or even
to create a mapping between param indexes and arg indexes.

I choose fix nr 1 here mostly because I think it keeps the data
structures simpler (without mappings) but if people have better
ideas, that would be nice. I can try them out.

Patch nr 1 is a bugfix.
Patch nr 2 is a general improvement that makes it easier to add
new types and can IMO be committed regardless of fix.

Patch nr 3 adds the ARGTYPE_NONE, to be used as a placeholder
/dummy entry in value dicts.

Patch nr 4 Fixes the bug by maintaining a 1-to-1 mapping between
param indexes and argument value dict indexes.

Patch nr 5 adds a testcase to the testsuite.

Let me know what you think and I'll fix up whatever comments that
come in.

Cheers,
Edgar


Edgar E. Iglesias (5):
  vect: Fix vect_reserve for large count
  Abort on unsupported value types in the backends
  Add ARGTYPE_NONE
  Maintain a 1-to-1 mapping between func params and arguments
  testsuite: Add testcase for sprintf like functions

 lens_default.c                         |    7 +++++++
 output.c                               |   25 ++++++++++++++++++++++---
 read_config_file.c                     |    1 +
 sysdeps/linux-gnu/ia64/fetch.c         |    5 ++---
 sysdeps/linux-gnu/m68k/fetch.c         |    2 +-
 sysdeps/linux-gnu/s390/fetch.c         |    4 ++++
 sysdeps/linux-gnu/s390/trace.c         |   10 ++++++----
 sysdeps/linux-gnu/x86/fetch.c          |    7 ++++++-
 sysdeps/linux-gnu/x86/trace.c          |   12 +++++++-----
 testsuite/ltrace.main/parameters-lib.c |    5 +++++
 testsuite/ltrace.main/parameters.c     |    3 +++
 testsuite/ltrace.main/parameters.conf  |    1 +
 testsuite/ltrace.main/parameters.exp   |    3 +++
 type.c                                 |    7 +++++++
 type.h                                 |    1 +
 vect.c                                 |    3 ++-
 16 files changed, 78 insertions(+), 18 deletions(-)

-- 
1.7.8.6




More information about the Ltrace-devel mailing list