All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: sashiko-reviews@lists.linux.dev
Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	linux-rt-devel@lists.linux.dev
Subject: Re: [PATCH v4] ARM, ARM64, LONGARCH, XTENSA: Delay HW BP notification to task_work()
Date: Mon, 12 Oct 2026 11:37:49 +0200	[thread overview]
Message-ID: <20261012093749.aPWUGJ1a@linutronix.de> (raw)
In-Reply-To: <sashiko-outbox-167891@kernel.org>

On 2026-10-12 09:18:30 [+0000], sashiko-bot@kernel.org wrote:
> > diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
> > --- a/include/linux/perf_event.h
> > +++ b/include/linux/perf_event.h
> > @@ -215,6 +215,10 @@ struct hw_perf_event {
> >  
> >  	/* Last sync'ed generation of filters */
> >  	unsigned long			addr_filters_gen;
> > +#ifdef ARCH_NEED_PERF_HW_NOTIFY
> > +	struct callback_head		arch_hw_notif;
> > +	int				arch_hw_notif_busy;
> > +#endif
> 
> [Severity: Critical]
> Does this cause an ABI mismatch and One Definition Rule violation across
> the kernel?

So you learned a new thing.

> The ARCH_NEED_PERF_HW_NOTIFY macro is defined in architecture-specific
> headers like arch/arm64/include/asm/hw_breakpoint.h, but it is used here
> in the generic include/linux/perf_event.h header.
> 
> Because linux/perf_event.h does not universally include asm/hw_breakpoint.h,
> translation units that include linux/perf_event.h without previously
> including the architecture hardware breakpoint header will evaluate
> struct hw_perf_event without these fields. Since struct hw_perf_event
> is embedded in struct perf_event, this alters the size and member offsets
> of struct perf_event across different subsystems.
> 
> Can this lead to memory corruption when perf_event objects are passed
> between translation units with mismatched struct definitions? Should these
> conditional fields be driven by a globally visible Kconfig symbol instead?

This header file includes the mentioned header files defining
ARCH_NEED_PERF_HW_NOTIFY. The condition upon which the header file is
included does not change while the kernel is built. This could be moved
to Kconfig but I don't see the need for this.

Sebastian

  reply	other threads:[~2026-10-12  9:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-12  9:04 [PATCH v4] ARM, ARM64, LONGARCH, XTENSA: Delay HW BP notification to task_work() Sebastian Andrzej Siewior
2026-10-12  9:18 ` sashiko-bot
2026-10-12  9:37   ` Sebastian Andrzej Siewior [this message]
2026-10-12 10:15 ` Huacai Chen
2026-10-12 10:21   ` Sebastian Andrzej Siewior
2026-10-13  2:46     ` Huacai Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261012093749.aPWUGJ1a@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.