From: Richard Biener <richard.guenther@gmail.com>
To: Nick Clifton <nickc@redhat.com>
Cc: Jakub Jelinek <jakub@redhat.com>,
matz@gcc.gnu.org, sgayou@redhat.com,
Ian Lance Taylor <iant@google.com>,
Pedro Alves <palves@redhat.com>,
tom@tromey.com, GCC Patches <gcc-patches@gcc.gnu.org>,
Binutils <binutils@sourceware.org>,
Jason Merrill <jason@redhat.com>
Subject: Re: RFA/RFC: Add stack recursion limit to libiberty's demangler [v3]
Date: Mon, 03 Dec 2018 10:28:00 -0000 [thread overview]
Message-ID: <CAFiYyc1gTSXgSiJSFKEWaE0UTGbi45-mWHKJnUb4Wvjp86bbFQ@mail.gmail.com> (raw)
In-Reply-To: <fa1abe9c-7545-6a48-cbf0-97b993345523@redhat.com>
On Fri, Nov 30, 2018 at 6:41 PM Nick Clifton <nickc@redhat.com> wrote:
>
> Hi Guys,
>
> >> I think it would be fine to have a large fixed limit plus a flag to
> >> disable the limit.
>
> Great - in which case please may I present version 3 of the patch. In
> this version:
>
> * The cplus_demangle_set_recursion_limit() function has been removed
> and instead a new constant - DEMANGLE_RECURSION_LIMIT - is defined in
> demangle.h.
>
> * The recursion counters in cp-demangle.c have been merged into one
> counter, now contained in the d_info structure.
>
> * In cplus-dem.c the recursion counter has been moved into the work
> structure.
>
> * The description of the DMGL_RECURSE_LIMIT option in demangle.h has
> been enhanced to add a note that if the option is not used, then
> bug reports about stack overflows in the demangler will be rejected.
Shouldn't we make it fool-proof by instead introducing a DMGL_NO_RECURSION_LIMIT
flag and when not set default to limiting recursion?
> * The binutils patch has been updated to reflect these changes. The
> addr2line, cxxfilt, nm and objdump programs now have two new options
> --recurse-limit and --no-recurse-limit, with --recurse-limit being
> the default. The documentation is updated to describe these options
> and to also add a note about bug reports being rejected if
> --no-recurse-limit is used.
>
> What do you think, is this version acceptable ?
>
> Cheers
> Nick
>
> libiberty/ChangeLog
> 2018-11-29 Nick Clifton <nickc@redhat.com>
>
> PR 87681
> PR 87675
> PR 87636
> PR 87335
> * cp-demangle.h (struct d_info): Add recursion_limit field.
> * cp-demangle.c (d_function_type): If the recursion limit is
> enabled and reached, return with a failure result.
> (d_demangle_callback): If the recursion limit is enabled, check
> for a mangled string that is so long that there is not enough
> stack space for the local arrays.
> * cplus-dem.c (struct work): Add recursion_level field.
> (demangle_nested_args): If the recursion limit is enabled and
> reached, return with a failure result.
>
> include/ChangeLog
> 2018-11-29 Nick Clifton <nickc@redhat.com>
>
> * demangle.h (DMGL_RECURSE_LIMIT): Define.
> (DEMANGLE_RECURSION_LIMIT): Prototype.
>
> binutils/ChangeLog
> 2018-11-29 Nick Clifton <nickc@redhat.com>
>
> * addr2line.c (demangle_flags): New static variable.
> (long_options): Add --recurse-limit and --no-recurse-limit.
> (translate_address): Pass demangle_flags to bfd_demangle.
> (main): Handle --recurse-limit and --no-recurse-limit options.
> * cxxfilt.c (flags): Add DMGL_RECURSE_LIMIT.
> (long_options): Add --recurse-limit and --no-recurse-limit.
> (main): Handle new options.
> * dlltool.c (gen_def_file): Include DMGL_RECURSE_LIMIT in flags
> passed to cplus_demangle.
> * nm.c (demangle_flags): New static variable.
> (long_options): Add --recurse-limit and --no-recurse-limit.
> (main): Handle new options.
> * objdump.c (demangle_flags): New static variable.
> (usage): Add --recurse-limit and --no-recurse-limit.
> (long_options): Likewise.
> (objdump_print_symname): Pass demangle_flags to bfd_demangle.
> (disassemble_section): Likewise.
> (dump_dymbols): Likewise.
> (main): Handle new options.
> * prdbg.c (demangle_flags): New static variable.
> (tg_variable): Pass demangle_flags to demangler.
> (tg_start_function): Likewise.
> * stabs.c (demangle_flags): New static variable.
> (stab_demangle_template): Pass demangle_flags to demangler.
> (stab_demangle_v3_argtypes): Likewise.
> (stab_demangle_v3_arg): Likewise.
> * doc/binutuls.texi: Document new command line options.
> * NEWS: Mention the new feature.
> * testsuite/config/default.exp (CXXFILT): Define if not already
> defined.
> (CXXFILTFLAGS): Likewise.
> * testsuite/binutils-all/cxxfilt.exp: New file. Runs a few
> simple tests of the cxxfilt program.
next prev parent reply other threads:[~2018-12-03 10:28 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-30 8:38 RFA/RFC: Add stack recursion limit to libiberty's demangler Nick Clifton
2018-11-30 8:42 ` Jakub Jelinek
2018-11-30 10:27 ` Nick Clifton
2018-11-30 13:46 ` Michael Matz
2018-11-30 14:57 ` Ian Lance Taylor
2018-12-02 0:49 ` Cary Coutant
2018-12-03 14:53 ` Nick Clifton
2018-12-03 22:00 ` Joseph Myers
2018-11-30 13:56 ` Ian Lance Taylor
2018-11-30 14:03 ` Jakub Jelinek
2018-11-30 17:41 ` RFA/RFC: Add stack recursion limit to libiberty's demangler [v3] Nick Clifton
2018-11-30 17:49 ` Jakub Jelinek
2018-11-30 18:19 ` Pedro Alves
2018-12-03 10:28 ` Richard Biener [this message]
2018-12-03 14:45 ` Nick Clifton
2018-12-03 18:49 ` Ian Lance Taylor via gcc-patches
2018-12-04 14:00 ` RFA/RFC: Add stack recursion limit to libiberty's demangler [v4] Nick Clifton
2018-12-04 15:02 ` Pedro Alves
2018-12-04 16:57 ` RFA/RFC: Add stack recursion limit to libiberty's demangler [v5] Nick Clifton
2018-12-04 17:08 ` Pedro Alves
2018-12-06 11:12 ` Nick Clifton
2018-12-06 18:04 ` Ian Lance Taylor via gcc-patches
2018-12-07 16:17 ` H.J. Lu
2018-12-07 16:25 ` [PATCH] Set DEMANGLE_RECURSION_LIMIT to 1536 H.J. Lu
2018-12-10 14:52 ` Michael Matz
2018-12-10 15:10 ` Jakub Jelinek
2018-12-10 15:34 ` Jason Merrill
2018-12-11 0:33 ` Jeff Law
2018-12-11 6:58 ` Jakub Jelinek
2018-12-11 11:05 ` Pedro Alves
2018-12-11 14:26 ` Ian Lance Taylor via gcc-patches
2018-12-11 15:07 ` Pedro Alves
2018-12-11 10:34 ` Pedro Alves
2018-12-10 15:12 ` Nick Clifton
2018-12-10 15:18 ` Jakub Jelinek
2018-12-10 15:26 ` Nick Clifton
2018-12-10 15:35 ` Jakub Jelinek
2018-12-10 18:20 ` Ian Lance Taylor via gcc-patches
2018-12-10 18:55 ` Jakub Jelinek
2018-12-10 23:47 ` Jason Merrill
2018-12-10 15:18 ` David Malcolm
2018-12-10 15:31 ` Nick Clifton
2018-12-06 16:14 ` RFA/RFC: Add stack recursion limit to libiberty's demangler [v5] Jason Merrill
2018-12-06 21:22 ` RFC: libiberty PATCH to disable demangling of ancient mangling schemes Jason Merrill
2018-12-07 10:27 ` Nick Clifton
2018-12-07 10:40 ` Jakub Jelinek
2018-12-07 16:11 ` Pedro Alves
2018-12-07 17:49 ` Tom Tromey
2018-12-07 21:00 ` Jason Merrill
2018-12-14 22:39 ` Jason Merrill
2018-12-16 4:50 ` Simon Marchi
2018-12-07 16:28 ` Nick Clifton
2018-12-07 11:37 ` Richard Biener
2018-12-07 15:49 ` Jason Merrill
2018-12-10 1:04 ` Eric Gallager
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFiYyc1gTSXgSiJSFKEWaE0UTGbi45-mWHKJnUb4Wvjp86bbFQ@mail.gmail.com \
--to=richard.guenther@gmail.com \
--cc=binutils@sourceware.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=iant@google.com \
--cc=jakub@redhat.com \
--cc=jason@redhat.com \
--cc=matz@gcc.gnu.org \
--cc=nickc@redhat.com \
--cc=palves@redhat.com \
--cc=sgayou@redhat.com \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).