lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJUgMy+wP7t3Ss=JLOXDaxkLTZZHkirT5CJrz27K=HYiKU0ocw@mail.gmail.com>
Date: Tue, 16 Sep 2025 21:22:15 -0400
From: Zecheng Li <zecheng@...gle.com>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>, 
	Arnaldo Carvalho de Melo <acme@...nel.org>, Mark Rutland <mark.rutland@....com>, 
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>, 
	Ian Rogers <irogers@...gle.com>, Adrian Hunter <adrian.hunter@...el.com>, 
	"Liang, Kan" <kan.liang@...ux.intel.com>, Masami Hiramatsu <mhiramat@...nel.org>, 
	Xu Liu <xliuprof@...gle.com>, linux-perf-users@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 10/10] perf dwarf-aux: support DW_OP_piece expressions

On Sat, Aug 30, 2025 at 3:34 AM Namhyung Kim <namhyung@...nel.org> wrote:
>
> On Mon, Aug 25, 2025 at 07:58:33PM +0000, Zecheng Li wrote:
> > Support variables split across multiple registers or stack locations by
> > handling DW_OP_piece in DWARF expressions. This enables correct matching
> > of such variables by iterating over all pieces in the expression.
>
> Can you show me a real world example of these variables?

An optimizing compiler can sometimes split a struct (mostly stack
variable) to multiple locations, or even optimized out. DW_OP_piece
describes the location of each part. For example,

DW_OP_reg2 RCX, DW_OP_piece 0x4, DW_OP_breg7 RSP+28, DW_OP_piece 0x4

The first part is in RCX, the second part is in the memory location
RSP+28, each of size 0x4 byte. Memory access on 0(RCX) corresponds to
case 2 and 28(RSP) corresponds to case 1.

> >
> > There are two cases for matching memory access on the target register:
> >
> > 1. Accessing a struct member:
> >    - The type is the original variable's type.
> >    - The offset is the sum of the piece's offset and the operand's
> >      offset.
> > 2. Dereferencing a member:
> >    - The type is the member of the original variable (the member must be
> >      a pointer).
> >    - The size must match the piece size.
> >    - The access offset is the operand's offset.
> >
> > This change improves support for piece-wise variable locations in DWARF
> > expressions.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ