[PATCH 1/1] dwflpp::function_entrypc avoid usage of uninitialized memory

Victor Kamensky kamensky@cisco.com
Thu Jul 12 19:38:00 GMT 2018


ping. Is anything wrong with this patch? Do I need to provide more
info? Please let me know.

Thanks,
Victor

On Mon, 9 Jul 2018, Victor Kamensky wrote:

> Failure on 3.3 release was observed. Failure was elusive and
> disappeared after seemingly random configure option change, or when
> code was compiled with -O1 or -O0 (vs default -O2). Running failing
> test case under valgrind memcheck pointed to couple places where
> 'Conditional jump or move depends on uninitialised value(s)' occured.
>
> After addressing these in two places in dwflpp::function_entrypc,
> valgrind memcheck run is clean and original issue got fixed.
>
> Signed-off-by: Victor Kamensky <kamensky@cisco.com>
> ---
> dwflpp.cxx | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/dwflpp.cxx b/dwflpp.cxx
> index bfbb6b096..2172e705a 100644
> --- a/dwflpp.cxx
> +++ b/dwflpp.cxx
> @@ -2465,13 +2465,17 @@ bool
> dwflpp::function_entrypc (Dwarf_Addr * addr)
> {
>   assert (function);
> +
> +  // assign default value
> +  *addr = 0;
> +
>   // PR10574: reject 0, which tends to be eliminated COMDAT
>   if (dwarf_entrypc (function, addr) == 0 && *addr != 0)
>     return true;
>
>   /* Assume the entry pc is the base address, or (if zero)
>      the first address of the ranges covering this DIE.  */
> -  Dwarf_Addr start, end;
> +  Dwarf_Addr start = 0, end;
>   if (dwarf_ranges (function, 0, addr, &start, &end) >= 0)
>     {
>       if (*addr == 0)
> -- 
> 2.17.1
>
>



More information about the Systemtap mailing list