"Masami Hiramatsu (Google)" <mhiramat@xxxxxxxxxx> writes: > From: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx> > > Rewrite fprobe implementation on function-graph tracer. > Major API changes are: > - 'nr_maxactive' field is deprecated. > - This depends on CONFIG_DYNAMIC_FTRACE_WITH_ARGS or > !CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS, and > CONFIG_HAVE_FUNCTION_GRAPH_FREGS. So currently works only > on x86_64. > - Currently the entry size is limited in 15 * sizeof(long). > - If there is too many fprobe exit handler set on the same > function, it will fail to probe. > > Signed-off-by: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx> > Cc: Steven Rostedt <rostedt@xxxxxxxxxxx> > Cc: Mark Rutland <mark.rutland@xxxxxxx> > Cc: Catalin Marinas <catalin.marinas@xxxxxxx> > Cc: Will Deacon <will@xxxxxxxxxx> > Cc: Huacai Chen <chenhuacai@xxxxxxxxxx> > Cc: WANG Xuerui <kernel@xxxxxxxxxx> > Cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx> > Cc: Nicholas Piggin <npiggin@xxxxxxxxx> > Cc: Christophe Leroy <christophe.leroy@xxxxxxxxxx> > Cc: Naveen N Rao <naveen@xxxxxxxxxx> > Cc: Madhavan Srinivasan <maddy@xxxxxxxxxxxxx> > Cc: Paul Walmsley <paul.walmsley@xxxxxxxxxx> > Cc: Palmer Dabbelt <palmer@xxxxxxxxxxx> > Cc: Albert Ou <aou@xxxxxxxxxxxxxxxxx> > Cc: Heiko Carstens <hca@xxxxxxxxxxxxx> > Cc: Vasily Gorbik <gor@xxxxxxxxxxxxx> > Cc: Alexander Gordeev <agordeev@xxxxxxxxxxxxx> > Cc: Christian Borntraeger <borntraeger@xxxxxxxxxxxxx> > Cc: Sven Schnelle <svens@xxxxxxxxxxxxx> > Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> > Cc: Ingo Molnar <mingo@xxxxxxxxxx> > Cc: Borislav Petkov <bp@xxxxxxxxx> > Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx> > Cc: x86@xxxxxxxxxx > Cc: "H. Peter Anvin" <hpa@xxxxxxxxx> > Cc: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx> > Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> > [..] > diff --git a/include/linux/fprobe.h b/include/linux/fprobe.h > index ef609bcca0f9..2d06bbd99601 100644 > --- a/include/linux/fprobe.h > +++ b/include/linux/fprobe.h > @@ -5,10 +5,11 @@ [..] > +static inline unsigned long encode_fprobe_header(struct fprobe *fp, int size_words) > +{ > + if (WARN_ON_ONCE(size_words > MAX_FPROBE_DATA_SIZE_WORD || > + ((unsigned long)fp & ~FPROBE_HEADER_PTR_MASK) != > + ~FPROBE_HEADER_PTR_MASK)) { > + return 0; > } > + return ((unsigned long)size_words << FPROBE_HEADER_PTR_BITS) | > + ((unsigned long)fp & FPROBE_HEADER_PTR_MASK); > +} > + > +/* Return reserved data size in words */ > +static inline int decode_fprobe_header(unsigned long val, struct fprobe **fp) > +{ > + unsigned long ptr; > + > + ptr = (val & FPROBE_HEADER_PTR_MASK) | ~FPROBE_HEADER_PTR_MASK; > + if (fp) > + *fp = (struct fprobe *)ptr; > + return val >> FPROBE_HEADER_PTR_BITS; > +} I think that still has the issue that the size is encoded in the leftmost fields of the pointer, which doesn't work on all architectures. I reported this already in v15 (https://lore.kernel.org/all/yt9dmsjyx067.fsf@xxxxxxxxxxxxx/)