diff mbox series

package.bbclass: Avoid stripping signed kernel modules in splitdebuginfo

Message ID 20220710153638.61096-1-christoph.lauer@email.de
State New
Headers show
Series package.bbclass: Avoid stripping signed kernel modules in splitdebuginfo | expand

Commit Message

Christoph Lauer July 10, 2022, 3:36 p.m. UTC
From: Christoph Lauer <christoph.lauer@xtronic.de>

Since commit d756b346f248df47b0540644adb1d0f17bcc4b6e kernel modules are stripped by the functions 'runstrip' and 'splitdebuginfo'. Signed modules must not be stripped. Function 'runstrip' avoids this by running is_kernel_module_signed. Apply the same check to splitdebuginfo.

Signed-off-by: Christoph Lauer <christoph.lauer@xtronic.de>
---
 meta/classes/package.bbclass | 4 ++++
 1 file changed, 4 insertions(+)

--
2.17.1

Comments

Richard Purdie July 11, 2022, 8:29 a.m. UTC | #1
On Sun, 2022-07-10 at 17:36 +0200, Christoph Lauer wrote:
> From: Christoph Lauer <christoph.lauer@xtronic.de>
> 
> Since commit d756b346f248df47b0540644adb1d0f17bcc4b6e kernel modules are stripped by the functions 'runstrip' and 'splitdebuginfo'. Signed modules must not be stripped. Function 'runstrip' avoids this by running is_kernel_module_signed. Apply the same check to splitdebuginfo.
> 
> Signed-off-by: Christoph Lauer <christoph.lauer@xtronic.de>
> ---
>  meta/classes/package.bbclass | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
> index 4850134022..5328c6bc8b 100644
> --- a/meta/classes/package.bbclass
> +++ b/meta/classes/package.bbclass
> @@ -382,6 +382,10 @@ def splitdebuginfo(file, dvar, dv, d):
>      debugfile = dvar + dest
>      sources = []
> 
> +    if oe.package.is_kernel_module_signed(file):
> +        bb.debug(1, "Skip strip on signed module %s" % file)
> +        return (file, sources)
> +
>      # Split the file...
>      bb.utils.mkdirhier(os.path.dirname(debugfile))
>      #bb.note("Split %s -> %s" % (file, debugfile))

This isn't as simple as it may first appear. That is going to do open()
and read() calls on many files which aren't kernel modules and it will
impact the speed of the do_package task for recipes with large numbers
of files (perl, ltp and so on).

Cam we use the filename to limit which ones we scan a bit?
Even something like:

if ".ko" in file:

would help a lot but I'm not sure that covers everything.

Cheers,

Richard
Christoph Lauer July 12, 2022, 10:26 p.m. UTC | #2
Thank you for your input. The package function 'is_elf' can perform the
check if the current file is a kernel module. I will add another
condition to the patch.

Am 11.07.22 um 10:29 schrieb Richard Purdie:
> On Sun, 2022-07-10 at 17:36 +0200, Christoph Lauer wrote:
>> From: Christoph Lauer <christoph.lauer@xtronic.de>
>>
>> Since commit d756b346f248df47b0540644adb1d0f17bcc4b6e kernel modules are stripped by the functions 'runstrip' and 'splitdebuginfo'. Signed modules must not be stripped. Function 'runstrip' avoids this by running is_kernel_module_signed. Apply the same check to splitdebuginfo.
>>
>> Signed-off-by: Christoph Lauer <christoph.lauer@xtronic.de>
>> ---
>>   meta/classes/package.bbclass | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
>> index 4850134022..5328c6bc8b 100644
>> --- a/meta/classes/package.bbclass
>> +++ b/meta/classes/package.bbclass
>> @@ -382,6 +382,10 @@ def splitdebuginfo(file, dvar, dv, d):
>>       debugfile = dvar + dest
>>       sources = []
>>
>> +    if oe.package.is_kernel_module_signed(file):
>> +        bb.debug(1, "Skip strip on signed module %s" % file)
>> +        return (file, sources)
>> +
>>       # Split the file...
>>       bb.utils.mkdirhier(os.path.dirname(debugfile))
>>       #bb.note("Split %s -> %s" % (file, debugfile))
>
> This isn't as simple as it may first appear. That is going to do open()
> and read() calls on many files which aren't kernel modules and it will
> impact the speed of the do_package task for recipes with large numbers
> of files (perl, ltp and so on).
>
> Cam we use the filename to limit which ones we scan a bit?
> Even something like:
>
> if ".ko" in file:
>
> would help a lot but I'm not sure that covers everything.
>
> Cheers,
>
> Richard
>
diff mbox series

Patch

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 4850134022..5328c6bc8b 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -382,6 +382,10 @@  def splitdebuginfo(file, dvar, dv, d):
     debugfile = dvar + dest
     sources = []

+    if oe.package.is_kernel_module_signed(file):
+        bb.debug(1, "Skip strip on signed module %s" % file)
+        return (file, sources)
+
     # Split the file...
     bb.utils.mkdirhier(os.path.dirname(debugfile))
     #bb.note("Split %s -> %s" % (file, debugfile))