[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aLs_0g8yHblKWxyB@google.com>
Date: Fri, 5 Sep 2025 12:53:54 -0700
From: Namhyung Kim <namhyung@...nel.org>
To: Zecheng Li <zecheng@...gle.com>
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 07/10] perf annotate: Invalidate register states for
unsupported instructions
On Wed, Sep 03, 2025 at 04:54:39PM -0400, Zecheng Li wrote:
> On Sat, Aug 30, 2025 at 3:15 AM Namhyung Kim <namhyung@...nel.org> wrote:
> >
> > On Mon, Aug 25, 2025 at 07:57:48PM +0000, Zecheng Li wrote:
> > > Invalidate register states when encountering unsupported instructions
> > > that modify pointers, to prevent propagating incorrect pointer types.
> > >
> > > On x86, the 'xor' instruction may appear in a predecessor basic block
> > > and zero out a register that invalidates the target register state. This
> > > sometimes relates to tagged pointers and normal programs should not
> > > dereference NULL pointers, so we assume such execution paths are invalid
> > > and do not invalidate states for 'xor' instructions.
> >
> > Probably we can set it to 0 with TSR_KIND_CONST.
> >
> It seems TSR_KIND_CONST doesn't relate to a type. Although the value
> was set to 0, it still has the pointer type. I see regressions that
> has this pattern
>
> xorl %rax, %rax
> mov %rax, (%rsp)
>
> and sometimes
>
> xorl %rax, %rax
> ... (some branches)
> mov (%rax), %rbx
>
> Normally NULL pointer dereference should not happen, so I assume such
> execution paths are invalid.
Agreed, I think there should be a place to set the pointer to a valid
value again (before use).
Thanks,
Namhyung
Powered by blists - more mailing lists