All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] package.bbclass: Avoid stripping signed kernel modules in splitdebuginfo
@ 2022-07-12 22:29 Christoph Lauer
  2022-07-12 22:37 ` [OE-core] " Richard Purdie
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Lauer @ 2022-07-12 22:29 UTC (permalink / raw)
  To: openembedded-core; +Cc: Christoph Lauer

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 | 5 +++++
 1 file changed, 5 insertions(+)

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

+    if oe.package.is_elf(file)[1] & 16:
+        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))
--
2.17.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [OE-core] [PATCH v2] package.bbclass: Avoid stripping signed kernel modules in splitdebuginfo
  2022-07-12 22:29 [PATCH v2] package.bbclass: Avoid stripping signed kernel modules in splitdebuginfo Christoph Lauer
@ 2022-07-12 22:37 ` Richard Purdie
  2022-07-13 21:21   ` Christoph Lauer
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Purdie @ 2022-07-12 22:37 UTC (permalink / raw)
  To: Christoph Lauer, openembedded-core; +Cc: Christoph Lauer

On Wed, 2022-07-13 at 00:29 +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 | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
> index 4850134022..78ec96df85 100644
> --- a/meta/classes/package.bbclass
> +++ b/meta/classes/package.bbclass
> @@ -382,6 +382,11 @@ def splitdebuginfo(file, dvar, dv, d):
>      debugfile = dvar + dest
>      sources = []
> 
> +    if oe.package.is_elf(file)[1] & 16:
> +        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))

That is better but I think we can do better still. splitdebuginfo is
called as:

results = oe.utils.multiprocess_launch(splitdebuginfo, list(elffiles), d, extraargs=(dvar, dv, d))

and earlier in the function there is also:

results = oe.utils.multiprocess_launch(oe.package.is_elf, checkelf.keys(), d)

i.e. we already probably called is_elf() which isn't a cheap operation either.

I think we can tweak things so we reuse that data?

Cheers,

Richard





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [OE-core] [PATCH v2] package.bbclass: Avoid stripping signed kernel modules in splitdebuginfo
  2022-07-12 22:37 ` [OE-core] " Richard Purdie
@ 2022-07-13 21:21   ` Christoph Lauer
  0 siblings, 0 replies; 3+ messages in thread
From: Christoph Lauer @ 2022-07-13 21:21 UTC (permalink / raw)
  To: openembedded-core


Am 13.07.22 um 00:37 schrieb Richard Purdie:
> On Wed, 2022-07-13 at 00:29 +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 | 5 +++++
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
>> index 4850134022..78ec96df85 100644
>> --- a/meta/classes/package.bbclass
>> +++ b/meta/classes/package.bbclass
>> @@ -382,6 +382,11 @@ def splitdebuginfo(file, dvar, dv, d):
>>       debugfile = dvar + dest
>>       sources = []
>>
>> +    if oe.package.is_elf(file)[1] & 16:
>> +        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))
>
> That is better but I think we can do better still. splitdebuginfo is
> called as:
>
> results = oe.utils.multiprocess_launch(splitdebuginfo, list(elffiles), d, extraargs=(dvar, dv, d))
>
> and earlier in the function there is also:
>
> results = oe.utils.multiprocess_launch(oe.package.is_elf, checkelf.keys(), d)
>
> i.e. we already probably called is_elf() which isn't a cheap operation either.
>
> I think we can tweak things so we reuse that data?
>
> Cheers,
>
> Richard
>
>
>
Sorry for double-posting, my last mail did not reply to this conversation:
You're correct that oe.package.is_elf already ran on the file before
splitdebuginfo is called, but the result is currently not available to
splitdebuginfo AFAIS. It could be by extending the parameters and what
not, but I'm too lazy to do that for what was meant to be a rather small
change. Instead I'll follow your first suggestion to check on file
extension and file location (as is_elf does too). That should cover all
kernel modules and is specific enough to avoid false positives.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-13 21:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-12 22:29 [PATCH v2] package.bbclass: Avoid stripping signed kernel modules in splitdebuginfo Christoph Lauer
2022-07-12 22:37 ` [OE-core] " Richard Purdie
2022-07-13 21:21   ` Christoph Lauer

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.