On Thu, 2 Jan 2025 11:30:12 -0800 Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote: > Please just do this by sorting non-existent functions at the end, > instead of just zeroing them out. > > That makes the mcount_loc table dense in valid entries. We could then > just rewrite the size of the table (or just add a variable containing > the size, if you don't want to change ELF metadata - but you're > already sorting the table, so why not?) > > Because: > > > 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. > > Why even do that? Why not just make the mcount_loc table be proper in > the first place. I was a bit nervous about changing the stop_mcount_loc value. I thought of doing that first, but then I noticed that the value is found by looking at the System.map file and not from the object itself. Changing it in the object will require some more elf parsing. Just zeroing out didn't require that. I'm fine with adding that, but it will take some more elf foo magic, and my time to work on this is coming near its end. To do this, I believe the symbol table will need to be searched for the __stop_mcount_loc. This could be a clean up as well, as I don't really like that the code does a search of System.map, and reading it from the object file may be more robust. Then when we have the values from the object file, we should also be able to modify it. -- Steve