mbox series

[v3,dwarves,0/2] Check DW_OP_[GNU_]entry_value for possible parameter matching

Message ID 20241115113605.1504796-1-alan.maguire@oracle.com (mailing list archive)
Headers show
Series Check DW_OP_[GNU_]entry_value for possible parameter matching | expand

Message

Alan Maguire Nov. 15, 2024, 11:36 a.m. UTC
Currently, pahole relies on DWARF to find whether a particular func
has its parameter mismatched with standard or optimized away.
In both these cases, the func will not be put in BTF and this
will prevent fentry/fexit tracing for these functions.

The current parameter checking focuses on the first location/expression
to match intended parameter register. But in some cases, the first
location/expression does not have expected matching information,
but further location like DW_OP_[GNU_]entry_value can provide
information which matches the expected parameter register.

Patch 1 supports this; patch 2 adds locking around dwarf_getlocation*
as it is unsafe in a multithreaded environment.

Alan Maguire (1):
  dwarf_loader: use libdw__lock for dwarf_getlocation(s)

Eduard Zingerman (1):
  dwarf_loader: Check DW_OP_[GNU_]entry_value for possible parameter
    matching

 dwarf_loader.c | 123 +++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 98 insertions(+), 25 deletions(-)

Comments

Alan Maguire Nov. 15, 2024, 11:40 a.m. UTC | #1
On 15/11/2024 11:36, Alan Maguire wrote:
> Currently, pahole relies on DWARF to find whether a particular func
> has its parameter mismatched with standard or optimized away.
> In both these cases, the func will not be put in BTF and this
> will prevent fentry/fexit tracing for these functions.
> 
> The current parameter checking focuses on the first location/expression
> to match intended parameter register. But in some cases, the first
> location/expression does not have expected matching information,
> but further location like DW_OP_[GNU_]entry_value can provide
> information which matches the expected parameter register.
> 
> Patch 1 supports this; patch 2 adds locking around dwarf_getlocation*
> as it is unsafe in a multithreaded environment.
>

apologies, forgot to note

Changes since v2:

- handle multiple DW_OP_entry_value expressions by bailing if the
register matches expected, otherwise save reg in return value (Eduard
Yonghong, Jiri, patch 1)

> Alan Maguire (1):
>   dwarf_loader: use libdw__lock for dwarf_getlocation(s)
> 
> Eduard Zingerman (1):
>   dwarf_loader: Check DW_OP_[GNU_]entry_value for possible parameter
>     matching
> 
>  dwarf_loader.c | 123 +++++++++++++++++++++++++++++++++++++++----------
>  1 file changed, 98 insertions(+), 25 deletions(-)
>
Arnaldo Carvalho de Melo Nov. 15, 2024, 3:54 p.m. UTC | #2
On Fri, Nov 15, 2024 at 11:40:16AM +0000, Alan Maguire wrote:
> On 15/11/2024 11:36, Alan Maguire wrote:
> > Currently, pahole relies on DWARF to find whether a particular func
> > has its parameter mismatched with standard or optimized away.
> > In both these cases, the func will not be put in BTF and this
> > will prevent fentry/fexit tracing for these functions.
> > 
> > The current parameter checking focuses on the first location/expression
> > to match intended parameter register. But in some cases, the first
> > location/expression does not have expected matching information,
> > but further location like DW_OP_[GNU_]entry_value can provide
> > information which matches the expected parameter register.
> > 
> > Patch 1 supports this; patch 2 adds locking around dwarf_getlocation*
> > as it is unsafe in a multithreaded environment.
> >
> 
> apologies, forgot to note
> 
> Changes since v2:
> 
> - handle multiple DW_OP_entry_value expressions by bailing if the
> register matches expected, otherwise save reg in return value (Eduard
> Yonghong, Jiri, patch 1)

Thanks, applied locally, will perform tests and push publicly later
today.

- Arnaldo
 
> > Alan Maguire (1):
> >   dwarf_loader: use libdw__lock for dwarf_getlocation(s)
> > 
> > Eduard Zingerman (1):
> >   dwarf_loader: Check DW_OP_[GNU_]entry_value for possible parameter
> >     matching
> > 
> >  dwarf_loader.c | 123 +++++++++++++++++++++++++++++++++++++++----------
> >  1 file changed, 98 insertions(+), 25 deletions(-)
> >