* Re: [PATCH v2] insane: make GNU_HASH check slightly more robust (avoids false negatives with gold); add check for useless rpaths
@ 2011-07-14 9:02 Phil Blundell
2011-07-14 14:07 ` Richard Purdie
2011-07-14 19:26 ` Koen Kooi
0 siblings, 2 replies; 6+ messages in thread
From: Phil Blundell @ 2011-07-14 9:02 UTC (permalink / raw)
To: oe-core
It isn't safe to make assumptions about the order of the entries in the dynamic section. Fix the ldflags test to cope with the case where GNU_HASH comes before NEEDED and/or INIT.
Also, add a new warning for binaries which contain useless (but benign) rpath entries pointing to the default search locations.
Signed-off-by: Phil Blundell <philb@gnu.org>
---
v2: fix typo in first version
meta/classes/insane.bbclass | 44 ++++++++++++++++++++++++++++++++----------
1 files changed, 33 insertions(+), 11 deletions(-)
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 8d5da00..c45f2cb 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -92,7 +92,7 @@ def package_qa_get_machine_dict():
}
-WARN_QA ?= "dev-so rpaths debug-deps dev-deps debug-files arch la2 pkgconfig desktop la ldflags perms"
+WARN_QA ?= "dev-so rpaths debug-deps dev-deps debug-files arch la2 pkgconfig desktop la ldflags perms useless-rpaths"
ERROR_QA ?= ""
#ERROR_QA ?= "rpaths debug-deps dev-deps debug-files arch pkgconfig perms"
@@ -141,6 +141,31 @@ def package_qa_check_rpath(file,name, d, elf, messages):
if dir in line:
messages.append("package %s contains bad RPATH %s in file %s" % (name, line, file))
+QAPATHTEST[useless-rpaths] = "package_qa_check_useless_rpaths"
+def package_qa_check_useless_rpaths(file,name, d, elf, messages):
+ """
+ Check for RPATHs that are useless but not dangerous
+ """
+ if not elf:
+ return
+
+ objdump = bb.data.getVar('OBJDUMP', d, True)
+ env_path = bb.data.getVar('PATH', d, True)
+
+ libdir = bb.data.getVar("libdir", d, True)
+ base_libdir = bb.data.getVar("base_libdir", d, True)
+
+ import re
+ rpath_re = re.compile("\s+RPATH\s+(.*)")
+ for line in os.popen("LC_ALL=C PATH=%s %s -p '%s' 2> /dev/null" % (env_path, objdump, file), "r"):
+ m = rpath_re.match(line)
+ if m:
+ rpath = m.group(1)
+ if rpath == libdir or rpath == base_libdir:
+ # The dynamic linker searches both these places anyway. There is no point in
+ # looking there again.
+ messages.append("dynamic section contains probably-redundant RPATH %s" % rpath)
+
QAPATHTEST[dev-so] = "package_qa_check_dev"
def package_qa_check_dev(path, name, d, elf, messages):
"""
@@ -238,22 +263,19 @@ def package_qa_hash_style(path, name, d, elf, messages):
objdump = bb.data.getVar('OBJDUMP', d, True)
env_path = bb.data.getVar('PATH', d, True)
- sane = True
- elf = False
- # A bit hacky. We do not know if path is an elf binary or not
- # we will search for 'NEEDED' or 'INIT' as this should be printed...
- # and come before the HASH section (guess!!!) and works on split out
- # debug symbols too
+ sane = False
+ has_syms = False
+
+ # If this binary has symbols, we expect it to have GNU_HASH too.
for line in os.popen("LC_ALL=C PATH=%s %s -p '%s' 2> /dev/null" % (env_path, objdump, path), "r"):
- if "NEEDED" in line or "INIT" in line:
- sane = False
- elf = True
+ if "SYMTAB" in line:
+ has_syms = True
if "GNU_HASH" in line:
sane = True
if "[mips32]" in line or "[mips64]" in line:
sane = True
- if elf and not sane:
+ if has_syms and not sane:
messages.append("No GNU_HASH in the elf binary: '%s'" % path)
--
1.7.4.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] insane: make GNU_HASH check slightly more robust (avoids false negatives with gold); add check for useless rpaths
2011-07-14 9:02 [PATCH v2] insane: make GNU_HASH check slightly more robust (avoids false negatives with gold); add check for useless rpaths Phil Blundell
@ 2011-07-14 14:07 ` Richard Purdie
2011-07-14 19:26 ` Koen Kooi
1 sibling, 0 replies; 6+ messages in thread
From: Richard Purdie @ 2011-07-14 14:07 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer
On Thu, 2011-07-14 at 10:02 +0100, Phil Blundell wrote:
> It isn't safe to make assumptions about the order of the entries in the dynamic section. Fix the ldflags test to cope with the case where GNU_HASH comes before NEEDED and/or INIT.
>
> Also, add a new warning for binaries which contain useless (but benign) rpath entries pointing to the default search locations.
>
> Signed-off-by: Phil Blundell <philb@gnu.org>
> ---
> v2: fix typo in first version
Merged to master, thanks.
Richard
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] insane: make GNU_HASH check slightly more robust (avoids false negatives with gold); add check for useless rpaths
2011-07-14 9:02 [PATCH v2] insane: make GNU_HASH check slightly more robust (avoids false negatives with gold); add check for useless rpaths Phil Blundell
2011-07-14 14:07 ` Richard Purdie
@ 2011-07-14 19:26 ` Koen Kooi
2011-07-15 11:21 ` Phil Blundell
1 sibling, 1 reply; 6+ messages in thread
From: Koen Kooi @ 2011-07-14 19:26 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer
Op 14 jul 2011, om 11:02 heeft Phil Blundell het volgende geschreven:
> It isn't safe to make assumptions about the order of the entries in the dynamic section. Fix the ldflags test to cope with the case where GNU_HASH comes before NEEDED and/or INIT.
>
> Also, add a new warning for binaries which contain useless (but benign) rpath entries pointing to the default search locations.
The new rpath warning is nice, but a bit too terse:
NOTE: package tinylogin-1.4-r7: task do_rm_work: Succeeded
WARNING: QA Issue: dynamic section contains probably-redundant RPATH /lib
WARNING: QA Issue: dynamic section contains probably-redundant RPATH /lib
WARNING: QA Issue: dynamic section contains probably-redundant RPATH /lib
WARNING: QA Issue: dynamic section contains probably-redundant RPATH /lib
WARNING: QA Issue: dynamic section contains probably-redundant RPATH /lib
WARNING: QA Issue: dynamic section contains probably-redundant RPATH /lib
WARNING: QA Issue: dynamic section contains probably-redundant RPATH /lib
WARNING: QA Issue: dynamic section contains probably-redundant RPATH /lib
WARNING: QA Issue: dynamic section contains probably-redundant RPATH /lib
WARNING: QA Issue: dynamic section contains probably-redundant RPATH /lib
WARNING: QA Issue: dynamic section contains probably-redundant RPATH /lib
WARNING: QA Issue: dynamic section contains probably-redundant RPATH /lib
WARNING: QA Issue: dynamic section contains probably-redundant RPATH /lib
WARNING: QA Issue: dynamic section contains probably-redundant RPATH /lib
WARNING: QA Issue: dynamic section contains probably-redundant RPATH /lib
WARNING: QA Issue: dynamic section contains probably-redundant RPATH /lib
NOTE: package shadow-4.1.4.3-r2: task do_package: Succeeded
I suspect it's shadow that has the rpaths, but I'm not sure. It think changing
> messages.append("dynamic section contains probably-redundant RPATH %s" % rpath)
to something like
> messages.append("dynamic section contains probably-redundant RPATH %s in %s" % (rpath, path))
Would improve things.
regards,
Koen
>
> Signed-off-by: Phil Blundell <philb@gnu.org>
> ---
> v2: fix typo in first version
>
> meta/classes/insane.bbclass | 44 ++++++++++++++++++++++++++++++++----------
> 1 files changed, 33 insertions(+), 11 deletions(-)
>
> diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
> index 8d5da00..c45f2cb 100644
> --- a/meta/classes/insane.bbclass
> +++ b/meta/classes/insane.bbclass
> @@ -92,7 +92,7 @@ def package_qa_get_machine_dict():
> }
>
>
> -WARN_QA ?= "dev-so rpaths debug-deps dev-deps debug-files arch la2 pkgconfig desktop la ldflags perms"
> +WARN_QA ?= "dev-so rpaths debug-deps dev-deps debug-files arch la2 pkgconfig desktop la ldflags perms useless-rpaths"
> ERROR_QA ?= ""
> #ERROR_QA ?= "rpaths debug-deps dev-deps debug-files arch pkgconfig perms"
>
> @@ -141,6 +141,31 @@ def package_qa_check_rpath(file,name, d, elf, messages):
> if dir in line:
> messages.append("package %s contains bad RPATH %s in file %s" % (name, line, file))
>
> +QAPATHTEST[useless-rpaths] = "package_qa_check_useless_rpaths"
> +def package_qa_check_useless_rpaths(file,name, d, elf, messages):
> + """
> + Check for RPATHs that are useless but not dangerous
> + """
> + if not elf:
> + return
> +
> + objdump = bb.data.getVar('OBJDUMP', d, True)
> + env_path = bb.data.getVar('PATH', d, True)
> +
> + libdir = bb.data.getVar("libdir", d, True)
> + base_libdir = bb.data.getVar("base_libdir", d, True)
> +
> + import re
> + rpath_re = re.compile("\s+RPATH\s+(.*)")
> + for line in os.popen("LC_ALL=C PATH=%s %s -p '%s' 2> /dev/null" % (env_path, objdump, file), "r"):
> + m = rpath_re.match(line)
> + if m:
> + rpath = m.group(1)
> + if rpath == libdir or rpath == base_libdir:
> + # The dynamic linker searches both these places anyway. There is no point in
> + # looking there again.
> + messages.append("dynamic section contains probably-redundant RPATH %s" % rpath)
> +
> QAPATHTEST[dev-so] = "package_qa_check_dev"
> def package_qa_check_dev(path, name, d, elf, messages):
> """
> @@ -238,22 +263,19 @@ def package_qa_hash_style(path, name, d, elf, messages):
> objdump = bb.data.getVar('OBJDUMP', d, True)
> env_path = bb.data.getVar('PATH', d, True)
>
> - sane = True
> - elf = False
> - # A bit hacky. We do not know if path is an elf binary or not
> - # we will search for 'NEEDED' or 'INIT' as this should be printed...
> - # and come before the HASH section (guess!!!) and works on split out
> - # debug symbols too
> + sane = False
> + has_syms = False
> +
> + # If this binary has symbols, we expect it to have GNU_HASH too.
> for line in os.popen("LC_ALL=C PATH=%s %s -p '%s' 2> /dev/null" % (env_path, objdump, path), "r"):
> - if "NEEDED" in line or "INIT" in line:
> - sane = False
> - elf = True
> + if "SYMTAB" in line:
> + has_syms = True
> if "GNU_HASH" in line:
> sane = True
> if "[mips32]" in line or "[mips64]" in line:
> sane = True
>
> - if elf and not sane:
> + if has_syms and not sane:
> messages.append("No GNU_HASH in the elf binary: '%s'" % path)
>
>
> --
> 1.7.4.1
>
>
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] insane: make GNU_HASH check slightly more robust (avoids false negatives with gold); add check for useless rpaths
2011-07-14 19:26 ` Koen Kooi
@ 2011-07-15 11:21 ` Phil Blundell
2011-07-15 12:34 ` Koen Kooi
2011-07-20 14:48 ` Richard Purdie
0 siblings, 2 replies; 6+ messages in thread
From: Phil Blundell @ 2011-07-15 11:21 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer
[-- Attachment #1: Type: text/plain, Size: 183 bytes --]
On Thu, 2011-07-14 at 21:26 +0200, Koen Kooi wrote:
> The new rpath warning is nice, but a bit too terse:
Yes, agreed. Try this patch and see if the situation improves.
p.
[-- Attachment #2: 0001-insane-improve-diagnostic-for-redundant-rpath.patch --]
[-- Type: text/x-patch, Size: 1653 bytes --]
From 5083f058ed0c559583cc9b3f4f2ae87bbbc701f9 Mon Sep 17 00:00:00 2001
From: Phil Blundell <philb@gnu.org>
Date: Fri, 15 Jul 2011 12:19:35 +0100
Subject: [PATCH] insane: improve diagnostic for redundant rpath
Make it more obvious which file, and which recipe, are at issue.
Signed-off-by: Phil Blundell <philb@gnu.org>
---
meta/classes/insane.bbclass | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index c45f2cb..65eda9e 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -142,7 +142,7 @@ def package_qa_check_rpath(file,name, d, elf, messages):
messages.append("package %s contains bad RPATH %s in file %s" % (name, line, file))
QAPATHTEST[useless-rpaths] = "package_qa_check_useless_rpaths"
-def package_qa_check_useless_rpaths(file,name, d, elf, messages):
+def package_qa_check_useless_rpaths(file, name, d, elf, messages):
"""
Check for RPATHs that are useless but not dangerous
"""
@@ -164,7 +164,7 @@ def package_qa_check_useless_rpaths(file,name, d, elf, messages):
if rpath == libdir or rpath == base_libdir:
# The dynamic linker searches both these places anyway. There is no point in
# looking there again.
- messages.append("dynamic section contains probably-redundant RPATH %s" % rpath)
+ messages.append("%s: %s contains probably-redundant RPATH %s" % (name, package_qa_clean_path(file, d), rpath))
QAPATHTEST[dev-so] = "package_qa_check_dev"
def package_qa_check_dev(path, name, d, elf, messages):
--
1.7.4.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] insane: make GNU_HASH check slightly more robust (avoids false negatives with gold); add check for useless rpaths
2011-07-15 11:21 ` Phil Blundell
@ 2011-07-15 12:34 ` Koen Kooi
2011-07-20 14:48 ` Richard Purdie
1 sibling, 0 replies; 6+ messages in thread
From: Koen Kooi @ 2011-07-15 12:34 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer
Op 15 jul 2011, om 13:21 heeft Phil Blundell het volgende geschreven:
> On Thu, 2011-07-14 at 21:26 +0200, Koen Kooi wrote:
>> The new rpath warning is nice, but a bit too terse:
>
> Yes, agreed. Try this patch and see if the situation improves.
Much better!
WARNING: QA Issue: shadow: /work/beagleboard-angstrom-linux-gnueabi/shadow-4.1.4.3-r2/packages-split/shadow/usr/sbin/groupadd contains probably-redundant RPATH /lib
WARNING: QA Issue: shadow: /work/beagleboard-angstrom-linux-gnueabi/shadow-4.1.4.3-r2/packages-split/shadow/usr/sbin/newusers contains probably-redundant RPATH /lib
WARNING: QA Issue: shadow: /work/beagleboard-angstrom-linux-gnueabi/shadow-4.1.4.3-r2/packages-split/shadow/usr/sbin/chgpasswd contains probably-redundant RPATH /lib
WARNING: QA Issue: shadow: /work/beagleboard-angstrom-linux-gnueabi/shadow-4.1.4.3-r2/packages-split/shadow/usr/sbin/groupmems contains probably-redundant RPATH /lib
WARNING: QA Issue: shadow: /work/beagleboard-angstrom-linux-gnueabi/shadow-4.1.4.3-r2/packages-split/shadow/usr/sbin/groupmod contains probably-redundant RPATH /lib
WARNING: QA Issue: shadow: /work/beagleboard-angstrom-linux-gnueabi/shadow-4.1.4.3-r2/packages-split/shadow/usr/sbin/useradd contains probably-redundant RPATH /lib
WARNING: QA Issue: shadow: /work/beagleboard-angstrom-linux-gnueabi/shadow-4.1.4.3-r2/packages-split/shadow/usr/sbin/groupdel contains probably-redundant RPATH /lib
WARNING: QA Issue: shadow: /work/beagleboard-angstrom-linux-gnueabi/shadow-4.1.4.3-r2/packages-split/shadow/usr/sbin/usermod contains probably-redundant RPATH /lib
WARNING: QA Issue: shadow: /work/beagleboard-angstrom-linux-gnueabi/shadow-4.1.4.3-r2/packages-split/shadow/usr/sbin/userdel contains probably-redundant RPATH /lib
WARNING: QA Issue: shadow: /work/beagleboard-angstrom-linux-gnueabi/shadow-4.1.4.3-r2/packages-split/shadow/usr/sbin/chpasswd.shadow contains probably-redundant RPATH /lib
WARNING: QA Issue: shadow: /work/beagleboard-angstrom-linux-gnueabi/shadow-4.1.4.3-r2/packages-split/shadow/usr/bin/su contains probably-redundant RPATH /lib
WARNING: QA Issue: shadow: /work/beagleboard-angstrom-linux-gnueabi/shadow-4.1.4.3-r2/packages-split/shadow/usr/bin/passwd.shadow contains probably-redundant RPATH /lib
WARNING: QA Issue: shadow: /work/beagleboard-angstrom-linux-gnueabi/shadow-4.1.4.3-r2/packages-split/shadow/usr/bin/chfn.shadow contains probably-redundant RPATH /lib
WARNING: QA Issue: shadow: /work/beagleboard-angstrom-linux-gnueabi/shadow-4.1.4.3-r2/packages-split/shadow/usr/bin/chage contains probably-redundant RPATH /lib
WARNING: QA Issue: shadow: /work/beagleboard-angstrom-linux-gnueabi/shadow-4.1.4.3-r2/packages-split/shadow/usr/bin/chsh.shadow contains probably-redundant RPATH /lib
WARNING: QA Issue: shadow: /work/beagleboard-angstrom-linux-gnueabi/shadow-4.1.4.3-r2/packages-split/shadow/bin/login.shadow contains probably-redundant RPATH /lib
For the patch:
Acked-by: Koen Kooi <koen@dominion.thruhere.net>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] insane: make GNU_HASH check slightly more robust (avoids false negatives with gold); add check for useless rpaths
2011-07-15 11:21 ` Phil Blundell
2011-07-15 12:34 ` Koen Kooi
@ 2011-07-20 14:48 ` Richard Purdie
1 sibling, 0 replies; 6+ messages in thread
From: Richard Purdie @ 2011-07-20 14:48 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer
On Fri, 2011-07-15 at 12:21 +0100, Phil Blundell wrote:
> On Thu, 2011-07-14 at 21:26 +0200, Koen Kooi wrote:
> > The new rpath warning is nice, but a bit too terse:
>
> Yes, agreed. Try this patch and see if the situation improves.
>
Merged to master, thanks.
Richard
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-07-20 15:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-14 9:02 [PATCH v2] insane: make GNU_HASH check slightly more robust (avoids false negatives with gold); add check for useless rpaths Phil Blundell
2011-07-14 14:07 ` Richard Purdie
2011-07-14 19:26 ` Koen Kooi
2011-07-15 11:21 ` Phil Blundell
2011-07-15 12:34 ` Koen Kooi
2011-07-20 14:48 ` Richard Purdie
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.