Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] support/scripts/fix-rpath: exclude /lib/firmware in the target
@ 2018-04-12 11:50 Thomas Petazzoni
  2018-04-12 17:04 ` Yann E. MORIN
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2018-04-12 11:50 UTC (permalink / raw)
  To: buildroot

The /lib/firmware directory contains random firmware for various
devices. It happens that some of them might be or appear to be ELF
files, but they shouldn't be checked by fix-rpath. For example, one of
the Qualcomm VPU firmware file appears to be an ELF file, but patchelf
isn't happy about it:

$ ./output/host/bin/patchelf --print-rpath output/target/lib/firmware/qcom/venus-4.2/venus.b00
patchelf: patchelf.cc:387: void ElfFile<Elf_Ehdr, Elf_Phdr, Elf_Shdr, Elf_Addr, Elf_Off, Elf_Dyn, Elf_Sym>::parse() [with Elf_Ehdr = Elf32_Ehdr; Elf_Phdr = Elf32_Phdr; Elf_Shdr = Elf32_Shdr; Elf_Addr = unsigned int; Elf_Off = unsigned int; Elf_Dyn = Elf32_Dyn; Elf_Sym = Elf32_Sym]: Assertion `shstrtabIndex < shdrs.size()' failed.
Aborted (core dumped)

Even though patchelf definitely shouldn't crash, it anyway doesn't
make sense to check ELF files in /lib/firmware, so let's exclude this
directory from our check.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 support/scripts/fix-rpath | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/support/scripts/fix-rpath b/support/scripts/fix-rpath
index 15705a3b0d..fa138ca15a 100755
--- a/support/scripts/fix-rpath
+++ b/support/scripts/fix-rpath
@@ -56,6 +56,7 @@ EOF
 # ELF files should not be in these sub-directories
 HOST_EXCLUDEPATHS="/share/terminfo"
 STAGING_EXCLUDEPATHS="/usr/include /usr/share/terminfo"
+TARGET_EXCLUDEPATHS="/lib/firmware"
 
 main() {
     local rootdir
@@ -106,6 +107,11 @@ main() {
 
         target)
             rootdir="${TARGET_DIR}"
+
+            for excludepath in ${TARGET_EXCLUDEPATHS}; do
+                find_args+=( "-path" "${TARGET_DIR}""${excludepath}" "-prune" "-o" )
+            done
+
             # we don't want $ORIGIN-based rpaths but absolute paths without rootdir.
             # we also want to remove rpaths pointing to /lib or /usr/lib.
             sanitize_extra_args+=( "--no-standard-lib-dirs" )
-- 
2.14.3

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

* [Buildroot] [PATCH] support/scripts/fix-rpath: exclude /lib/firmware in the target
  2018-04-12 11:50 [Buildroot] [PATCH] support/scripts/fix-rpath: exclude /lib/firmware in the target Thomas Petazzoni
@ 2018-04-12 17:04 ` Yann E. MORIN
  2018-04-12 19:16 ` Thomas Petazzoni
  2018-05-01  6:51 ` Peter Korsgaard
  2 siblings, 0 replies; 4+ messages in thread
From: Yann E. MORIN @ 2018-04-12 17:04 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2018-04-12 13:50 +0200, Thomas Petazzoni spake thusly:
> The /lib/firmware directory contains random firmware for various
> devices. It happens that some of them might be or appear to be ELF
> files, but they shouldn't be checked by fix-rpath. For example, one of
> the Qualcomm VPU firmware file appears to be an ELF file, but patchelf
> isn't happy about it:
> 
> $ ./output/host/bin/patchelf --print-rpath output/target/lib/firmware/qcom/venus-4.2/venus.b00
> patchelf: patchelf.cc:387: void ElfFile<Elf_Ehdr, Elf_Phdr, Elf_Shdr, Elf_Addr, Elf_Off, Elf_Dyn, Elf_Sym>::parse() [with Elf_Ehdr = Elf32_Ehdr; Elf_Phdr = Elf32_Phdr; Elf_Shdr = Elf32_Shdr; Elf_Addr = unsigned int; Elf_Off = unsigned int; Elf_Dyn = Elf32_Dyn; Elf_Sym = Elf32_Sym]: Assertion `shstrtabIndex < shdrs.size()' failed.
> Aborted (core dumped)
> 
> Even though patchelf definitely shouldn't crash, it anyway doesn't
> make sense to check ELF files in /lib/firmware, so let's exclude this
> directory from our check.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  support/scripts/fix-rpath | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/support/scripts/fix-rpath b/support/scripts/fix-rpath
> index 15705a3b0d..fa138ca15a 100755
> --- a/support/scripts/fix-rpath
> +++ b/support/scripts/fix-rpath
> @@ -56,6 +56,7 @@ EOF
>  # ELF files should not be in these sub-directories
>  HOST_EXCLUDEPATHS="/share/terminfo"
>  STAGING_EXCLUDEPATHS="/usr/include /usr/share/terminfo"
> +TARGET_EXCLUDEPATHS="/lib/firmware"
>  
>  main() {
>      local rootdir
> @@ -106,6 +107,11 @@ main() {
>  
>          target)
>              rootdir="${TARGET_DIR}"
> +
> +            for excludepath in ${TARGET_EXCLUDEPATHS}; do
> +                find_args+=( "-path" "${TARGET_DIR}""${excludepath}" "-prune" "-o" )
> +            done
> +
>              # we don't want $ORIGIN-based rpaths but absolute paths without rootdir.
>              # we also want to remove rpaths pointing to /lib or /usr/lib.
>              sanitize_extra_args+=( "--no-standard-lib-dirs" )
> -- 
> 2.14.3
> 

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH] support/scripts/fix-rpath: exclude /lib/firmware in the target
  2018-04-12 11:50 [Buildroot] [PATCH] support/scripts/fix-rpath: exclude /lib/firmware in the target Thomas Petazzoni
  2018-04-12 17:04 ` Yann E. MORIN
@ 2018-04-12 19:16 ` Thomas Petazzoni
  2018-05-01  6:51 ` Peter Korsgaard
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2018-04-12 19:16 UTC (permalink / raw)
  To: buildroot

Hello,

On Thu, 12 Apr 2018 13:50:09 +0200, Thomas Petazzoni wrote:
> The /lib/firmware directory contains random firmware for various
> devices. It happens that some of them might be or appear to be ELF
> files, but they shouldn't be checked by fix-rpath. For example, one of
> the Qualcomm VPU firmware file appears to be an ELF file, but patchelf
> isn't happy about it:
> 
> $ ./output/host/bin/patchelf --print-rpath output/target/lib/firmware/qcom/venus-4.2/venus.b00
> patchelf: patchelf.cc:387: void ElfFile<Elf_Ehdr, Elf_Phdr, Elf_Shdr, Elf_Addr, Elf_Off, Elf_Dyn, Elf_Sym>::parse() [with Elf_Ehdr = Elf32_Ehdr; Elf_Phdr = Elf32_Phdr; Elf_Shdr = Elf32_Shdr; Elf_Addr = unsigned int; Elf_Off = unsigned int; Elf_Dyn = Elf32_Dyn; Elf_Sym = Elf32_Sym]: Assertion `shstrtabIndex < shdrs.size()' failed.
> Aborted (core dumped)
> 
> Even though patchelf definitely shouldn't crash, it anyway doesn't
> make sense to check ELF files in /lib/firmware, so let's exclude this
> directory from our check.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
>  support/scripts/fix-rpath | 6 ++++++
>  1 file changed, 6 insertions(+)

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [Buildroot] [PATCH] support/scripts/fix-rpath: exclude /lib/firmware in the target
  2018-04-12 11:50 [Buildroot] [PATCH] support/scripts/fix-rpath: exclude /lib/firmware in the target Thomas Petazzoni
  2018-04-12 17:04 ` Yann E. MORIN
  2018-04-12 19:16 ` Thomas Petazzoni
@ 2018-05-01  6:51 ` Peter Korsgaard
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Korsgaard @ 2018-05-01  6:51 UTC (permalink / raw)
  To: buildroot

>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@bootlin.com> writes:

 > The /lib/firmware directory contains random firmware for various
 > devices. It happens that some of them might be or appear to be ELF
 > files, but they shouldn't be checked by fix-rpath. For example, one of
 > the Qualcomm VPU firmware file appears to be an ELF file, but patchelf
 > isn't happy about it:

 > $ ./output/host/bin/patchelf --print-rpath output/target/lib/firmware/qcom/venus-4.2/venus.b00
 > patchelf: patchelf.cc:387: void ElfFile<Elf_Ehdr, Elf_Phdr, Elf_Shdr, Elf_Addr, Elf_Off, Elf_Dyn, Elf_Sym>::parse() [with Elf_Ehdr = Elf32_Ehdr; Elf_Phdr = Elf32_Phdr; Elf_Shdr = Elf32_Shdr; Elf_Addr = unsigned int; Elf_Off = unsigned int; Elf_Dyn = Elf32_Dyn; Elf_Sym = Elf32_Sym]: Assertion `shstrtabIndex < shdrs.size()' failed.
 > Aborted (core dumped)

 > Even though patchelf definitely shouldn't crash, it anyway doesn't
 > make sense to check ELF files in /lib/firmware, so let's exclude this
 > directory from our check.

 > Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Committed to 2018.02.x, thanks.

-- 
Bye, Peter Korsgaard

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

end of thread, other threads:[~2018-05-01  6:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-12 11:50 [Buildroot] [PATCH] support/scripts/fix-rpath: exclude /lib/firmware in the target Thomas Petazzoni
2018-04-12 17:04 ` Yann E. MORIN
2018-04-12 19:16 ` Thomas Petazzoni
2018-05-01  6:51 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox