[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALkUMdTeyfv7aPeQZMXjNK67Buuw6uiVWU0iMQajuGU9TSKm+Q@mail.gmail.com>
Date: Thu, 3 Feb 2022 11:24:36 +0530
From: Vimal Agrawal <avimalin@...il.com>
To: Luis Chamberlain <mcgrof@...nel.org>
Cc: Vimal Agrawal <vimal.Agrawal@...hos.com>,
Christoph Hellwig <hch@...radead.org>,
Masahiro Yamada <masahiroy@...nel.org>,
Michal Marek <michal.lkml@...kovi.net>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Jan Beulich <JBeulich@...e.com>, Jeff Mahoney <jeffm@...e.com>,
Sam Ravnborg <sam@...nborg.org>, linux-kbuild@...r.kernel.org,
jeyu@...nel.org, linux-kernel@...r.kernel.org,
gregkh@...uxfoundation.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
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
Powered by blists - more mailing lists