mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nadav Amit <nadav.amit@gmail.com>
To: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@intel.com>,
	Jiri Slaby <jirislaby@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	X86 ML <x86@kernel.org>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] x86/lib: Do not use local symbols with SYM_CODE_START_LOCAL()
Date: Fri, 26 May 2023 14:10:47 -0700	[thread overview]
Message-ID: <D63AB9E6-BA52-4E24-B8EF-C7B9DB1595CC@gmail.com> (raw)
In-Reply-To: <20230526204559.GAZHEahxxnQaHhSUul@nazgul.local>



> On May 26, 2023, at 1:45 PM, Borislav Petkov <bp@alien8.de> wrote:
> 
> On Fri, May 26, 2023 at 10:29:29AM -0700, Nadav Amit wrote:
>> Can you give me some examples for code whose address cannot be mapped
>> back to a symbol?
> 
> No, this is not what I'm talking about.
> 
> I'm talking about all the local labels the compiler uses. For example:
> 
> $ make kernel/sched/core.s
> $ grep -E "^\.L" kernel/sched/core.s | wc -l
> 2799
> 
> All those local labels are not in the symbol table (get discarded) and
> the addresses they represent are shown as belonging to the containing
> function.

Right. But the symbols I mentioned are not contained in any other symbol.
If you run gdb and try to disasm this bad_get_user_clac (its address),
you’d currently get "No function contains specified address”.

That what makes these 2 symbols different than the others.

> 
>> 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.
> 
> Ok, not global. But local and present in the symbol table:
> 
> 105185: ffffffff81b89330    17 NOTYPE  LOCAL  DEFAULT    1 bad_get_user_clac
> 
> And again, this helps how exactly?

Allowing debuggers, tracers, disassemblers and instrumentation tools to
work the same way they work as they work with any other piece of code in
the kernel.

I personally work on code instrumentation and this makes my life hard for
no good reason.

[ Perhaps the question should go the other way around: why addresses of
code in these functions should not be mapped to any symbol? ]


  reply	other threads:[~2023-05-26 21:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-25 18:42 Nadav Amit
2023-05-25 19:05 ` Dave Hansen
2023-05-25 19:39   ` Nadav Amit
2023-05-26  6:24     ` Jiri Slaby
2023-05-26 15:53     ` Borislav Petkov
2023-05-26 17:29       ` Nadav Amit
2023-05-26 20:45         ` Borislav Petkov
2023-05-26 21:10           ` Nadav Amit [this message]
2023-05-26 21:17             ` Dave Hansen
2023-05-26 21:55               ` Nadav Amit
2023-05-27  7:23                 ` Borislav Petkov
2023-05-27  9:17                   ` Nadav Amit
2023-05-27 12:29                     ` Borislav Petkov
2023-05-27 13:09                       ` Nadav Amit
2023-06-02  0:53                       ` Nadav Amit
2023-06-02  8:59 ` [tip: x86/misc] x86/lib: Make get/put_user() exception handling a visible symbol tip-bot2 for Nadav Amit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D63AB9E6-BA52-4E24-B8EF-C7B9DB1595CC@gmail.com \
    --to=nadav.amit@gmail.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®