public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Jaydeep Patil <Jaydeep.Patil@imgtec.com>
To: Andrew Burgess <aburgess@redhat.com>,
	"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Cc: "vapier@gentoo.org" <vapier@gentoo.org>,
	Joseph Faulls <Joseph.Faulls@imgtec.com>,
	Bhushan Attarde <Bhushan.Attarde@imgtec.com>
Subject: RE: [EXTERNAL] Re: [PATCH v5 1/2] [sim/riscv] Fix crash during instruction decoding
Date: Wed, 10 Jan 2024 11:34:30 +0000	[thread overview]
Message-ID: <CWXP265MB5321DABD727DE50087A13A058C692@CWXP265MB5321.GBRP265.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <87mstd8p4b.fsf@redhat.com>

<aburgess@redhat.com> writes:

>This second commit talks about treating a NULL as actually meaning match_always.  I've not dug into this beyond looking at those commits, but that second commit does include some code similar to yours, except in that case they've gone with something like:
>
>  if (op->match_func && !(op->match_func) (op, word))
>    continue;
>
>I'd like to see a commit message that references this history, and explains why this commit does something different.
>
>Also, does your change indicate that there exists an instruction encoding which, if we try to disassemble it, will cause the disassembler to segfault?  That would be a good candidate for making into a test, maybe in the gas testsuite?
>

Looking at the riscv_opcodes[] table in opcodes/riscv-opc.c, we don't need to modify opcodes/riscv-dis.c.
The match_never() has been replaced with NULL for INSN_MACRO types. Thus disassembler will never segfault because of following code:

@@ -818,7 +818,7 @@ riscv_disassemble_insn (bfd_vma memaddr,
	  if (op->pinfo == INSN_MACRO)
	    continue;

The segfault happens only in step_once() of sim/riscv/sim-main.c.

Regards,
Jaydeep


  reply	other threads:[~2024-01-10 11:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-22  5:26 [PATCH v5 0/2] sim: riscv: Compressed instruction simulation jaydeep.patil
2023-12-22  5:26 ` [PATCH v5 1/2] [sim/riscv] Fix crash during instruction decoding jaydeep.patil
2024-01-10 10:22   ` Andrew Burgess
2024-01-10 11:34     ` Jaydeep Patil [this message]
2023-12-22  5:26 ` [PATCH v5 2/2] [sim/riscv] Add support for compressed integer instructions jaydeep.patil
2024-01-04  4:24 ` [PATCH v5 0/2] sim: riscv: Compressed instruction simulation Jaydeep Patil
2024-01-05  5:41   ` Mike Frysinger

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=CWXP265MB5321DABD727DE50087A13A058C692@CWXP265MB5321.GBRP265.PROD.OUTLOOK.COM \
    --to=jaydeep.patil@imgtec.com \
    --cc=Bhushan.Attarde@imgtec.com \
    --cc=Joseph.Faulls@imgtec.com \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=vapier@gentoo.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).