Re: [PATCH v2] x86/lib: Do not use local symbols with SYM_CODE_START_LOCAL()

From: Nadav Amit
Date: Fri May 26 2023 - 13:29:58 EST

> On May 26, 2023, at 8:53 AM, Borislav Petkov <bp@xxxxxxxxx> wrote:
> On Thu, May 25, 2023 at 12:39:47PM -0700, Nadav Amit wrote:
>> I do not think in this tradeoff not exposing local names worth
>> preventing profilers (and their users) from understanding where a
>> sample/trace is was taken. If for instance you look at a branch
>> trace (e.g., using Intel PT) you want to see the symbol to which a
>> branch goes to.
> If those functions were written in C, you wouldn't see any
> exception-handling symbols either. It is the fact that they're asm
> and the exception labels are defined "out-of-line" so that you don't
> have code duplication and thus are symbols outside of the respective
> functions.

According to my experience any or virtually any code address, C or asm,
can be mapped back to a symbol. I say virtually all, but it is actually
all the code addresses that I encountered.

Can you give me some examples for code whose address cannot be mapped
back to a symbol?

> So you'd have to give a lot more detailed example where making those
> symbols global, helps.

I did not ask to make them global. Just to keep them as local after
linkage in the executable, like all other functions in the kernel.

> And if those symbols are going to be global, then they better have more
> descriptive names as they're gonna be pretty much independent functions.
> Something like __get_user_handle_exception() or so.

I can do that.