public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: buildbot@builder.wildebeest.org
Cc: dwz@sourceware.org
Subject: Re: Buildbot failure in Wildebeest Builder on whole buildset
Date: Wed, 14 Oct 2020 12:36:55 +0200	[thread overview]
Message-ID: <20201014103655.GA5751@wildebeest.org> (raw)
In-Reply-To: <20201013222039.GB17609@wildebeest.org>

[-- Attachment #1: Type: text/plain, Size: 771 bytes --]

Hi,

On Wed, Oct 14, 2020 at 12:20:39AM +0200, Mark Wielaard wrote:
> So that is obviously my last commit. Sorry. All three buildbot workers
> fail on the same testcase pr25109.sh which is no-multifile-prop. That
> testcase has an empty debug_line and no decl/call_files. It still
> generates a .debug_line entry (and because no files have been seen, it
> produces a DWARF5 line table, which might be a bug in itself). I don't
> yet understand why this fails on ppc64, ppc64le and arm64 only and not
> on any other arch. Still investigating.

That was fun. It was a buffer overflow causing some on stack variables
to change values, but for some reason only on ppc64, ppc64 and
arm64. But it should have caused issues on all arches.

Pushed to attached fix.

Cheers,

Mark

[-- Attachment #2: 0001-Fix-buffer-overflow-in-write_multifile_line.patch --]
[-- Type: text/x-diff, Size: 1224 bytes --]

From babfff7baedefd5830340e2ad583b7732a895c49 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Wed, 14 Oct 2020 12:30:27 +0200
Subject: [PATCH] Fix buffer overflow in write_multifile_line.

When writing out a "header only" .debug_line we use a small static
buffer on the stack. Make sure this buffer is large enough to contain
a DWARF5 empty line table header.

ChangeLog:

	* dwz.c (write_multi_line): Extend buf to 45 chars. Add assert
	to check buf is large enough.
---
 dwz.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/dwz.c b/dwz.c
index 1e6ec26..f8f2910 100644
--- a/dwz.c
+++ b/dwz.c
@@ -14304,7 +14304,7 @@ write_multifile_line (void)
   struct line_entry **filearr = NULL;
   struct line_stats line_stats;
   unsigned int *diridx = NULL, *dirarr = NULL;
-  unsigned char buf[17];
+  unsigned char buf[45]; /* Max header_len, see below.  */
   int ret = 0;
 
   line_stats.has_time = line_stats.has_size = false;
@@ -14430,7 +14430,10 @@ write_multifile_line (void)
 	}
 
       if (len == header_len)
-	line = buf;
+	{
+	  line = buf;
+	  assert (sizeof (buf) >= header_len);
+	}
       else
 	line = (unsigned char *) obstack_alloc (&ob, len);
     }
-- 
2.20.1


  reply	other threads:[~2020-10-14 10:37 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-13 21:29 buildbot
2020-10-13 22:20 ` Mark Wielaard
2020-10-14 10:36   ` Mark Wielaard [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-03-26 13:04 buildbot
2021-03-25  8:41 buildbot
2020-07-19 23:00 buildbot
2020-07-19 23:17 ` Mark Wielaard
2020-01-01  0:00 buildbot
2020-01-01  0:00 ` Mark Wielaard
2019-01-01  0:00 buildbot
2019-01-01  0:00 buildbot
2019-01-01  0:00 buildbot
2019-01-01  0:00 buildbot
2019-01-01  0:00 buildbot
2019-01-01  0:00 ` Mark Wielaard
2019-01-01  0:00   ` Tom de Vries
2019-01-01  0:00 buildbot
2019-01-01  0:00 buildbot
2019-01-01  0:00 ` Mark Wielaard
2019-01-01  0:00 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=20201014103655.GA5751@wildebeest.org \
    --to=mark@klomp.org \
    --cc=buildbot@builder.wildebeest.org \
    --cc=dwz@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).