public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug demangler/99935] New: Stack exhaustion demangling rust mangled name
@ 2021-04-06 13:06 nickc at gcc dot gnu.org
  2021-05-07 16:00 ` [Bug demangler/99935] " nickc at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: nickc at gcc dot gnu.org @ 2021-04-06 13:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99935

            Bug ID: 99935
           Summary: Stack exhaustion demangling rust mangled name
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: demangler
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nickc at gcc dot gnu.org
  Target Milestone: ---

The rust demangler can be pushed into an infinite loop, triggering stack
exhaustion:

  %  cat pr27963
# Reproduced from binutils PR 27963.
# Note - the expected output is wrong.  It is just there as a placeholder.
--format=rust
_RIMBALO_suB_I__Z5printi
fred

  % valgrind ./testsuite/test-demangle < pr27963
[...]
==429737== Stack overflow in thread #1: can't grow stack to 0x1ffe001000
[...]
=429737== Stack overflow in thread #1: can't grow stack to 0x1ffe001000
==429737==    at 0x410BA7: demangle_path (rust-demangle.c:742)
[...]
Segmentation fault (core dumped)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug demangler/99935] Stack exhaustion demangling rust mangled name
  2021-04-06 13:06 [Bug demangler/99935] New: Stack exhaustion demangling rust mangled name nickc at gcc dot gnu.org
@ 2021-05-07 16:00 ` nickc at gcc dot gnu.org
  2021-08-05 10:21 ` redi at gcc dot gnu.org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: nickc at gcc dot gnu.org @ 2021-05-07 16:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99935

--- Comment #1 from Nick Clifton <nickc at gcc dot gnu.org> ---
Created attachment 50777
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50777&action=edit
Proposed patch

Here is a possible patch for the problem, adding a recursion limit to the
demangle_path() function.

Note - a variation of this bug appears to have been reported on the Ubuntu
mailing lists with a different reproducer:

  https://bugs.launchpad.net/ubuntu/+source/binutils/+bug/1925348

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug demangler/99935] Stack exhaustion demangling rust mangled name
  2021-04-06 13:06 [Bug demangler/99935] New: Stack exhaustion demangling rust mangled name nickc at gcc dot gnu.org
  2021-05-07 16:00 ` [Bug demangler/99935] " nickc at gcc dot gnu.org
@ 2021-08-05 10:21 ` redi at gcc dot gnu.org
  2021-08-11 15:07 ` nickc at gcc dot gnu.org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2021-08-05 10:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99935

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This patch breaks MinGW, see PR 101779

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug demangler/99935] Stack exhaustion demangling rust mangled name
  2021-04-06 13:06 [Bug demangler/99935] New: Stack exhaustion demangling rust mangled name nickc at gcc dot gnu.org
  2021-05-07 16:00 ` [Bug demangler/99935] " nickc at gcc dot gnu.org
  2021-08-05 10:21 ` redi at gcc dot gnu.org
@ 2021-08-11 15:07 ` nickc at gcc dot gnu.org
  2022-01-22 17:54 ` pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: nickc at gcc dot gnu.org @ 2021-08-11 15:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99935

--- Comment #3 from Nick Clifton <nickc at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #2)
> This patch breaks MinGW, see PR 101779

But it can be fixed by:
  https://sourceware.org/bugzilla/show_bug.cgi?id=28207

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug demangler/99935] Stack exhaustion demangling rust mangled name
  2021-04-06 13:06 [Bug demangler/99935] New: Stack exhaustion demangling rust mangled name nickc at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-08-11 15:07 ` nickc at gcc dot gnu.org
@ 2022-01-22 17:54 ` pinskia at gcc dot gnu.org
  2022-01-22 17:54 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-22 17:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99935

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sanjayr at ymail dot com

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 104185 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug demangler/99935] Stack exhaustion demangling rust mangled name
  2021-04-06 13:06 [Bug demangler/99935] New: Stack exhaustion demangling rust mangled name nickc at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-01-22 17:54 ` pinskia at gcc dot gnu.org
@ 2022-01-22 17:54 ` pinskia at gcc dot gnu.org
  2022-01-22 17:54 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-22 17:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99935

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 104186 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug demangler/99935] Stack exhaustion demangling rust mangled name
  2021-04-06 13:06 [Bug demangler/99935] New: Stack exhaustion demangling rust mangled name nickc at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2022-01-22 17:54 ` pinskia at gcc dot gnu.org
@ 2022-01-22 17:54 ` pinskia at gcc dot gnu.org
  2022-01-22 17:55 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-22 17:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99935

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |eliz at gnu dot org

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 101779 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug demangler/99935] Stack exhaustion demangling rust mangled name
  2021-04-06 13:06 [Bug demangler/99935] New: Stack exhaustion demangling rust mangled name nickc at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2022-01-22 17:54 ` pinskia at gcc dot gnu.org
@ 2022-01-22 17:55 ` pinskia at gcc dot gnu.org
  2022-01-22 17:55 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-22 17:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99935

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |featherrain26 at gmail dot com

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 98889 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug demangler/99935] Stack exhaustion demangling rust mangled name
  2021-04-06 13:06 [Bug demangler/99935] New: Stack exhaustion demangling rust mangled name nickc at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2022-01-22 17:55 ` pinskia at gcc dot gnu.org
@ 2022-01-22 17:55 ` pinskia at gcc dot gnu.org
  2022-01-22 17:55 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-22 17:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99935

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-01-22

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug demangler/99935] Stack exhaustion demangling rust mangled name
  2021-04-06 13:06 [Bug demangler/99935] New: Stack exhaustion demangling rust mangled name nickc at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2022-01-22 17:55 ` pinskia at gcc dot gnu.org
@ 2022-01-22 17:55 ` pinskia at gcc dot gnu.org
  2022-01-26 15:31 ` nickc at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-22 17:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99935

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |terrynini38514 at gmail dot com

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 100968 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug demangler/99935] Stack exhaustion demangling rust mangled name
  2021-04-06 13:06 [Bug demangler/99935] New: Stack exhaustion demangling rust mangled name nickc at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2022-01-22 17:55 ` pinskia at gcc dot gnu.org
@ 2022-01-26 15:31 ` nickc at gcc dot gnu.org
  2022-01-31 14:33 ` cvs-commit at gcc dot gnu.org
  2022-02-01 10:57 ` nickc at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: nickc at gcc dot gnu.org @ 2022-01-26 15:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99935

--- Comment #9 from Nick Clifton <nickc at gcc dot gnu.org> ---
A revised patch to fix this PR has been prroposed on gcc-patches:

  https://gcc.gnu.org/pipermail/gcc-patches/2022-January/589277.html

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug demangler/99935] Stack exhaustion demangling rust mangled name
  2021-04-06 13:06 [Bug demangler/99935] New: Stack exhaustion demangling rust mangled name nickc at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2022-01-26 15:31 ` nickc at gcc dot gnu.org
@ 2022-01-31 14:33 ` cvs-commit at gcc dot gnu.org
  2022-02-01 10:57 ` nickc at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-31 14:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99935

--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Nick Clifton <nickc@gcc.gnu.org>:

https://gcc.gnu.org/g:f10bec5ffa487ad3033ed5f38cfd0fc7d696deab

commit r12-6945-gf10bec5ffa487ad3033ed5f38cfd0fc7d696deab
Author: Nick Clifton <nickc@redhat.com>
Date:   Mon Jan 31 14:28:42 2022 +0000

    libiberty: Fix infinite recursion in rust demangler.

    libiberty/
            PR demangler/98886
            PR demangler/99935
            * rust-demangle.c (struct rust_demangler): Add a recursion
            counter.
            (demangle_path): Increment/decrement the recursion counter upon
            entry and exit.  Fail if the counter exceeds a fixed limit.
            (demangle_type): Likewise.
            (rust_demangle_callback): Initialise the recursion counter,
            disabling if requested by the option flags.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug demangler/99935] Stack exhaustion demangling rust mangled name
  2021-04-06 13:06 [Bug demangler/99935] New: Stack exhaustion demangling rust mangled name nickc at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2022-01-31 14:33 ` cvs-commit at gcc dot gnu.org
@ 2022-02-01 10:57 ` nickc at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: nickc at gcc dot gnu.org @ 2022-02-01 10:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99935

Nick Clifton <nickc at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #11 from Nick Clifton <nickc at gcc dot gnu.org> ---
Fixed on mainline.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-02-01 10:57 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-06 13:06 [Bug demangler/99935] New: Stack exhaustion demangling rust mangled name nickc at gcc dot gnu.org
2021-05-07 16:00 ` [Bug demangler/99935] " nickc at gcc dot gnu.org
2021-08-05 10:21 ` redi at gcc dot gnu.org
2021-08-11 15:07 ` nickc at gcc dot gnu.org
2022-01-22 17:54 ` pinskia at gcc dot gnu.org
2022-01-22 17:54 ` pinskia at gcc dot gnu.org
2022-01-22 17:54 ` pinskia at gcc dot gnu.org
2022-01-22 17:55 ` pinskia at gcc dot gnu.org
2022-01-22 17:55 ` pinskia at gcc dot gnu.org
2022-01-22 17:55 ` pinskia at gcc dot gnu.org
2022-01-26 15:31 ` nickc at gcc dot gnu.org
2022-01-31 14:33 ` cvs-commit at gcc dot gnu.org
2022-02-01 10:57 ` nickc at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).