NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

toolchain/52675: crunching binaries improperly removes PaX notes



>Number:         52675
>Category:       toolchain
>Synopsis:       crunching binaries improperly removes PaX notes
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 30 12:15:00 +0000 2017
>Originator:     Martin Husemann
>Release:        NetBSD 8.99.5
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD night-owl.duskware.de 8.99.5 NetBSD 8.99.5 (NIGHT-OWL) #545: Mon Oct 23 13:44:09 CEST 2017 martin%night-owl.duskware.de@localhost:/usr/src/sys/arch/amd64/compile/NIGHT-OWL amd64
Architecture: x86_64
Machine: amd64
>Description:

When crunching multiple binaries into a single exe, the PaX notes are
cleared (as multiple of them would not make sense).

However, they are cleared,  not properly removed.

Compare readelf -n output for a statically build sbin/sysctl vs the
crunched rescue/sysctl:

static:

Displaying notes found at file offset 0x000000b4 with length 0x00000018:
  Owner                 Data size       Description
  NetBSD                0x00000004      IDENT 899000400 (8.99.4)

Displaying notes found at file offset 0x000000cc with length 0x00000014:
  Owner                 Data size       Description
  NetBSD                0x00000004      PaX <>

Displaying notes found at file offset 0x000000e0 with length 0x00000018:
  Owner                 Data size       Description
  NetBSD                0x00000004      MARCH <arm>

crunched:

Displaying notes found at file offset 0x000000b4 with length 0x00000018:
  Owner                 Data size       Description
  NetBSD                0x00000004      IDENT 899000400 (8.99.4)

Displaying notes found at file offset 0x000000e0 with length 0x00000018:
  Owner                 Data size       Description
  NetBSD                0x00000004      MARCH <arm>


The space in between has been zeroed, but this breaks note parsing
semantics (i.e. in arm vs. earm binaries getting their machine_arch
wrong).

>How-To-Repeat:

s/a

>Fix:
n/a



Home | Main Index | Thread Index | Old Index