All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] systemd: Improve detection of executables and libraries
@ 2026-10-27 15:29 Anusmita Dutta Mazumder
  2026-10-29 11:35 ` Paul Barker
  0 siblings, 1 reply; 3+ messages in thread
From: Anusmita Dutta Mazumder @ 2026-10-27 15:29 UTC (permalink / raw)
  To: openembedded-core; +Cc: Anusmita Dutta Mazumder

Use cached mode bits to detect executables independently of
host access permissions. Match shared-library basenames with
a regex to avoid matching directory names.

Signed-off-by: Anusmita Dutta Mazumder <anusmita.duttamazumder@arm.com>
---
 meta/recipes-core/systemd/dlopen-deps.inc | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-core/systemd/dlopen-deps.inc b/meta/recipes-core/systemd/dlopen-deps.inc
index 37074a9682..4ce9845ad8 100644
--- a/meta/recipes-core/systemd/dlopen-deps.inc
+++ b/meta/recipes-core/systemd/dlopen-deps.inc
@@ -3,7 +3,7 @@ PACKAGEFUNCS =+ "package_generate_dlopen_deps"
 python package_generate_dlopen_deps() {
     # https://systemd.io/ELF_DLOPEN_METADATA/
 
-    import os, struct, json
+    import os, struct, json, re
 
     def extract_segment(filename, segment):
         """
@@ -49,6 +49,7 @@ python package_generate_dlopen_deps() {
     }
 
     shlibs = oe.package.read_shlib_providers(d)
+    shlib_pattern = re.compile(r"\.so(\.|$)")
 
     for pkg, files in pkgfiles.items():
         # Skip -dbg packages as we won't need to generate dependencies for those
@@ -61,7 +62,8 @@ python package_generate_dlopen_deps() {
             if cpath.islink(f):
                 continue
 
-            if os.access(f, os.X_OK) or ".so." in f or f.endswith(".so"):
+            # Scan shared libraries and executable files for dlopen notes.
+            if shlib_pattern.search(os.path.basename(f)) or cpath.is_executable(f):
                 try:
                     elf = oe.qa.ELFFile(f)
                     elf.open()

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

* Re: [PATCH] systemd: Improve detection of executables and libraries
  2026-10-27 15:29 [PATCH] systemd: Improve detection of executables and libraries Anusmita Dutta Mazumder
@ 2026-10-29 11:35 ` Paul Barker
  2026-10-29 16:27   ` Anusmita Dutta Mazumder
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Barker @ 2026-10-29 11:35 UTC (permalink / raw)
  To: Anusmita Dutta Mazumder, openembedded-core

On Tue, 2026-10-27 at 15:29 +0000, Anusmita Dutta Mazumder wrote:
> Use cached mode bits to detect executables independently of
> host access permissions. Match shared-library basenames with
> a regex to avoid matching directory names.
> 
> Signed-off-by: Anusmita Dutta Mazumder <anusmita.duttamazumder@arm.com>
> ---
>  meta/recipes-core/systemd/dlopen-deps.inc | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/recipes-core/systemd/dlopen-deps.inc b/meta/recipes-core/systemd/dlopen-deps.inc
> index 37074a9682..4ce9845ad8 100644
> --- a/meta/recipes-core/systemd/dlopen-deps.inc
> +++ b/meta/recipes-core/systemd/dlopen-deps.inc
> @@ -3,7 +3,7 @@ PACKAGEFUNCS =+ "package_generate_dlopen_deps"
>  python package_generate_dlopen_deps() {
>      # https://systemd.io/ELF_DLOPEN_METADATA/
>  
> -    import os, struct, json
> +    import os, struct, json, re
>  
>      def extract_segment(filename, segment):
>          """
> @@ -49,6 +49,7 @@ python package_generate_dlopen_deps() {
>      }
>  
>      shlibs = oe.package.read_shlib_providers(d)
> +    shlib_pattern = re.compile(r"\.so(\.|$)")
>  
>      for pkg, files in pkgfiles.items():
>          # Skip -dbg packages as we won't need to generate dependencies for those
> @@ -61,7 +62,8 @@ python package_generate_dlopen_deps() {
>              if cpath.islink(f):
>                  continue
>  
> -            if os.access(f, os.X_OK) or ".so." in f or f.endswith(".so"):
> +            # Scan shared libraries and executable files for dlopen notes.
> +            if shlib_pattern.search(os.path.basename(f)) or cpath.is_executable(f):

Hi,

Thanks for the patch. The switch to is_executable() looks good, but the
regex is more complex than the existing code. Could we use something
like the following?

    if cpath.is_executable(f) or ".so." in os.path.basename(f) or f.endswith(".so"):
        ...

Best regards,

-- 
Paul Barker


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

* Re: [PATCH] systemd: Improve detection of executables and libraries
  2026-10-29 11:35 ` Paul Barker
@ 2026-10-29 16:27   ` Anusmita Dutta Mazumder
  0 siblings, 0 replies; 3+ messages in thread
From: Anusmita Dutta Mazumder @ 2026-10-29 16:27 UTC (permalink / raw)
  To: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 174 bytes --]

Hi Paul,
Thank you for the suggestion. That looks simpler and keeps the intended behaviour. I’ll replace the regex with these checks and send a v2.

Regards,
Anusmita

[-- Attachment #2: Type: text/html, Size: 205 bytes --]

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

end of thread, other threads:[~2026-10-29 16:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-27 15:29 [PATCH] systemd: Improve detection of executables and libraries Anusmita Dutta Mazumder
2026-10-29 11:35 ` Paul Barker
2026-10-29 16:27   ` Anusmita Dutta Mazumder

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.