Re: [PATCH] tracing: fprobe: Remove __packed from generic __fprobe_header

From: Mathieu Desnoyers

Date: Wed Jun 10 2026 - 16:05:43 EST


On 2026-06-10 15:51, Steven Rostedt wrote:
On Wed, 10 Jun 2026 12:06:59 +0100
David Laight <david.laight.linux@xxxxxxxxx> wrote:

So you only want __packed on structures that might be misaligned and those
that contain misaligned members.

If the structure is only guaranteed to be 32bit aligned then use __packed
__aligned(4) so that two 32bit accesses get used instead of 8 8bit ones.

-- David


Thank you,
Signed-off-by: Markus Schneider-Pargmann (The Capable Hub) <msp@xxxxxxxxxxxx>
---
kernel/trace/fprobe.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/fprobe.c b/kernel/trace/fprobe.c
index cc49ebd2a773..21751dcdb7b9 100644
--- a/kernel/trace/fprobe.c
+++ b/kernel/trace/fprobe.c
@@ -181,7 +181,7 @@ static inline void read_fprobe_header(unsigned long *stack,
struct __fprobe_header {
struct fprobe *fp;
unsigned long size_words;
-} __packed;
+};

Does "__packed" really do anything between a pointer and a long?

If that structure is allocated at a non-void-ptr-aligned address, the
packed attribute will ensure that the compiler don't emit instructions
that require aligned loads/stores when accessing those fields.

It does not change the layout of the structure per se in this specific
case, but it informs the compiler about the lack of guarantees about
alignment for the entire structure.

x86 32/64 cannot care less about this, but it's relevant on other
architectures.

Thanks,

Mathieu

--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com