From nobody Tue Oct 05 19:44:19 2021 X-Original-To: java@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 49CB89F443A for ; Tue, 5 Oct 2021 19:44:20 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HP7M81Tlkz4rTR for ; Tue, 5 Oct 2021 19:44:20 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1301412B97 for ; Tue, 5 Oct 2021 19:44:20 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 195JiJrL004688 for ; Tue, 5 Oct 2021 19:44:19 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 195JiJI3004687 for java@FreeBSD.org; Tue, 5 Oct 2021 19:44:19 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" From: bugzilla-noreply@freebsd.org To: java@FreeBSD.org Subject: maintainer-feedback requested: [Bug 258954] java/openjdk11 java/openjdk12 java/openjdk13: crashes when built with clang 13 Date: Tue, 05 Oct 2021 19:44:19 +0000 X-Bugzilla-Type: request X-Bugzilla-Product: Ports & Packages X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: java@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? Message-ID: In-Reply-To: References: X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Porting Java to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-java List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-java@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N Bugzilla Automation has asked freebsd-java (Nobody) for maintainer-feedback: Bug 258954: java/openjdk11 java/openjdk12 java/openjdk13: crashes when built with clang 13 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D258954 --- Description --- During an exp-run for llvm 13 (see bug 258209), it turned out that java/openjdk11 through openjdk13 fail to build with clang 13: =3D=3D=3D Output from failing command(s) repeated here =3D=3D=3D * For target jdk__packages_attribute.done: # # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=3D0x0000000802c8a991, pid=3D92123, tid=3D618713 # # JRE version: (11.0.12+7) (build ) # Java VM: OpenJDK 64-Bit Server VM (11.0.12+7-1, mixed mode, tiered, compressed oops, serial gc, bsd-amd64) # Problematic frame: # V [libjvm.so+0xe8a991] JVM_RaiseSignal+0x3bfbf1 # # Core dump will be written. Default location: /wrkdirs/usr/ports/java/openjdk11/work/jdk11u-jdk-11.0.12-7-1/make/java.core # # An error report file with more information is saved as: # /wrkdirs/usr/ports/java/openjdk11/work/jdk11u-jdk-11.0.12-7-1/make/hs_err_p= id92 123.log These crashes are all caused by the markOop/markOopDesc classes, which are = used to keep track of objects, and which are 'marked' using the low few bits. (S= ee https://github.com/openjdk/jdk13u/blob/master/src/hotspot/share/oops/markOo= p.hp p ). After some laborious bisecting, I found out that these crashes start occuri= ng after the upstream commit https://github.com /llvm/llvm-project/commit/16d03818412 (Return "[CGCall] Annotate this argum= ent with alignment"). What happens afterwards, is that clang considers the "this" pointer to alwa= ys be aligned to the alignment of the actual object, and then masking or addin= g a few low bits is not working as expected. The reason openjdk14 and higher work fine with clang 13, and don't crash similarly, is that the OpenJDK people completely redid the markOop/markOopD= esc classes in https://github.com/openjdk/jdk/commit/ae5615c6142a4dc0d9033462f4880d7b3c127= e26 ("8229258: Rework markOop and markOopDesc into a simpler mark word value carrier"). E.g, the markOopDesc class was renamed to markWord, and *stores*= a pointer-like value instead of *being* a pointer-like value. This is a much safer way of handling things. However, this upstream commit is *very* large, as are a few of its follow-u= ps, which is probably the reason why it has not been backported to JDKs <=3D 13= . I tried manually backporting it, but got lost in many nasty patch conflicts a= nd problems. I would like to solicit some opinions from our OpenJDK maintainers, on how = to move forward with this issue. I see a few ways: * Get someone well-versed in OpenJDK internals to backport '8229258: Rework markOop and markOopDesc' (this is a *lot* of tricky stuff, and has to be do= ne for at least 11, 12 and 13; but maybe earlier JDKs too). * Find some alternative way of simplifying the approach in '8229258: Rework markOop and markOopDesc', and backport that * Revert the upstream LLVM commit; I don't really like this because we would have to carry that patch forever (as LLVM upstream won't accept it obviousl= y) * Adjust the port Makefiles for openjdk11 though openjdk13 to use the clang= 12 port * ... something else?