Re: [COMMITTED] Prepare for 0.176

2019-02-15 Thread Martin Liška
On 2/14/19 9:37 PM, Mark Wielaard wrote:
> On Thu, 2019-02-14 at 20:51 +0100, Martin Liška wrote:
>> I see 2 tests failing for s390x:
>>
> https://build.opensuse.org/package/live_build_log/home:marxin:branches:Base:System/elfutils/openSUSE_Factory_zSystems/s390x
>>
> 
> So those are basically the same issue:
> 
>> [  269s] elflint /home/abuild/rpmbuild/BUILD/elfutils-0.176/tests/elfstrmerge
>> [  269s] section [34] '.symtab': _GLOBAL_OFFSET_TABLE_ symbol value 0x5fb8 
>> does not match .got.plt section address 0x6000
> 
> First, is that correct?
> Could you provide that binary?

Hi.

Attached.

> 
> Secondly, when did this start happening?
> Did you change linker/version?

I can confirm it's older, I see in on elfutils-0.175 with binutils 2.31.

> 
> It might be this binutils commit:
> https://sourceware.org/ml/binutils/2018-07/msg00200.html
> 
> Which isn't in binutils-2.29 which is used on the s390x fedora builder.
> On which this test passes.
> 
> If so, you might have to add a check_special_symbol hook like aarch64
> has (see backends/aarch64_symbol.c).

Please let me know and we can eventually create a PR for it.

Thanks,
Martin

> 
> Cheers,
> 
> Mark
> 



elfstrmerge
Description: Binary data


Re: [COMMITTED] Prepare for 0.176

2019-02-15 Thread Mark Wielaard
On Fri, 2019-02-15 at 09:42 +0100, Martin Liška wrote:
> > It might be this binutils commit:
> > https://sourceware.org/ml/binutils/2018-07/msg00200.html
> > 
> > Which isn't in binutils-2.29 which is used on the s390x fedora
> > builder.
> > On which this test passes.
> > 
> > If so, you might have to add a check_special_symbol hook like
> > aarch64
> > has (see backends/aarch64_symbol.c).
> 
> Please let me know and we can eventually create a PR for it.

It looks like that was it. Could you try the attached patch?
I'll run it on some older s390x setups.

Thanks,

Mark
From 1e52d4ce3aa2093d12901d32fe07aae70211fe2a Mon Sep 17 00:00:00 2001
From: Mark Wielaard 
Date: Fri, 15 Feb 2019 14:39:57 +0100
Subject: [PATCH] s390: elflint should check if _GLOBAL_OFFSET_TABLE_ points to
 .got.

The _GLOBAL_OFFSET_TABLE_ symbol might point to the DT_PLTGOT,
which is in the .got section, even if the symbol itself is
associated with the .got.plt section.

See https://sourceware.org/ml/binutils/2018-07/msg00200.html

Signed-off-by: Mark Wielaard 
---
 backends/ChangeLog |  5 +
 backends/s390_init.c   |  1 +
 backends/s390_symbol.c | 38 ++
 3 files changed, 44 insertions(+)

diff --git a/backends/ChangeLog b/backends/ChangeLog
index 58a1b77..0c61a0b 100644
--- a/backends/ChangeLog
+++ b/backends/ChangeLog
@@ -1,3 +1,8 @@
+2019-02-15  Mark Wielaard  
+
+	* s390_init.c (s390_init): Hook check_special_symbol.
+	* s390_symbol.c (s390_check_sepcial_symbol): New function.
+
 2018-12-27  Jim Wilson  
 
 	* Makefile.am (riscv_SRCS): Add riscv64_corenote.c.
diff --git a/backends/s390_init.c b/backends/s390_init.c
index ba8df45..0004aee 100644
--- a/backends/s390_init.c
+++ b/backends/s390_init.c
@@ -54,6 +54,7 @@ s390_init (Elf *elf __attribute__ ((unused)),
   eh->name = "IBM S/390";
   s390_init_reloc (eh);
   HOOK (eh, reloc_simple_type);
+  HOOK (eh, check_special_symbol);
   HOOK (eh, register_info);
   HOOK (eh, return_value_location);
   if (eh->class == ELFCLASS64)
diff --git a/backends/s390_symbol.c b/backends/s390_symbol.c
index f91e137..9e80eca 100644
--- a/backends/s390_symbol.c
+++ b/backends/s390_symbol.c
@@ -32,6 +32,7 @@
 
 #include 
 #include 
+#include 
 
 #define BACKEND		s390_
 #include "libebl_CPU.h"
@@ -55,3 +56,40 @@ s390_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type,
   return ELF_T_NUM;
 }
 }
+
+/* The _GLOBAL_OFFSET_TABLE_ symbol might point to the DT_PLTGOT,
+   which is in the .got section, even if the symbol itself is
+   associated with the is a .got.plt section.
+   https://sourceware.org/ml/binutils/2018-07/msg00200.html  */
+bool
+s390_check_special_symbol (Elf *elf, const GElf_Sym *sym,
+  const char *name, const GElf_Shdr *destshdr)
+{
+  if (name != NULL
+  && strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0)
+{
+  size_t shstrndx;
+  if (elf_getshdrstrndx (elf, &shstrndx) != 0)
+	return false;
+  const char *sname = elf_strptr (elf, shstrndx, destshdr->sh_name);
+  if (sname != NULL
+	  && (strcmp (sname, ".got") == 0 || strcmp (sname, ".got.plt") == 0))
+	{
+	  Elf_Scn *scn = NULL;
+	  while ((scn = elf_nextscn (elf, scn)) != NULL)
+	{
+	  GElf_Shdr shdr_mem;
+	  GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
+	  if (shdr != NULL)
+		{
+		  sname = elf_strptr (elf, shstrndx, shdr->sh_name);
+		  if (sname != NULL && strcmp (sname, ".got") == 0)
+		return (sym->st_value >= shdr->sh_addr
+			&& sym->st_value < shdr->sh_addr + shdr->sh_size);
+		}
+	}
+	}
+}
+
+  return false;
+}
-- 
1.8.3.1



Re: [COMMITTED] Prepare for 0.176

2019-02-15 Thread Mark Wielaard
On Fri, 2019-02-15 at 14:43 +0100, Mark Wielaard wrote:
> On Fri, 2019-02-15 at 09:42 +0100, Martin Liška wrote:
> > > It might be this binutils commit:
> > > https://sourceware.org/ml/binutils/2018-07/msg00200.html
> > > 
> > > Which isn't in binutils-2.29 which is used on the s390x fedora
> > > builder.
> > > On which this test passes.
> > > 
> > > If so, you might have to add a check_special_symbol hook like
> > > aarch64
> > > has (see backends/aarch64_symbol.c).
> > 
> > Please let me know and we can eventually create a PR for it.
> 
> It looks like that was it. Could you try the attached patch?
> I'll run it on some older s390x setups.

This seemed to work out nicely. Both on an older binutils setup and a
newer one. So I have pushed the commit. If the buildbot keeps being
green I'll do a release soon.

Thanks,

Mark


elfutils 0.176 released

2019-02-15 Thread Mark Wielaard
ELFUTILS 0.176 - http://elfutils.org/

A new release of elfutils is available at:
ftp://sourceware.org/pub/elfutils/0.176/
or https://sourceware.org/elfutils/ftp/0.176/

* NEWS *

build: Add new --enable-install-elfh option.
   Do NOT use this for system installs (it overrides glibc elf.h).

backends: riscv improved core file and return value location support.

Fixes CVE-2019-7146, CVE-2019-7148, CVE-2019-7149, CVE-2019-7150,
  CVE-2019-7664, CVE-2019-7665

* GIT SHORTLOG *

Jim Wilson (3):
  RISC-V: Improve riscv64 core file support.
  RISC-V: Add initial return value location support.
  RISC-V: Add untested 32-bit core file support.

Mark Wielaard (23):
  config/upload-release.sh: Need to make before make dist.
  Add -Wtrampolines to CFLAGS.
  libelf: Get alignment correct when calling conversion functions.
  tests: Call test_cleanup in backtrace-subr.sh check_unsupported.
  libdw: Enable building with -Og.
  libdwfl: Fix relocation overlap sanity check.
  tests: Improve backtrace-data SKIP message.
  libebl: Fix reading GNU_PROPERTY_STACK_SIZE reading from 32bit notes.
  libebl: Check GNU property note pr_datasz fits inside note description.
  libelf: Correct overflow check in note_xlate.
  libebl: Check NT_PLATFORM core notes contain a zero terminated string.
  libdwfl: Sanity check partial core file dyn data read.
  libdw: Check terminating NUL byte in dwarf_getsrclines for dir/file table.
  readelf: Don't go past end of line data reading unknown opcode parameters.
  strip: Fix check test for SHN_XINDEX symbol.
  libebl: Check GNU property note data padding fits inside note.
  tests: Remove assert (errno == 0) from tests.
  configure: Add new --enable-install-elfh option.
  readelf: Check there is enough data to read DWARF line opcodes arguments.
  libdw: Check there is enough space for CU 64bit length, version and type.
  libelf: Make sure ar_size is terminated when reading ar long names.
  Prepare for 0.176
  s390: elflint should check if _GLOBAL_OFFSET_TABLE_ points to .got.

Ulf Hermann (2):
  Skip run-readelf-compressed.sh test if built without bzip2
  tests: Use separate files for strip outputs

Yonghong Song (2):
  libdwfl: parse inode in /proc/pid/maps correctly
  tests: parse inode in /proc/pid/maps/correctly in run-backtrace-data.sh



signature.asc
Description: PGP signature