Re: [PATCH] Add helper function for basename

2023-12-20 Thread Khem Raj
Hi Mark

This patch seem to work fine

On Thu, Dec 14, 2023 at 11:28 AM Khem Raj  wrote:
>
> On Thu, Dec 14, 2023 at 11:22 AM Mark Wielaard  wrote:
> >
> > Hi Khem,
> >
> > On Thu, Dec 14, 2023 at 10:15:00AM -0800, Khem Raj wrote:
> > > Overall, this looks a good improvement on top of my patch so good to go.
> > > I will also try it in my local distro builds and see how it goes.
> >
> > Thanks. I didn't actually test it against musl. So if you could and
> > report whether or not it works as intended that would be really
> > appreciated.
>
> yep that's the plan, I still have the env available.
> >
> > Cheers,
> >
> > Mark


[Bug general/30975] elfutils incorrectly reports core files with non-contiguous segments

2023-12-20 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=30975

Mark Wielaard  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #8 from Mark Wielaard  ---
Fixed by this commit:

commit 2f38fa57942f95a9ada35e6802df864747c81cce
Author: Aaron Merey 
Date:   Tue Nov 21 08:56:44 2023 -0500

libdwfl: Correctly handle corefile non-contiguous segments

It is possible for segments of different shared libaries to be interleaved
in memory such that the segments of one library are located in between
non-contiguous segments of another library.

For example, this can be seen with firefox on RHEL 7.9 where multiple
shared libraries could be mapped in between ld-2.17.so segments:

  [...]
  7f0972082000-7f09720a4000  139264  /usr/lib64/ld-2.17.so
  7f09720a4000-7f09720a5000  4096/memfd:mozilla-ipc
(deleted)
  7f09720a5000-7f09720a7000  8192/memfd:mozilla-ipc
(deleted)
  7f09720a7000-7f09720a9000  8192/memfd:mozilla-ipc
(deleted)
  7f0972134000-7f0972136000  8192   
/usr/lib64/firefox/libmozwayland.so
  7f0972136000-7f0972137000 2000 4096   
/usr/lib64/firefox/libmozwayland.so
  7f0972137000-7f0972138000 3000 4096   
/usr/lib64/firefox/libmozwayland.so
  7f0972138000-7f0972139000 3000 4096   
/usr/lib64/firefox/libmozwayland.so
  7f097213a000-7f0972147000  53248  
/usr/lib64/firefox/libmozsqlite3.so
  7f0972147000-7f097221e000 d000 880640 
/usr/lib64/firefox/libmozsqlite3.so
  7f097221e000-7f0972248000 000e4000 172032 
/usr/lib64/firefox/libmozsqlite3.so
  7f0972248000-7f0972249000 0010e000 4096   
/usr/lib64/firefox/libmozsqlite3.so
  7f0972249000-7f097224c000 0010e000 12288  
/usr/lib64/firefox/libmozsqlite3.so
  7f097224c000-7f097225 00111000 16384  
/usr/lib64/firefox/libmozsqlite3.so
  7f097225-7f0972253000  12288  
/usr/lib64/firefox/liblgpllibs.so
  [...]
  7f09722a3000-7f09722a4000 00021000 4096/usr/lib64/ld-2.17.so
  7f09722a4000-7f09722a5000 00022000 4096/usr/lib64/ld-2.17.so

dwfl_segment_report_module did not account for the possibility of
interleaving non-contiguous segments, resulting in premature closure
of modules as well as failing to report modules.

Fix this by removing segment skipping in dwfl_segment_report_module.
When dwfl_segment_report_module reported a module, it would return
the index of the segment immediately following the end address of the
current module.  Since there's a chance that other modules might fall
within this address range, dwfl_segment_report_module instead returns
the index of the next segment.

This patch also fixes premature module closure that can occur in
dwfl_segment_report_module when interleaving non-contiguous segments
are found.  Previously modules with start and end addresses that overlap
with the current segment would have their build-ids compared with the
current segment's build-id.  If there was a mismatch, that module would
be closed.  Avoid closing modules in this case when mismatching build-ids
correspond to distinct modules.

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

Signed-off-by: Aaron Merey 

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

[Bug libelf/31034] iproute2 fails to build with elfutils 0.190 with musl libc

2023-12-20 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=31034

Mark Wielaard  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 CC||mark at klomp dot org
 Resolution|--- |MOVED

--- Comment #2 from Mark Wielaard  ---
This was fixed in musl with:

commit 6be76895f6863100a311d474a42abdbb6466189d
Author: Violet Purcell 
Date:   Sat Nov 4 12:09:20 2023 -0400

elf.h: add typedefs for Elf64_Relr and Elf32_Relr

These were overlooked when DT_RELR was added in commit
d32dadd60efb9d3b255351a3b532f8e4c3dd0db1, potentially breaking
software that treats presence of the DT_RELR macro as implying they
exist.

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

Re: [PATCH] Add helper function for basename

2023-12-20 Thread Mark Wielaard
Hi Khem,

On Wed, Dec 20, 2023 at 08:43:57AM -0800, Khem Raj wrote:
> This patch seem to work fine

Thanks for double checking. I pushed it as:

commit a2194f6b305bf0d0b9dd49dccd0a5c21994c8eea
Author: Khem Raj 
Date:   Sun Dec 10 12:20:33 2023 -0800

Add helper function for basename

musl does not provide GNU version of basename and lately have removed
the definiton from string.h [1] which exposes this problem. It can be
made to work by providing a local implementation of basename which
implements the GNU basename behavior, this makes it work across C
libraries which have POSIX implementation only.

[1] 
https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7

* lib/system.h (xbasename): New static inline functions.
Poison basename.
* libdw/dwarf_getsrc_file.c (dwarf_getsrc_file): Use xbasename.
* libdwfl/core-file.c (dwfl_core_file_report): Likewise.
* libdwfl/dwfl_module_getsrc_file.c (dwfl_module_getsrc_file):
Likewise.
* libdwfl/dwfl_segment_report_module.c (dwfl_segment_report_module):
Likewise.
* libdwfl/find-debuginfo.c (find_debuginfo_in_path): Likewise.
* libdwfl/link_map.c (report_r_debug): Likewise.
* libdwfl/linux-kernel-modules.c (try_kernel_name): Likewise.
* src/addr2line.c (print_dwarf_function): Likewise.
(print_src): Likewise.
* src/ar.c (do_oper_insert): Likewise.
And cast away const in entry.key assignment.
* src/nm.c (show_symbols): Use xbasename.
* src/stack.c (module_callback): Likewise.
* src/strip.c (handle_elf): Likewise.
* tests/show-die-info.c: Include system.h.
(dwarf_tag_string): Use xbasename.
* tests/varlocs.c: Likewise.
* debuginfod/debuginfod.cxx: Move include system.h to the end.
(register_file_name): Rename basename to filename.

Signed-off-by: Khem Raj 
Signed-off-by: Mark Wielaard 

BTW. There is a musl tracking bug:
https://sourceware.org/bugzilla/show_bug.cgi?id=21002

Could you take a peek at that and say if there are still patches
needed either in elfutils or musl?

Thanks,

Mark


[Bug backends/31142] riscv pass_by_flattened_arg not implemented

2023-12-20 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=31142

Mark Wielaard  changed:

   What|Removed |Added

   Assignee|unassigned at sourceware dot org   |mark at klomp dot org
 Status|NEW |ASSIGNED

--- Comment #4 from Mark Wielaard  ---
The full calling convention (and return registers) rules are here:
https://raw.githubusercontent.com/riscv-non-isa/riscv-elf-psabi-doc/master/riscv-cc.adoc

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