Re: [PATCH] perf probe: Fix null pointer dereference in convert_variable_location()

From: Arnaldo Carvalho de Melo
Date: Tue Jun 01 2021 - 09:23:59 EST

Em Tue, Jun 01, 2021 at 05:27:50PM +0800, Li Huafei escreveu:
> If we just check whether the variable can be converted, 'tvar' should be
> a null pointer. However, the null pointer check is missing in the
> 'Constant value' execution path.
> The following cases can trigger this problem:
> $ cat test.c
> #include <stdio.h>

Thanks for providing the detailed analysis and test steps, I've
reproduced the problem before the patch and it now works with your

[acme@five tmp]$ sudo perf probe -x ./test main:6
Added new event:
probe_test:main_L6 (on main:6 in /tmp/test)

You can now use it in all perf tools, such as:

perf record -e probe_test:main_L6 -aR sleep 1

[acme@five tmp]$

Thanks, applied.

- Arnaldo