Re: [Rpm-maint] [rpm-software-management/rpm] debugedit fails to update section headers (#423)

2019-10-15 Thread Panu Matilainen
Closed #423.

-- 
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/423#event-2713882777___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] debugedit fails to update section headers (#423)

2019-10-15 Thread Panu Matilainen
Okay so this was confirmed fixed on elfutils side, we can close it here.

-- 
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/423#issuecomment-542200334___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] debugedit fails to update section headers (#423)

2019-05-13 Thread Sergei Trofimovich
>  But I now believe this is actually an elfutils libelf issue: 
> https://sourceware.org/ml/elfutils-devel/2019-q2/msg00077.html Could you try 
> that out and see if it resolves the issue for you? (The actual patch is just 
> 3 lines, but there is also a larger testcase added to make sure the issue was 
> really resolved.) Thanks, Mark

The patch helps here: applied on top of `elfutils-0.176` and tested against 
`debugedit-4.14.2`.

-- 
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/423#issuecomment-491705457___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] debugedit fails to update section headers (#423)

2019-05-12 Thread Mark Wielaard
On Mon, Apr 29, 2019 at 02:24:33PM +, Michael Schroeder wrote:
> Mark, any update on this? We (SUSE) get corrupt debuginfo files from
> time to time because of this bug.

Apologies for the slow response. I looked at it before, but didn't
understand what was going wrong.  But I now believe this is actually
an elfutils libelf issue:
https://sourceware.org/ml/elfutils-devel/2019-q2/msg00077.html

Could you try that out and see if it resolves the issue for you?
(The actual patch is just 3 lines, but there is also a larger testcase
added to make sure the issue was really resolved.)

Thanks,

Mark
___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] debugedit fails to update section headers (#423)

2019-04-29 Thread Michael Schroeder
Mark, any update on this? We (SUSE) get corrupt debuginfo files from time to 
time because of this bug.

-- 
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/423#issuecomment-487600464___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] debugedit fails to update section headers (#423)

2018-09-24 Thread Sergei Trofimovich
The following workaround allows to maintain original section order:

```diff
--- a/tools/debugedit.c
+++ b/tools/debugedit.c
@@ -2342,21 +2342,21 @@ fdopen_dso (int fd, const char *name)
 }

   if (elf_getphdrnum (elf, ) != 0)
 {
   error (0, 0, "Couldn't get number of phdrs: %s", elf_errmsg (-1));
   goto error_out;
 }

   /* If there are phdrs we want to maintain the layout of the
  allocated sections in the file.  */
-  if (phnum != 0)
+  //if (phnum != 0)
 elf_flagelf (elf, ELF_C_SET, ELF_F_LAYOUT);

   memset (dso, 0, sizeof(DSO));
   dso->elf = elf;
   dso->phnum = phnum;
   dso->ehdr = ehdr;
   dso->scn = (Elf_Scn **) >shdr[ehdr.e_shnum + 20];

   for (i = 0; i < ehdr.e_shnum; ++i)
 {

```


-- 
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/423#issuecomment-424147426___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] debugedit fails to update section headers (#423)

2018-09-24 Thread Sergei Trofimovich
I think in my case it happens because `debugedit` was not able to delete any 
sections (no file size changes) but it reordered sections in the file and did 
not update section offsets. Attaching original, mangled file and a 
script:[__t.tar.gz](https://github.com/rpm-software-management/rpm/files/2412961/__t.tar.gz)


-- 
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/423#issuecomment-424133239___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] debugedit fails to update section headers (#423)

2018-09-24 Thread Sergei Trofimovich
debugedit also can break gcc's crtstartup: https://bugs.gentoo.org/666954 . I 
think it's the same issue. Will try to provide more detail today.

-- 
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/423#issuecomment-424051949___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] debugedit fails to update section headers (#423)

2018-03-29 Thread rguenth
[xt_DHCPMAC.ko.gz](https://github.com/rpm-software-management/rpm/files/1859743/xt_DHCPMAC.ko.gz)


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/423#issuecomment-377198192___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


[Rpm-maint] [rpm-software-management/rpm] debugedit fails to update section headers (#423)

2018-03-29 Thread rguenth
debugedit -b /home/abuild/rpmbuild/BUILD/xtables-addons-3.0 -d 
/usr/src/debug/xtables-addons-3.0-0.x86_64 test.ko

results in

There are 41 section headers, starting at offset 0x870a8:

Section Headers:
  [Nr] Name  Type Address   Offset
   Size  EntSize  Flags  Link  Info  Align
  [ 0] etNULL   
        0 0 0
  [ 1] abNOTE   0040
   0024     A   0 0 4
  [ 2] ela.text  PROGBITS   0070
   0340    AX   0 0 16
...

the .shstrtab (40) starts with

Hex dump of section 'ab':
  0x 6574 2e73796d 74616200 2e737472 et...symtab..str
  0x0010 74616200 2e736873 74727461 62002e6e tab..shstrtab..n
  0x0020 6f74652e 676e752e 6275696c 642d6964 ote.gnu.build-id

and suspiciously 37 (.rela.debug_frame) contains (look at the end!)

Hex dump of section 'ck':
  0x 455f4944 5f766572 6d616769 63313400 E_ID_vermagic14.
  0x0010 736b625f 636f7079 5f626974 73007874 skb_copy_bits.xt
  0x0020 5f726567 69737465 725f6d61 74636800 _register_match.
  0x0030 5f5f7468 69735f6d 6f64756c 6500736b __this_module.sk
  0x0040 625f6d61 6b655f77 72697461 626c6500 b_make_writable.
  0x0050 636c6561 6e75705f 6d6f6475 6c65005f cleanup_module._
  0x0060 5f66656e 7472795f 5f00696e 69745f6d _fentry__.init_m
  0x0070 6f64756c 65007874 5f756e72 65676973 odule.xt_unregis
  0x0080 7465725f 6d617463 68005f5f 73746163 ter_match.__stac
  0x0090 6b5f6368 6b5f6661 696c0078 745f7265 k_chk_fail.xt_re
  0x00a0 67697374 65725f74 61726765 74007874 gister_target.xt
  0x00b0 5f756e72 65676973 7465725f 74617267 _unregister_targ

so the real .shstrtab should start at 00086f1c instead of 00086f18.

So there's a off-by-4 error somewhere...

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/423___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint