RFR: 8170812: Metaspace corruption caused by incorrect memory size for MethodCounters
Thomas Stüfe
thomas.stuefe at gmail.com
Thu Apr 6 09:05:29 UTC 2017
:(
Don't the other childs of MetaspaceObj
(e.g. Annotations, ConstMethod, MethodCounters) have the same problem?
..Thomas
On Wed, Apr 5, 2017 at 5:13 PM, Andrew Haley <aph at redhat.com> wrote:
> If sizeof (MethodCounters) is not a multiple of wordSize, memory
> allocator metadata is corrupted, causing the VM to become unstable and
> eventually crash.
>
> The fix is very simple:
>
> diff -r 85b6ca9458ed src/share/vm/oops/methodCounters.hpp
> --- a/src/share/vm/oops/methodCounters.hpp Wed Mar 29 15:44:34 2017
> +0000
> +++ b/src/share/vm/oops/methodCounters.hpp Wed Apr 05 15:42:18 2017
> +0100
> @@ -116,7 +116,7 @@
>
> AOT_ONLY(Method* method() const { return _method; })
>
> - static int size() { return sizeof(MethodCounters) / wordSize; }
> + static int size() { return align_size_up(sizeof(MethodCounters),
> wordSize) / wordSize; }
>
> bool is_klass() const { return false; }
>
> This is very low risk because if the size is already a multiple of
> wordSize, this patch will have no effect. If the size is not a
> multiple of wordSize, this patch will prevent an inevitable crash.
>
> I've applied for a JDK9 fix request. I'll need a sponsor.
>
> Andrew.
>
More information about the hotspot-dev
mailing list