[Bug ld/29310] [2.39 Regression] copy relocation against non-copyable protected symbol `__cxa_ pure_virtual' on aarch64-linux-gnu

2022-07-01 Thread doko at debian dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=29310

--- Comment #1 from Matthias Klose  ---
also reported as https://gcc.gnu.org/PR106145

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


[Bug gas/29309] Assembler Segmentation Fault when -g is given

2022-07-01 Thread nickc at redhat dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=29309

Nick Clifton  changed:

   What|Removed |Added

 CC||nickc at redhat dot com

--- Comment #1 from Nick Clifton  ---
Hi Volker,

> I'm not sure if this is a bug in GCC or in as.

It is a bug in as.  Even if gcc is passing it some kind of bogus input, it
should not be triggering a segmentation fault.  Well either that or gcc is
lying about where the segmentation fault occurs...


> $ gcc -g -c bug.S --save-temps
> bug.s: Assembler messages:
> bug.s: Internal error (Segmentation fault).

> $ as -g -c bug.S
> 

So are you saying that if you invoke as via the gcc driver program
the segmentation fault happens, but if you invoke as directly then
it does not ?


> $ gcc -v
> gcc version 12.1.0 (GCC)
> 
> $ as --version
> GNU assembler (GNU Binutils) 2.34.50.20200328

That is a slightly old version of the assembler.  Are you able to 
repeat the test using the 2.38 release ?

(I tried to reproduce the problem locally, but failed).

Cheers
  Nick

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


[Bug binutils/29312] New: Stack overflow in demangle_const() and demangle_path_maybe_open_generics(), cxxfilt

2022-07-01 Thread lqliuyuwei at outlook dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=29312

Bug ID: 29312
   Summary: Stack overflow in demangle_const() and
demangle_path_maybe_open_generics(), cxxfilt
   Product: binutils
   Version: 2.39 (HEAD)
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: lqliuyuwei at outlook dot com
  Target Milestone: ---

Created attachment 14190
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14190&action=edit
poc for demangle_const

PoCs to trigger the stack overflow.

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


[Bug binutils/29312] Stack overflow in demangle_const() and demangle_path_maybe_open_generics(), cxxfilt

2022-07-01 Thread lqliuyuwei at outlook dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=29312

--- Comment #1 from Marsman1996  ---
Created attachment 14191
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14191&action=edit
poc for demangle_path_maybe_open_generics

Both tested in Ubuntu 16.04,
Binutils commit 2899490953879ccb22e64d6b8bc09fe9b9cdc5a7

To trigger the carsh, run command `$ ./cxxfilt < $POC`

The ASAN report is
```
AddressSanitizer:DEADLYSIGNAL
=
==23686==ERROR: AddressSanitizer: stack-overflow on address 0x7fff44f2ef40 (pc
0x0085c097 bp 0x7fff44f2f110 sp 0x7fff44f2ef40 T0)
#0 0x85c096 in demangle_const
/opt/disk/marsman/binutils/2899490/build_asan/libiberty/../../code/libiberty/rust-demangle.c:1144
#1 0x85c722 in demangle_const
/opt/disk/marsman/binutils/2899490/build_asan/libiberty/../../code/libiberty/rust-demangle.c:1158:11
#2 0x85c722 in demangle_const
/opt/disk/marsman/binutils/2899490/build_asan/libiberty/../../code/libiberty/rust-demangle.c:1158:11
#3 0x85c722 in demangle_const
/opt/disk/marsman/binutils/2899490/build_asan/libiberty/../../code/libiberty/rust-demangle.c:1158:11
#4 0x85c722 in demangle_const
/opt/disk/marsman/binutils/2899490/build_asan/libiberty/../../code/libiberty/rust-demangle.c:1158:11
#5 0x85c722 in demangle_const
/opt/disk/marsman/binutils/2899490/build_asan/libiberty/../../code/libiberty/rust-demangle.c:1158:11
#6 0x85c722 in demangle_const
/opt/disk/marsman/binutils/2899490/build_asan/libiberty/../../code/libiberty/rust-demangle.c:1158:11
#7 0x85c722 in demangle_const
/opt/disk/marsman/binutils/2899490/build_asan/libiberty/../../code/libiberty/rust-demangle.c:1158:11
#8 0x85c722 in demangle_const
/opt/disk/marsman/binutils/2899490/build_asan/libiberty/../../code/libiberty/rust-demangle.c:1158:11
#9 0x85c722 in demangle_const
/opt/disk/marsman/binutils/2899490/build_asan/libiberty/../../code/libiberty/rust-demangle.c:1158:11
#10 0x85c722 in demangle_const
/opt/disk/marsman/binutils/2899490/build_asan/libiberty/../../code/libiberty/rust-demangle.c:1158:11
#11 0x85c722 in demangle_const
/opt/disk/marsman/binutils/2899490/build_asan/libiberty/../../code/libiberty/rust-demangle.c:1158:11
#12 0x85c722 in demangle_const
/opt/disk/marsman/binutils/2899490/build_asan/libiberty/../../code/libiberty/rust-demangle.c:1158:11
   ...
```

And 

```
AddressSanitizer:DEADLYSIGNAL
=
==23696==ERROR: AddressSanitizer: stack-overflow on address 0x7ffebacebfd8 (pc
0x0085f947 bp 0x7ffebacec030 sp 0x7ffebacebfa0 T0)
#0 0x85f946 in demangle_path_maybe_open_generics
/opt/disk/marsman/binutils/2899490/build_asan/libiberty/../../code/libiberty/rust-demangle.c:1082:12
#1 0x85ff03 in demangle_path_maybe_open_generics
/opt/disk/marsman/binutils/2899490/build_asan/libiberty/../../code/libiberty/rust-demangle.c:1092:18
#2 0x85ff03 in demangle_path_maybe_open_generics
/opt/disk/marsman/binutils/2899490/build_asan/libiberty/../../code/libiberty/rust-demangle.c:1092:18
#3 0x85ff03 in demangle_path_maybe_open_generics
/opt/disk/marsman/binutils/2899490/build_asan/libiberty/../../code/libiberty/rust-demangle.c:1092:18
#4 0x85ff03 in demangle_path_maybe_open_generics
/opt/disk/marsman/binutils/2899490/build_asan/libiberty/../../code/libiberty/rust-demangle.c:1092:18
#5 0x85ff03 in demangle_path_maybe_open_generics
/opt/disk/marsman/binutils/2899490/build_asan/libiberty/../../code/libiberty/rust-demangle.c:1092:18
#6 0x85ff03 in demangle_path_maybe_open_generics
/opt/disk/marsman/binutils/2899490/build_asan/libiberty/../../code/libiberty/rust-demangle.c:1092:18
#7 0x85ff03 in demangle_path_maybe_open_generics
/opt/disk/marsman/binutils/2899490/build_asan/libiberty/../../code/libiberty/rust-demangle.c:1092:18
#8 0x85ff03 in demangle_path_maybe_open_generics
/opt/disk/marsman/binutils/2899490/build_asan/libiberty/../../code/libiberty/rust-demangle.c:1092:18
#9 0x85ff03 in demangle_path_maybe_open_generics
/opt/disk/marsman/binutils/2899490/build_asan/libiberty/../../code/libiberty/rust-demangle.c:1092:18
#10 0x85ff03 in demangle_path_maybe_open_generics
/opt/disk/marsman/binutils/2899490/build_asan/libiberty/../../code/libiberty/rust-demangle.c:1092:18
#11 0x85ff03 in demangle_path_maybe_open_generics
/opt/disk/marsman/binutils/2899490/build_asan/libiberty/../../code/libiberty/rust-demangle.c:1092:18
#12 0x85ff03 in demangle_path_maybe_open_generics
/opt/disk/marsman/binutils/2899490/build_asan/libiberty/../../code/libiberty/rust-demangle.c:1092:18
#13 0x85ff03 in demangle_path_maybe_open_generics
/opt/disk/marsman/binutils/2899490/build_asan/libiberty/../../code/libiberty/rust-demangle.c:1092:18
#14 0x85ff03 in demangle_path_maybe_open_generics
/opt/disk/marsman/binutils/2899490/build_asan/libiberty/../../code/libiberty/rust-demangle.c:1092:18
#15 0x85ff03 in demangle_path_maybe_open_ge

[Bug binutils/29312] Stack overflow in demangle_const() and demangle_path_maybe_open_generics(), cxxfilt

2022-07-01 Thread nickc at redhat dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=29312

Nick Clifton  changed:

   What|Removed |Added

 CC||nickc at redhat dot com
 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |MOVED

--- Comment #2 from Nick Clifton  ---
Hi Marsman1996,

  Good news / bad news:

  Bad news: This is the wrong place to report this bug.  
 The demangler is part of the libiberty library which is maintained
 by the gcc project.  The binutils just makes use of this library.

  Good news: The bug has already been reported:
 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105039

  Bad news:  The patch that fixes the problem has not been reviewed or
 applied to the gcc sources.

  Good news: We are planning on making a new release of the binutils
 next month (2.39) and intend on making sure that the patch is in
 the binutils sources, even if it is not in the gcc sources.

  Bad news:  The patch only fixes one of your reproducers (demangle_const)
 The other reproducer still causes problems.

  Good news: I am investigating the second reproducer.

Conclusion:

  Please could you refile this bug report on the gcc bugzilla system.
  Maybe that will prompt someone to look at the situation again.  Plus
  it will give me somewhere to hang a second patch (assuming that I
  can create one) to fix the second reproducer.

Cheers
  Nick

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


[Bug ld/29310] [2.39 Regression] copy relocation against non-copyable protected symbol `__cxa_ pure_virtual' on aarch64-linux-gnu

2022-07-01 Thread doko at debian dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=29310

Matthias Klose  changed:

   What|Removed |Added

 CC||maskray at google dot com

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


[Bug binutils/29312] Stack overflow in demangle_const() and demangle_path_maybe_open_generics(), cxxfilt

2022-07-01 Thread nickc at redhat dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=29312

--- Comment #3 from Nick Clifton  ---
Created attachment 14192
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14192&action=edit
Proposed Patch

FYI:

  Here is a combined patch that fixes both reproducers.

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


[Bug ld/29310] [2.39 Regression] copy relocation against non-copyable protected symbol `__cxa_ pure_virtual' on aarch64-linux-gnu

2022-07-01 Thread doko at debian dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=29310

--- Comment #2 from Matthias Klose  ---
caused by 90b7a5df152a64d2bea20beb438e8b81049a5c30 and
4fb55bf6a9606eb7b626c30a9f4e71d6c2d4fbb2

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


[Bug binutils/29312] Stack overflow in demangle_const() and demangle_path_maybe_open_generics(), cxxfilt

2022-07-01 Thread lqliuyuwei at outlook dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=29312

--- Comment #4 from Marsman1996  ---
Hi Nick,

I apologize for not doing enough prior research and thanks for the information.

GCC bugzilla system seems to limit the user account creation.

Sincerely,
Marsman

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


[Bug binutils/29312] Stack overflow in demangle_const() and demangle_path_maybe_open_generics(), cxxfilt

2022-07-01 Thread nickc at redhat dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=29312

--- Comment #5 from Nick Clifton  ---
(In reply to Marsman1996 from comment #4)
Hi Marsman1996

> I apologize for not doing enough prior research and thanks for the
> information.

No worries - it is a common misconception that the libiberty demangling code
belongs to the binutils.  After all we are one of the most obvious users of
the code.

> GCC bugzilla system seems to limit the user account creation.

If you are unable to create an account then sending a bug report to 
gcc-b...@gcc.gnu.org  should work instead.

Cheers
  Nick

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


[Bug binutils/29312] Stack overflow in demangle_const() and demangle_path_maybe_open_generics(), cxxfilt

2022-07-01 Thread lqliuyuwei at outlook dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=29312

--- Comment #6 from Marsman1996  ---
(In reply to Nick Clifton from comment #5)

Hi Nick,

> If you are unable to create an account then sending a bug report to 
> gcc-b...@gcc.gnu.org  should work instead.

Thanks for the advice, I have sent the bug report. 
Hope they will accept the patch and fix this soon.


Sincerely,
Marsman

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


[Bug ld/29310] [2.39 Regression] copy relocation against non-copyable protected symbol `__cxa_ pure_virtual' on aarch64-linux-gnu

2022-07-01 Thread nsz at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=29310

Szabolcs Nagy  changed:

   What|Removed |Added

 CC||nsz at gcc dot gnu.org

--- Comment #3 from Szabolcs Nagy  ---
linking lto1 does not fail (in the build log), gnat1 does.

i don't know how __cxa_pure_virtual ends up being protected, but
the link uses -static-libstdc++ where the definition should be,
so copy reloc should not happen and thus the error is wrong.

somethings that may help debugging:

check `readelf -aW gnat1 |grep __cxa_pure_virtual` after linking
with old binutils (is there any reloc? is it protected?)

pass  -Wl,-y,__cxa_pure_virtual to the failing link (does the
definition come from static libstdc++?).

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


[Bug binutils/29267] readelf..info misreports DW_FORM_loclistx, DW_FORM_rnglistx

2022-07-01 Thread nickc at redhat dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=29267

--- Comment #19 from Nick Clifton  ---
(In reply to Vsevolod Alekseyev from comment #17)

> The loclist entries in sections with nonblank offset tables in are dumped
> differently; the start/end address of location entries is not resolved
> relative to the corresponding CU's base PC. This is inconsistent with the
> past behavior, and rather misleading.

I made these changes in order to bring readelf's output more inline with
the output from eu-readelf.  I have been using that tool's output as a 
comparison for the updates for this issue, and using the same general format
helps with that.

But I am also willing to undo unnecessary formatting changes, so please 
can you provide me an example of the before and after formatting, so that
I can be sure that I am changing the correct things. :-)

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


[Bug ld/29310] [2.39 Regression] copy relocation against non-copyable protected symbol `__cxa_ pure_virtual' on aarch64-linux-gnu

2022-07-01 Thread doko at debian dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=29310

--- Comment #4 from Matthias Klose  ---
it depends which *1 executable is built first.

https://launchpadlibrarian.net/610456289/buildlog_ubuntu-kinetic-arm64.gcc-11_11.3.0-4ubuntu1_BUILDING.txt.gz
has failures in f951 and go1,

https://launchpadlibrarian.net/610252712/buildlog_ubuntu-kinetic-arm64.gcc-12_12.1.0-5ubuntu1_BUILDING.txt.gz
has a failure in dm21

I'm sure I saw a failure on lto1 too, but it looks there's some randomness
which of these is built first.

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


[Bug binutils/29312] Stack overflow in demangle_const() and demangle_path_maybe_open_generics(), cxxfilt

2022-07-01 Thread joseph at codesourcery dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=29312

--- Comment #7 from joseph at codesourcery dot com  ---
On Fri, 1 Jul 2022, nickc at redhat dot com wrote:

>   Good news: The bug has already been reported:
>  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105039
> 
>   Bad news:  The patch that fixes the problem has not been reviewed or
>  applied to the gcc sources.

It was approved on Sunday: 
https://gcc.gnu.org/pipermail/gcc-patches/2022-June/597275.html

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


[Bug binutils/29312] Stack overflow in demangle_const() and demangle_path_maybe_open_generics(), cxxfilt

2022-07-01 Thread nickc at redhat dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=29312

--- Comment #8 from Nick Clifton  ---
(In reply to jos...@codesourcery.com from comment #7)

Hi Joseph,

> It was approved on Sunday: 
> https://gcc.gnu.org/pipermail/gcc-patches/2022-June/597275.html

Thanks - I missed that.

I have now applied the patch for PR 105039 upstream.

There is still a need for a patch to fix the second PoC, so I will
try submitting my fix for that one.

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


[Bug binutils/29267] readelf..info misreports DW_FORM_loclistx, DW_FORM_rnglistx

2022-07-01 Thread sevaa at sprynet dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=29267

--- Comment #20 from Vsevolod Alekseyev  ---
At this juncture, we gave up on using readelf as a reference implementation of
DWARF parsing. You may do with this issue as you please.

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


[Bug gas/29309] Assembler Segmentation Fault when -g is given

2022-07-01 Thread volker.weissmann at gmx dot de
https://sourceware.org/bugzilla/show_bug.cgi?id=29309

Volker Weißmann  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |INVALID

--- Comment #2 from Volker Weißmann  ---
> So are you saying that if you invoke as via the gcc driver program
the segmentation fault happens, but if you invoke as directly then
it does not ?

Yes

Anyway, the bug appears to result from a misconfiguration of my system:
"which as" returned /usr/local/bin/as . This file was not installed by the
package manager, I do not know how it got installed. I deleted it and now
"which as" returns "/usr/bin/as" and the segfault does not happen anymore.

It was probably a version missmatch - a new gcc paired with an old as.

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


[Bug ld/29310] [2.39 Regression] copy relocation against non-copyable protected symbol `__cxa_ pure_virtual' on aarch64-linux-gnu

2022-07-01 Thread i at maskray dot me
https://sourceware.org/bugzilla/show_bug.cgi?id=29310

Fangrui Song  changed:

   What|Removed |Added

 CC||i at maskray dot me

--- Comment #5 from Fangrui Song  ---
(In reply to Matthias Klose from comment #4)
> it depends which *1 executable is built first.
> 
> https://launchpadlibrarian.net/610456289/buildlog_ubuntu-kinetic-arm64.gcc-
> 11_11.3.0-4ubuntu1_BUILDING.txt.gz
> has failures in f951 and go1,
> 
> https://launchpadlibrarian.net/610252712/buildlog_ubuntu-kinetic-arm64.gcc-
> 12_12.1.0-5ubuntu1_BUILDING.txt.gz
> has a failure in dm21
> 
> I'm sure I saw a failure on lto1 too, but it looks there's some randomness
> which of these is built first.

As nsz' commention suggests, -Wl,-y,__cxa_pure_virtual information (and then
run `readelf -sW` on the defining archive/object) is needed. The logs are not
useful.

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