public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb] bpf stack smashing detected
Date: Fri, 05 Jun 2020 09:15:15 -0400	[thread overview]
Message-ID: <d3d1cc7b13b4b1f11862d6b58174c81536fb3340@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT d3d1cc7b13b4b1f11862d6b58174c81536fb3340 ***

commit d3d1cc7b13b4b1f11862d6b58174c81536fb3340
Author:     Alan Modra <amodra@gmail.com>
AuthorDate: Fri Jun 5 16:18:47 2020 +0930
Commit:     Alan Modra <amodra@gmail.com>
CommitDate: Fri Jun 5 16:22:46 2020 +0930

    bpf stack smashing detected
    
            * cgen-dis.c (hash_insn_array): Increase size of buf.  Assert
            size is large enough.

diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 63824c8e33..86e381acc9 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,8 @@
+2020-06-05  Alan Modra  <amodra@gmail.com>
+
+	* cgen-dis.c (hash_insn_array): Increase size of buf.  Assert
+	size is large enough.
+
 2020-06-04  Jose E. Marchesi  <jose.marchesi@oracle.com>
 
 	* disassemble.c (disassemble_init_for_target): Set endian_code for
diff --git a/opcodes/cgen-dis.c b/opcodes/cgen-dis.c
index bcc5b4b890..377c93cfab 100644
--- a/opcodes/cgen-dis.c
+++ b/opcodes/cgen-dis.c
@@ -24,6 +24,7 @@
 #include "bfd.h"
 #include "symcat.h"
 #include "opcode/cgen.h"
+#include "disassemble.h"
 
 static CGEN_INSN_LIST *  hash_insn_array        (CGEN_CPU_DESC, const CGEN_INSN *, int, int, CGEN_INSN_LIST **, CGEN_INSN_LIST *);
 static CGEN_INSN_LIST *  hash_insn_list         (CGEN_CPU_DESC, const CGEN_INSN_LIST *, CGEN_INSN_LIST **, CGEN_INSN_LIST *);
@@ -110,9 +111,10 @@ hash_insn_array (CGEN_CPU_DESC cd,
   for (i = count - 1; i >= 0; --i, ++hentbuf)
     {
       unsigned int hash;
-      char buf [4];
+      char buf [8];
       unsigned long value;
       const CGEN_INSN *insn = &insns[i];
+      size_t size;
 
       if (! (* cd->dis_hash_p) (insn))
 	continue;
@@ -121,10 +123,9 @@ hash_insn_array (CGEN_CPU_DESC cd,
 	 to hash on, so set both up.  */
 
       value = CGEN_INSN_BASE_VALUE (insn);
-      bfd_put_bits ((bfd_vma) value,
-		    buf,
-		    CGEN_INSN_MASK_BITSIZE (insn),
-		    big_p);
+      size = CGEN_INSN_MASK_BITSIZE (insn);
+      OPCODES_ASSERT (size <= sizeof (buf) * 8);
+      bfd_put_bits ((bfd_vma) value, buf, size, big_p);
       hash = (* cd->dis_hash) (buf, value);
       add_insn_to_hash_chain (hentbuf, insn, htable, hash);
     }


             reply	other threads:[~2020-06-05 13:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-05 13:15 gdb-buildbot [this message]
2020-06-05 13:15 ` Failures on Ubuntu-Aarch64-native-extended-gdbserver-m64, branch master gdb-buildbot
2020-07-07  1:15 ` Failures on Fedora-i686, " gdb-buildbot
2020-07-07  1:52 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot
2020-07-07  1:54 ` Failures on Fedora-x86_64-m32, " gdb-buildbot
2020-07-07  2:26 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2020-07-07  2:39 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot
2020-07-07  3:13 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot
2020-07-07  3:14 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot
2020-07-07  3:51 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot

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=d3d1cc7b13b4b1f11862d6b58174c81536fb3340@gdb-build \
    --to=gdb-buildbot@sergiodj.net \
    --cc=gdb-testers@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).