Re: [PATCH 00/14] scripts/sorttable: ftrace: Remove place holders for weak functions in available_filter_functions

Steven Rostedt
2025-01-02T19:22:52Z

On Thu, 02 Jan 2025 13:58:45 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:

> The last patch adds the option "-s <file>" to sorttable.c. Now this code
> is called by:
>
> ${NM} -S vmlinux > .tmp_vmlinux.nm-sort
> ${objtree}/scripts/sorttable -s .tmp_vmlinux.nm-sort ${1}
>
> Where the file created by "nm -S" is read, recording the address
> and the associated sizes of each function. It then is sorted, and
> before sorting the mcount_loc table, it is scanned to make sure
> all symbols in the mcounc_loc are within the boundaries of the functions
> defined by nm. If they are not, they are zeroed out, as they are most
> likely weak functions (I don't know what else they would be).
>
> Then on boot up, when creating the ftrace tables from the mcount_loc
> table, it will ignore any function that matches the kaslr_offset()
> value. As KASLR will still shift the values even if they are zero.
> But by skipping over entries in mcount_loc that match kaslr_offset()
> all weak functions are removed from the ftrace table as well as the
> available_filter_functions file that is derived from it.
>

I mentioned this in the last patch, but forgot to mention it here.

Even if kallsyms is "fixed" where it doesn't return the name of a function
if the address is outside its size, that doesn't fix the place holder issue
with available_filter_functions. That would just make it easier to know a
function doesn't have a name, but a place holder is still required.

This patch set removes those place holders regardless of kallsyms being
fixed or not.

-- Steve