lkml.org 
[lkml]   [2022]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3] ftrace: Add FTRACE_MCOUNT_MAX_OFFSET to avoid adding weak functions
On Thu, 26 May 2022 10:38:10 -0400 Steven Rostedt <rostedt@goodmis.org> wrote:

> If an unused weak function was traced, it's call to fentry will still
> exist, which gets added into the __mcount_loc table. Ftrace will use
> kallsyms to retrieve the name for each location in __mcount_loc to display
> it in the available_filter_functions and used to enable functions via the
> name matching in set_ftrace_filter/notrace. Enabling these functions do
> nothing but enable an unused call to ftrace_caller. If a traced weak
> function is overridden, the symbol of the function would be used for it,
> which will either created duplicate names, or if the previous function was
> not traced, it would be incorrectly listed in available_filter_functions
> as a function that can be traced.

This might be dependent on binutils version. In some situations the
unused __weak function might be dropped altogether. This change
(https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=d1bcae833b32f1)
tripped up recordmcount
(https://lore.kernel.org/all/20220518181828.645877-1-naveen.n.rao@linux.vnet.ibm.com/T/#u).

The kexec fix will be to just give up on using __weak.

\
 
 \ /
  Last update: 2022-05-26 19:06    [W:0.081 / U:0.752 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site