[erlang-patches] fix 64-bit writes to 32-bit struct field in HiPE runtime

Björn Gustavsson bgustavsson@REDACTED
Thu Sep 30 15:00:19 CEST 2010


On Mon, Sep 27, 2010 at 7:21 PM, Mikael Pettersson <mikpe@REDACTED> wrote:
> In the HiPE part of the runtime system's Process struct
> there is a state field which is 32 bits wide even on 64-bit
> machines.
>
> There is a single instruction in the HiPE AMD64 runtime
> where this field is incorrectly written with a 64-bit store.
> Luckily the extraneous 32 bits are written as zeros to 4
> bytes of tail-padding at the end of the struct, so nothing
> should have broken because of this.
>
> The same bug exists in the HiPE PowerPC64 runtime (in
> development), but on the big-endian PPC64 the effect is
> to write the actual value to the tail-padding and zero
> to the struct field, which potentially breaks TRAPs from
> BIFs (depending on BIF arities and how many parameter
> registers the runtime has been configured to use).
>
> Thanks to Paul Guyot for noticing the oversized write on AMD64.

Thanks! Will include in pu.

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB


More information about the erlang-patches mailing list