public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "tianyangyi at hit dot edu.cn" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug rust/30410] New: bug in rust analyzer
Date: Mon, 01 May 2023 12:09:40 +0000	[thread overview]
Message-ID: <bug-30410-4717@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 30410
           Summary: bug in rust analyzer
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: rust
          Assignee: unassigned at sourceware dot org
          Reporter: tianyangyi at hit dot edu.cn
  Target Milestone: ---

Created attachment 14858
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14858&action=edit
a ELF file wrote in rust

Analyzing the elf file in attachment, input some invalid operation like "p
[$rdi]" will cause a bug.

gdb output as the following.

$ ./gdb buggy
(gdb) p [$rdi]
rust-parse.c:1361: internal-error: parse_binop: Assertion `!required' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
----- Backtrace -----
0x55788f1ddf80 gdb_internal_backtrace_1
        /home/yty/study/binutils-gdb/gdb/bt-utils.c:122
0x55788f1ddf80 _Z22gdb_internal_backtracev
        /home/yty/study/binutils-gdb/gdb/bt-utils.c:168
0x55788f5f2a74 internal_vproblem
        /home/yty/study/binutils-gdb/gdb/utils.c:401
0x55788f5f2d30 _Z15internal_verrorPKciS0_P13__va_list_tag
        /home/yty/study/binutils-gdb/gdb/utils.c:481
0x55788f7479f4 _Z18internal_error_locPKciS0_z
        /home/yty/study/binutils-gdb/gdbsupport/errors.cc:58
0x55788f4ee489 _ZN11rust_parser11parse_binopEb
        /home/yty/study/binutils-gdb/gdb/rust-parse.c:1361
0x55788f4ee7a6 _ZN11rust_parser11parse_rangeEv
        /home/yty/study/binutils-gdb/gdb/rust-parse.c:1483
0x55788f4f02d8 _ZN11rust_parser10parse_exprEv
        /home/yty/study/binutils-gdb/gdb/rust-parse.c:1509
0x55788f4f02d8 _ZN11rust_parser17parse_entry_pointEv
        /home/yty/study/binutils-gdb/gdb/rust-parse.c:274
0x55788f4f02d8 _ZNK13rust_language6parserEP12parser_state
        /home/yty/study/binutils-gdb/gdb/rust-parse.c:2141
0x55788f446ac0 parse_exp_in_context
        /home/yty/study/binutils-gdb/gdb/parse.c:433
0x55788f446e0a _Z16parse_expressionPKcP23innermost_block_trackerb
        /home/yty/study/binutils-gdb/gdb/parse.c:469
0x55788f44bd75 process_print_command_args
        /home/yty/study/binutils-gdb/gdb/printcmd.c:1318
0x55788f44c32f print_command_1
        /home/yty/study/binutils-gdb/gdb/printcmd.c:1332
0x55788f2134f4 _Z8cmd_funcP16cmd_list_elementPKci
        cli/cli-decode.c:2735
0x55788f584871 _Z15execute_commandPKci
        /home/yty/study/binutils-gdb/gdb/top.c:687
0x55788f306c34 _Z15command_handlerPKc
        /home/yty/study/binutils-gdb/gdb/event-top.c:619
0x55788f307f53
_Z20command_line_handlerOSt10unique_ptrIcN3gdb13xfree_deleterIcEEE
        /home/yty/study/binutils-gdb/gdb/event-top.c:855
0x55788f30769c gdb_rl_callback_handler
        /home/yty/study/binutils-gdb/gdb/event-top.c:249
0x55788f63ccc7 rl_callback_read_char
        /home/yty/study/binutils-gdb/readline/readline/callback.c:290
0x55788f3066cd gdb_rl_callback_read_char_wrapper_noexcept
        /home/yty/study/binutils-gdb/gdb/event-top.c:191
0x55788f307553 gdb_rl_callback_read_char_wrapper
        /home/yty/study/binutils-gdb/gdb/event-top.c:224
0x55788f305e9f stdin_event_handler
        /home/yty/study/binutils-gdb/gdb/event-top.c:544
0x55788f748455 gdb_wait_for_event
        /home/yty/study/binutils-gdb/gdbsupport/event-loop.cc:694
0x55788f748e85 gdb_wait_for_event
        /home/yty/study/binutils-gdb/gdbsupport/event-loop.cc:593
0x55788f748e85 _Z16gdb_do_one_eventi
        /home/yty/study/binutils-gdb/gdbsupport/event-loop.cc:264
0x55788f3e71b9 start_event_loop
        /home/yty/study/binutils-gdb/gdb/main.c:411
0x55788f3e71b9 captured_command_loop
        /home/yty/study/binutils-gdb/gdb/main.c:475
0x55788f3e8db4 captured_main
        /home/yty/study/binutils-gdb/gdb/main.c:1318
0x55788f3e8db4 _Z8gdb_mainP18captured_main_args
        /home/yty/study/binutils-gdb/gdb/main.c:1337
0x55788f12c0bf main
        /home/yty/study/binutils-gdb/gdb/gdb.c:32
---------------------
rust-parse.c:1361: internal-error: parse_binop: Assertion `!required' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.

My enviroment is Ubuntu 22.04 LTS. My gdb version is:

$ gdb -v
GNU gdb (GDB) 14.0.50.20230501-git
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Besides, on release version 12.1, there is also the same bug.Firstly I found
the bug on my release version, and test it on the HEAD version, found the same
bug.

$ gdb -v
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

I don't have the soure code of the attachment. It is wrote in rust. It is a
challange named "babyheap" in Aliyun CTF.

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

             reply	other threads:[~2023-05-01 12:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-01 12:09 tianyangyi at hit dot edu.cn [this message]
2023-05-01 16:01 ` [Bug rust/30410] " tromey at sourceware dot org
2023-05-01 16:17 ` cvs-commit at gcc dot gnu.org
2023-05-01 16:22 ` tromey at sourceware dot org
2023-07-21 13:24 ` tromey at sourceware dot org

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=bug-30410-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /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).