public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: "wcohen at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: systemtap@sourceware.org
Subject: [Bug runtime/30415] conflicting types for ‘kallsyms_on_each_symbol’
Date: Thu, 25 May 2023 18:43:46 +0000	[thread overview]
Message-ID: <bug-30415-6586-nwS5MlzpPo@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-30415-6586@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=30415

--- Comment #9 from William Cohen <wcohen at redhat dot com> ---
Hi Martin,

The kallsyms_on_each_symbol in runtime/sym.c is acting a wrapper for the
non-export kernel kallsyms_on_each_symbol. 

In older linux 5.11 and older versions of the kernel's kallsyms_on_each_symbol
the code iterates through the kernel's symbols.  If none of the callback
functions return a non zero value, then then module_kallsyms_on_each_symbol is
called: https://elixir.bootlin.com/linux/v4.20.17/source/kernel/kallsyms.c#L178
.  However, in linux 5.12 kernels and newer
https://elixir.bootlin.com/linux/v5.12/source/kernel/kallsyms.c#L185 the
module_kallsyms_on_each_symbol at the end of function has been removed.  The
was changed by kernel git commit 013c1667cf78c1d847152f7116436d82dcab3db4.  

The module_kallsyms_on_each_symbol callback includes the struct module
argument,
https://elixir.bootlin.com/linux/v5.11.22/source/kernel/module.c#L4499 . 
Looking at how these functions are used in live patching.  The live patching
makes a distinction between the kernel and modules.

It looks like need to have two callback functions: one for kernels and one for
modules, but might be able to make the kernel just a wrapper to the module
callback, the existing stapkp_symbol_callback.  Then would need code to find
the module_kallsyms_on_each_function and have two passes: one for the kernel
and one for the modules. 

One other concern about the relocation mechanism is how to make sure that
getting the correct symbol as names may not be unique.  There can be multiple
symbols with the same name in kallsym output. This can be observed with the
following :

sudo cat /proc/kallsyms | awk '{print $3}' |sort |uniq -c |grep -v " 1 " |sort
-nr | more

-- 
You are receiving this mail because:
You are the assignee for the bug.

  parent reply	other threads:[~2023-05-25 18:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-03  8:56 [Bug runtime/30415] New: " mcermak at redhat dot com
2023-05-03  9:01 ` [Bug runtime/30415] " mcermak at redhat dot com
2023-05-03 10:41 ` mcermak at redhat dot com
2023-05-09 19:23 ` wcohen at redhat dot com
2023-05-22  8:56 ` mcermak at redhat dot com
2023-05-22 14:01 ` wcohen at redhat dot com
2023-05-22 14:48 ` wcohen at redhat dot com
2023-05-24 11:16 ` mcermak at redhat dot com
2023-05-24 11:24 ` mcermak at redhat dot com
2023-05-25 18:43 ` wcohen at redhat dot com [this message]
2023-05-26 10:28 ` mcermak at redhat dot com
2023-05-30 14:51 ` mcermak at redhat dot com
2023-05-31 13:59 ` wcohen at redhat dot com
2023-06-02  9:28 ` mcermak at redhat dot com
2023-06-02 15:22 ` wcohen at redhat dot com
2023-06-02 18:26 ` mcermak at redhat dot com
2023-06-02 21:21 ` wcohen at redhat dot com
2023-06-02 21:38 ` mcermak at redhat dot com

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=bug-30415-6586-nwS5MlzpPo@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=systemtap@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).