Withdrawn: 8256732: Zero: broken +ZeroTLAB exposes badly initialized memory
Aleksey Shipilev
shade at openjdk.java.net
Tue Jan 19 05:35:38 UTC 2021
On Fri, 20 Nov 2020 10:07:39 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
> Looks like memory is badly initialized when `-XX:+ZeroTLAB` is specified.
>
> Manifests like this:
>
> $ CONF=linux-x86_64-zero-fastdebug make exploded-test TEST=compiler/memoryinitialization/ZeroTLABTest.java
>
> command: main -Xcomp -XX:+UseTLAB -XX:+ZeroTLAB compiler.memoryinitialization.ZeroTLABTest
> reason: User specified action: run main/othervm -Xcomp -XX:+UseTLAB -XX:+ZeroTLAB compiler.memoryinitialization.ZeroTLABTest
> Mode: othervm [/othervm specified]
> elapsed time (seconds): 0.098
> configuration:
> STDOUT:
> Error occurred during initialization of VM
> java.lang.NullPointerException
> at java.lang.System.getProperty(java.base/System.java:836)
>
> The cause is simple: Zero calls `ThreadLocalAllocBuffer::allocate`:
>
> if (UseTLAB) {
> result = (oop) THREAD->tlab().allocate(obj_size);
> }
>
> ...which actually says:
>
> // Allocate size HeapWords. The memory is NOT initialized to zero.
> inline HeapWord* allocate(size_t size);
> So if we do `+ZeroTLAB`, then Zero skips zeroing the object body, and gets bad uninitialized memory for non-zeroed TLAB. Since `ZeroTLAB` is "false" by default, I believe just doing the object body initialization unconditionally is fine.
This pull request has been closed without being integrated.
-------------
PR: https://git.openjdk.java.net/jdk/pull/1343
More information about the hotspot-runtime-dev
mailing list