All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vimal Agrawal <avimalin@gmail.com>
To: Luis Chamberlain <mcgrof@kernel.org>
Cc: Vimal Agrawal <vimal.Agrawal@sophos.com>,
	Christoph Hellwig <hch@infradead.org>,
	Masahiro Yamada <masahiroy@kernel.org>,
	Michal Marek <michal.lkml@markovi.net>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Jan Beulich <JBeulich@suse.com>, Jeff Mahoney <jeffm@suse.com>,
	Sam Ravnborg <sam@ravnborg.org>,
	linux-kbuild@vger.kernel.org, jeyu@kernel.org,
	linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org
Subject: Re: [PATCH v3] kernel/module.c: heuristic enhancement in case symbols are missing e.g. when INSTALL_MOD_STRIP= "--strip-unneeded" is used
Date: Thu, 3 Feb 2022 11:24:36 +0530	[thread overview]
Message-ID: <CALkUMdTeyfv7aPeQZMXjNK67Buuw6uiVWU0iMQajuGU9TSKm+Q@mail.gmail.com> (raw)
In-Reply-To: <Yfrncd3voPOB7PdB@bombadil.infradead.org>

Hi Luis,

> Try:
>
> modules: add heuristic when stripping unneeded symbols
>
> Then please describe in your commit log that on OpenWrt the
> INSTALL_MOD_STRIP="--strip-unneeded" at kernel/module install
> time, and so modules are stripped of unneeded symbols.
Yes, Thanks, I will send the updated patch shortly.

> Sorry but for some reason this is not working on my end, but then
> again I'm not able to get the stripped out results you see either.
> So it could be I just have too many debugging options enabled
> that makes INSTALL_MOD_STRIP="--strip-unneeded" not really do
> much. I don't know if that is possible but I will have to try
> to reduce my build options to test.

Yes, there could be some dependencies due to other debug options and
it may not be able to strip it to a good extent.

Are you trying with changes in test_module.c?
I was able to reproduce it easily on ubuntu 21.10 with following patch:

diff --git a/lib/test_module.c b/lib/test_module.c
index debd19e35198..53578e7a34d7 100644
--- a/lib/test_module.c
+++ b/lib/test_module.c
@@ -14,10 +14,25 @@
 #include <linux/module.h>
 #include <linux/printk.h>

+static void test_module_warn_start(int x)
+{
+        if (x) WARN_ON_ONCE(1);
+}
+
+static void __init test_module_warn_init(int x)
+{
+        if (x) WARN_ON_ONCE(1);
+}
+
+
 static int __init test_module_init(void)
 {
  pr_warn("Hello, world\n");
+        printk("address of test_module_warn_int is %px\n",
test_module_warn_init);
+        printk("address of test_module_warn_start is %px\n",
test_module_warn_start);

+ test_module_warn_init(1);
+ test_module_warn_start(1);
  return 0;
 }

After building this module, I used the following command to strip it:
> strip --strip-unneeded test_module.ko
and then loaded the stripped .ko using insmod.

Vimal

  reply	other threads:[~2022-02-03  5:54 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <LO2P265MB2671DF8D82C0C6A1504D85D6939F9@LO2P265MB2671.GBRP265.PROD.OUTLOOK.COM>
     [not found] ` <LO2P265MB267173F563B0A2CA5995FA2C939F9@LO2P265MB2671.GBRP265.PROD.OUTLOOK.COM>
2021-11-22 14:02   ` [PATCH] kernel/module.c: fix for symbol decode in stack trace for stripped modules Vimal Agrawal
2021-12-08 19:33     ` Luis Chamberlain
2021-12-09  5:37       ` Vimal Agrawal
2021-12-09 20:40         ` Luis Chamberlain
2021-12-20  8:57           ` Vimal Agrawal
2021-12-20 19:21             ` Luis Chamberlain
2021-12-21  9:06               ` Vimal Agrawal
2021-12-21 17:16                 ` Vimal Agrawal
2021-12-21 22:45                   ` Luis Chamberlain
2021-12-21 22:46                 ` Luis Chamberlain
2021-12-22 13:23                   ` [PATCH v2] kernel/module.c: heuristic enhancement when INSTALL_MOD_STRIP= "--strip-unneeded" is used Vimal Agrawal
2021-12-23 10:36                     ` Christoph Hellwig
2021-12-23 11:09                       ` Vimal Agrawal
2021-12-24  6:47                         ` Christoph Hellwig
2021-12-25  1:08                           ` Vimal Agrawal
2022-01-11 15:49                             ` Luis Chamberlain
2022-01-12  8:36                               ` Vimal Agrawal
2022-01-13 15:23                                 ` Luis Chamberlain
2022-01-17  6:54                                   ` [PATCH v3] kernel/module.c: heuristic enhancement in case symbols are missing e.g. " Vimal Agrawal
2022-02-02 20:20                                     ` Luis Chamberlain
2022-02-03  5:54                                       ` Vimal Agrawal [this message]
2022-02-03  6:06                                       ` [PATCH v4] modules: add heuristic when stripping unneeded symbols Vimal Agrawal
2022-02-04  8:39                                         ` [PATCH v5] " Vimal Agrawal
2022-02-04 21:47                                           ` Luis Chamberlain
2022-02-07 13:21                                             ` Vimal Agrawal
2022-02-07 22:07                                               ` Luis Chamberlain
2022-02-08  4:52                                                 ` Vimal Agrawal
2022-02-08 11:02                                                   ` [PATCH v6] " Vimal Agrawal
2022-02-08 11:13                                                     ` Vimal Agrawal
2022-02-08 18:10                                                     ` Luis Chamberlain
2022-02-08 18:25                                                       ` Vimal Agrawal
2022-02-25  7:59                                                         ` Vimal Agrawal
2022-02-25 13:40                                                           ` Vimal Agrawal
2022-02-08 17:55                                                   ` [PATCH v5] " Luis Chamberlain
2022-02-08 18:12                                                     ` Vimal Agrawal
2022-01-17  7:34                                   ` [PATCH v2] kernel/module.c: heuristic enhancement when INSTALL_MOD_STRIP= "--strip-unneeded" is used Vimal Agrawal

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=CALkUMdTeyfv7aPeQZMXjNK67Buuw6uiVWU0iMQajuGU9TSKm+Q@mail.gmail.com \
    --to=avimalin@gmail.com \
    --cc=JBeulich@suse.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@infradead.org \
    --cc=jeffm@suse.com \
    --cc=jeyu@kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=ndesaulniers@google.com \
    --cc=sam@ravnborg.org \
    --cc=vimal.Agrawal@sophos.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.