public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* right, trying --enable-sanitizer-address on armv7l
@ 2021-12-09 14:23 Mark Wielaard
  2021-12-09 15:06 ` Mark Wielaard
  2021-12-09 15:47 ` Frank Ch. Eigler
  0 siblings, 2 replies; 4+ messages in thread
From: Mark Wielaard @ 2021-12-09 14:23 UTC (permalink / raw)
  To: elfutils-devel

Hi,

I was trying the new --enable-sanitizer-address on our armv7l buildbot
worker and it almost works as is, except for...

debuginfod.cxx:3472:12: runtime error: reference binding to misaligned
address 0x00561ec9 for type '<unknown>', which requires 2 byte
alignment
0x00561ec9: note: pointer points here
 12 0a 00  2d e9 f0 4f 85 b0 00 af  f8 60 df f8 bc e1 fe 44  f8 68 fa
68 00 2a 04 d0  00 f0 03 0c bc
              ^ 

And indeed removing 'right' here:

diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index 35424e47..6fad331a 100644
--- a/debuginfod/debuginfod.cxx
+++ b/debuginfod/debuginfod.cxx
@@ -3469,7 +3469,7 @@ database_stats_report()
         throw sqlite_exception(rc, "step");
 
       obatched(clog)
-        << right << setw(20) << ((const char*)
sqlite3_column_text(ps_query, 0) ?: (const char*) "NULL")
+        << setw(20) << ((const char*) sqlite3_column_text(ps_query, 0)
?: (const char*) "NULL")
         << " "
         << (sqlite3_column_text(ps_query, 1) ?: (const unsigned char*)
"NULL")
         << endl;

Makes everything PASS.

But I don't understand why. It might be a bug in gcc/libasan (this is
gcc 8.3.0 Debian 10.11 - Buster). I can try upgrading the machine to
Debian 11 - Bullseye this weekend to see if that helps.

Also, do we really want to right align the log here? We don't seem to
align the log text anywhere else.

Cheers,

Mark

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: right, trying --enable-sanitizer-address on armv7l
  2021-12-09 14:23 right, trying --enable-sanitizer-address on armv7l Mark Wielaard
@ 2021-12-09 15:06 ` Mark Wielaard
  2021-12-09 15:47 ` Frank Ch. Eigler
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Wielaard @ 2021-12-09 15:06 UTC (permalink / raw)
  To: elfutils-devel

Hi,

On Thu, 2021-12-09 at 15:23 +0100, Mark Wielaard wrote:
> I was trying the new --enable-sanitizer-address on our armv7l
> buildbot worker and it almost works as is, except for...

I was confusing address sanitizer and the undefined sanitizer. It is
the undefined sanitizer that produces the following runtime error. The 
new address sanitizer seems to work as expected. So I'll at least use
--enable-sanitizer-address on the armv7l CI buildbot worker, but it
would be nice to figure out why the undefined sanitizer is complaining
about this usage of "right" and whether we really need it.

> debuginfod.cxx:3472:12: runtime error: reference binding to misaligned
> address 0x00561ec9 for type '<unknown>', which requires 2 byte
> alignment
> 0x00561ec9: note: pointer points here
>  12 0a 00  2d e9 f0 4f 85 b0 00 af  f8 60 df f8 bc e1 fe 44  f8 68 fa
> 68 00 2a 04 d0  00 f0 03 0c bc
>               ^ 
> 
> And indeed removing 'right' here:
> 
> diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
> index 35424e47..6fad331a 100644
> --- a/debuginfod/debuginfod.cxx
> +++ b/debuginfod/debuginfod.cxx
> @@ -3469,7 +3469,7 @@ database_stats_report()
>          throw sqlite_exception(rc, "step");
>  
>        obatched(clog)
> -        << right << setw(20) << ((const char*)
> sqlite3_column_text(ps_query, 0) ?: (const char*) "NULL")
> +        << setw(20) << ((const char*) sqlite3_column_text(ps_query, 0)
> ?: (const char*) "NULL")
>          << " "
>          << (sqlite3_column_text(ps_query, 1) ?: (const unsigned char*)
> "NULL")
>          << endl;
> 
> Makes everything PASS.
> 
> But I don't understand why. It might be a bug in gcc/libasan (this is
> gcc 8.3.0 Debian 10.11 - Buster). I can try upgrading the machine to
> Debian 11 - Bullseye this weekend to see if that helps.
> 
> Also, do we really want to right align the log here? We don't seem to
> align the log text anywhere else.
> 
> Cheers,
> 
> Mark

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: right, trying --enable-sanitizer-address on armv7l
  2021-12-09 14:23 right, trying --enable-sanitizer-address on armv7l Mark Wielaard
  2021-12-09 15:06 ` Mark Wielaard
@ 2021-12-09 15:47 ` Frank Ch. Eigler
  2021-12-09 17:04   ` Mark Wielaard
  1 sibling, 1 reply; 4+ messages in thread
From: Frank Ch. Eigler @ 2021-12-09 15:47 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: elfutils-devel

Hi -

> I was trying the new --enable-sanitizer-address on our armv7l buildbot
> worker and it almost works as is, except for...
> 
> debuginfod.cxx:3472:12: runtime error: reference binding to misaligned
> address 0x00561ec9 for type '<unknown>', which requires 2 byte
> alignment
> [...]
> But I don't understand why. It might be a bug in gcc/libasan (this is
> gcc 8.3.0 Debian 10.11 - Buster). [...]

It must be a bug in gcc/libasan or something.

> Also, do we really want to right align the log here? We don't seem to
> align the log text anywhere else.

This one just prettifies the messages because there is a sequence
metrics & values being printed at startup, so it makes the numbers
line up.  But no great loss to drop; we export those as prometheus
metrics too.

- FChE


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: right, trying --enable-sanitizer-address on armv7l
  2021-12-09 15:47 ` Frank Ch. Eigler
@ 2021-12-09 17:04   ` Mark Wielaard
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Wielaard @ 2021-12-09 17:04 UTC (permalink / raw)
  To: Frank Ch. Eigler; +Cc: elfutils-devel

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

Hi Frank,

On Thu, 2021-12-09 at 10:47 -0500, Frank Ch. Eigler via Elfutils-devel
wrote:
> > debuginfod.cxx:3472:12: runtime error: reference binding to
> > misaligned
> > address 0x00561ec9 for type '<unknown>', which requires 2 byte
> > alignment
> > [...]
> > But I don't understand why. It might be a bug in gcc/libasan (this
> > is
> > gcc 8.3.0 Debian 10.11 - Buster). [...]
> 
> It must be a bug in gcc/libasan or something.

Yeah, I'll try to see if an gcc upgrade on the machine will help (but
that has to wait a couple of days).

> > Also, do we really want to right align the log here? We don't seem
> > to
> > align the log text anywhere else.
> 
> This one just prettifies the messages because there is a sequence
> metrics & values being printed at startup, so it makes the numbers
> line up.  But no great loss to drop; we export those as prometheus
> metrics too.

I am not proud of needing this workaround, but I did push the attached.

Thanks,

Mark

[-- Attachment #2: 0001-debuginfod-Don-t-format-clog-using-right-or-setw-20.patch --]
[-- Type: text/x-patch, Size: 1732 bytes --]

From 7fc69582efcfb5f005f04c818a7aab76ff1090be Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Thu, 9 Dec 2021 18:00:05 +0100
Subject: [PATCH] debuginfod: Don't format clog using 'right' or 'setw(20)'.

Keep the logs just plain unformatted text.

This really is a workaround for an apparent bug with gcc 8.3
-fsanitizer=undefined on arm32, which complains about the
'right' formatter:

debuginfod.cxx:3472:12: runtime error: reference binding to
misaligned address 0x00561ec9 for type '<unknown>', which
requires 2 byte alignment

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 debuginfod/ChangeLog      | 5 +++++
 debuginfod/debuginfod.cxx | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog
index 7a4840ff..df373201 100644
--- a/debuginfod/ChangeLog
+++ b/debuginfod/ChangeLog
@@ -1,3 +1,8 @@
+2021-12-09  Mark Wielaard  <mark@klomp.org>
+
+	* debuginfod.cxx (database_stats_report): Don't format clog
+	using 'right' and 'setw(20)'.
+
 2021-12-04  Mark Wielaard  <mark@klomp.org>
 
 	* debuginfod.cxx (main): Call debuginfod_pool_groom before exit.
diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index 35424e47..887e4f5a 100644
--- a/debuginfod/debuginfod.cxx
+++ b/debuginfod/debuginfod.cxx
@@ -3469,7 +3469,7 @@ database_stats_report()
         throw sqlite_exception(rc, "step");
 
       obatched(clog)
-        << right << setw(20) << ((const char*) sqlite3_column_text(ps_query, 0) ?: (const char*) "NULL")
+        << ((const char*) sqlite3_column_text(ps_query, 0) ?: (const char*) "NULL")
         << " "
         << (sqlite3_column_text(ps_query, 1) ?: (const unsigned char*) "NULL")
         << endl;
-- 
2.18.4


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-12-09 17:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-09 14:23 right, trying --enable-sanitizer-address on armv7l Mark Wielaard
2021-12-09 15:06 ` Mark Wielaard
2021-12-09 15:47 ` Frank Ch. Eigler
2021-12-09 17:04   ` Mark Wielaard

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).