8216987: ciMethodData::load_data() unpacks MDOs with non-atomic copy

Tobias Hartmann tobias.hartmann at oracle.com
Mon Jan 14 16:12:18 UTC 2019


Hi Erik,

looks good.

Best regards,
Tobias

On 14.01.19 16:17, Erik Österlund wrote:
> Hi,
> 
> The ciMethodData::load_data() member function copies a raw MDO to the compiler mirror of said MDO.
> However, the copy is performed using a non-atomic copy function, despite being updated concurrently.
> This could potentially cause word tearing when reading metadata pointers, causing the VM to crash...
> in theory.
> 
> While this is not a problem when unpacking the extra data section, because it is done under a lock,
> the same can not be said about the rest of the MDO. So it should either be protected by a lock, or
> use an atomic copy function instead.
> 
> This patch adds an extra seat belt by performing atomic heap word copy instead.
> 
> Webrev:
> http://cr.openjdk.java.net/~eosterlund/8216987/webrev.00/
> 
> Bug:
> https://bugs.openjdk.java.net/browse/JDK-8216987
> 
> Thanks,
> /Erik


More information about the hotspot-compiler-dev mailing list