[Bug libelf/26734] New: ELF saving fails for an AARCH64 binary built with -mbranch-protection=standard

mliska at suse dot cz sourceware-bugzilla@sourceware.org
Wed Oct 14 08:17:01 GMT 2020


https://sourceware.org/bugzilla/show_bug.cgi?id=26734

            Bug ID: 26734
           Summary: ELF saving fails for an AARCH64 binary built with
                    -mbranch-protection=standard
           Product: elfutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libelf
          Assignee: unassigned at sourceware dot org
          Reporter: mliska at suse dot cz
                CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

Created attachment 12897
  --> https://sourceware.org/bugzilla/attachment.cgi?id=12897&action=edit
Problematic binary

The following code snippet fails (isolated from debugedit.c from rpm package):

$ cat demo.c
#include <libelf.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <error.h>

int main(int argc, char **argv)
{
  elf_version (EV_CURRENT);
  int fd = open (argv[1], O_RDWR);
  Elf *elf = NULL;
  int i;

  elf = elf_begin (fd, ELF_C_RDWR, NULL);
  if (elf == NULL)
    {
      error (0, 0, "cannot open ELF file: %s", elf_errmsg (-1));
      exit (1);
    }
  if (elf_update (elf, ELF_C_NULL) < 0)
    {
      fprintf (stderr, "Failed to update file: %s\n",
               elf_errmsg (elf_errno ()));
      exit (1);
    }
}

I used latest elfutils libelf.so:

$ gcc demo.c -lelf &&
LD_PRELOAD=/home/marxin/Programming/elfutils/libelf/libelf.so ./a.out
/tmp/authvar
Failed to update file: invalid section entry size

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Elfutils-devel mailing list