qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/1] Fix unaligned reads in the tcg/tci.c
@ 2018-01-27 13:49 Anatoly Trosinenko
  2018-01-27 13:49 ` [Qemu-devel] [PATCH 1/1] tci: eliminate UB due to unaligned reads Anatoly Trosinenko
  2018-02-05 13:52 ` [Qemu-devel] [PATCH 0/1] Fix unaligned reads in the tcg/tci.c Anatoly Trosinenko
  0 siblings, 2 replies; 14+ messages in thread
From: Anatoly Trosinenko @ 2018-01-27 13:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Weil, Anatoly Trosinenko

The code in tcg/tci.c reads some data from TCI bytecode through
pointer dereferencing. As far as I know unaligned reads in such a way are
undefined behavior and compiling with -fsanitize=undefined enumerated
them as such at run-time.

I have replaced such reads with invocations of ld{l,q}_he_p.
A comment in include/qemu/bswap.h:310 suggests they should be properly
translated by the compiler. I didn't added signed/unsigned casts
since bswap.h does contain separate signed/unsigned versions
for 16-bit integers but does not for 32- and 64-bit ones, so I supposed
the developers of the bswap.h already arranged everything so
integer promotions don't mess things up. I can add casts in case I'm
not right about it.

Anatoly Trosinenko (1):
  tci: eliminate UB due to unaligned reads

 tcg/tci.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

-- 
2.14.1

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

end of thread, other threads:[~2018-03-12 13:45 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-27 13:49 [Qemu-devel] [PATCH 0/1] Fix unaligned reads in the tcg/tci.c Anatoly Trosinenko
2018-01-27 13:49 ` [Qemu-devel] [PATCH 1/1] tci: eliminate UB due to unaligned reads Anatoly Trosinenko
2018-01-27 16:38   ` Stefan Weil
2018-01-28  6:42     ` Anatoly Trosinenko
2018-02-19 14:26       ` Anatoly Trosinenko
2018-03-03  8:54       ` Anatoly Trosinenko
2018-03-03 13:57         ` Richard Henderson
2018-03-03 14:07           ` Anatoly Trosinenko
2018-03-03 14:13             ` Richard Henderson
2018-03-03 14:59               ` Anatoly Trosinenko
2018-03-03 15:41             ` Stefan Weil
2018-03-03 16:01               ` Anatoly Trosinenko
2018-03-12 13:45               ` Richard Henderson
2018-02-05 13:52 ` [Qemu-devel] [PATCH 0/1] Fix unaligned reads in the tcg/tci.c Anatoly Trosinenko

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 NNTP newsgroup(s).