qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/1] tci: eliminate UB due to unaligned reads


From: Anatoly Trosinenko
Subject: Re: [Qemu-devel] [PATCH 1/1] tci: eliminate UB due to unaligned reads
Date: Sun, 28 Jan 2018 09:42:22 +0300

My patch is kind of trivial quick fix that just eliminates these unaligned
reads and doesn't seem to require complicated testing supposing my code
properly handles integer promotion (and hope it will not slow the
interpreter down).

Aligning everything, on the other hand, can not only remove the UB but also
speed things up, but if I get it right, requires O(opcode count) manual
work and subsequent less trivial testing that every opcode's argument
layout match on generation and interpretation side (errors should be
significantly localized due to present assertion on operation size,
though). So my patch may be considered as temporary solution.

In fact, I had to similarly make these unaligned reads explicit when
porting QEMU to JavaScript because Emscripten hugely relies on absence of
some kinds of UB such as "implicit" unaligned accesses, and such fix seemed
to resolve this issue for me on "host with special alignment requirement".


2018-01-27 19:38 GMT+03:00 Stefan Weil <address@hidden>:

> Am 27.01.2018 um 14:49 schrieb Anatoly Trosinenko:
> > Use ldl_he_p / ldq_he_p functions instead of a plain memory access
> > through pointer.
> >
> > Signed-off-by: Anatoly Trosinenko <address@hidden>
> > ---
> >  tcg/tci.c | 16 +++++++++++-----
> >  1 file changed, 11 insertions(+), 5 deletions(-)
>
> A better alternative might be aligning the relevant data when generating
> the bytecode. See also my comment on alignment in tcg/tci/README.
>
> Stefan
>
>


-- 
С уважением,
Анатолий Тросиненко
e-mail: address@hidden


reply via email to

[Prev in Thread] Current Thread [Next in Thread]