[foreign-jextract] [Rev 03] RFR: 8239128: Macro defines constant pointers can crash VM via jextract API

Henry Jen henryjen at openjdk.java.net
Fri Feb 21 17:32:34 UTC 2020


> The fundamental issue of the crash is that clang cursor/type may no longer valid after reparse another macro, and with pointer type lazily resolve the pointee type, if the clang cursor/type no longer valid, access invalid memory cause the crash.
> 
> The other issue is the a macro pointer to a record type like struct/union can cause NPE, and that cause the macro to be ignored on generation without a warning.
> 
> The fix remove the laziness from Type API perspective, but leave that as an implementation detail, so implementation of Pointer type need to figure out how to do that safely internally.
> 
> Record type in macro are reduces to void, as currently the Declaration implementation is depending on clang as well, we cannot guarantee that works after reparse.

The pull request has been updated with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase.

-------------

Added commits:
 - 20169ca2: Clean up work-around for JDK-8239784
 - 9da21804: Merge branch 'foreign-jextract' of https://github.com/openjdk/panama-foreign into foreign-jextract
 - 55857784: Automatic merge of foreign-abi into foreign-jextract
 - cd2fed3a: Automatic merge of foreign-memaccess into foreign-abi
 - 8677a47f: Automatic merge of master into foreign-memaccess
 - 3a0d31d1: Automatic merge of jdk:master into master
 - 97647369: 8216975: Using ForceNUMA does not disable adaptive sizing with parallel gc
 - 5275d6e2: 8238947: tools/jpackage tests fail with old rpmbuild versions
 - ed94c0af: 8239537: cgroup MetricsTester testMemorySubsystem fails sometimes when testing memory.kmem.tcp.usage_in_bytes
 - da39778d: 8239566: gtest/GTestWrapper.java fails due to "libstlport.so.1: open failed: No such file or directory"
 - 35db3769: 8239503: FieldLayout/OldLayoutCheck.java fails due to "RuntimeException: Misplaced int field: expected 24 to equal 12"
 - fb37c546: 8238560: Cleanup and consolidate algorithms in the jdk.tls.legacyAlgorithms security property
 - f40220f5: 8238990: java/net/httpclient/HandshakeFailureTest.java failed against TLSv1.3 on Windows
 - 23458bf4: 8238355: Update Graal
 - 2d93a284: 8232622: Technical debt in BadAttributeValueExpException
 - b4ffe4d8: 8239461: Use jcod rather than jar files in runtime tests
 - 58a59103: 8239347: Refactor Symbol to make _length a standalone field again
 - 90ee2c3d: 8237192: Generate stripped/public pdbs on Windows for jdk images
 - c1f4ea5d: 8239450: Overhaul JVM feature handling in configure
 - 1643bc3d: 8239351: Give more meaningful InternalError messages in Deflater.c
 - 952f32e3: Added tag jdk-15+11 for changeset b2dd4028a6de
 - 39db83a9: 8239094: PKCS#9 ChallengePassword attribute does not allow for the UTF8String type
 - e028bb4f: 8239478: Make specification of SourceVersion.isName explicit for dotted names
 - 4def210a: 8231111: Cgroups v2: Rework Metrics in java.base so as to recognize unified hierarchy
 - 8827df9b: 8239014: -XX:-UseEmptySlotsInSupers sometime fails to reproduce the layout of the old code
 - 732a5757: 8239139: test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/libInheritedChannel.c does not compile with gcc 8.3.1
 - 9fdcdf4a: 8239243: Create index structures only if required
 - 7b24bd68: 8238356: CodeHeap::blob_count() overestimates the number of blobs
 - 16c75e67: 8239001: Hotspot build broken on linux-sparc after 8238281
 - fff8438a: 8239070: Memory leak when unsuccessfully mapping in archive regions
 - 6015cab7: 8239363: PPC64: Wrong code generation after JDK-8183574
 - 09f5194d: 8238953: tools/jpackage tests do not work on Ubuntu Linux
 - 7f3bbc3f: 8239333: test/jdk/security/infra/java/security/cert/CertPathValidator/certification/AmazonCA.java fails intermittent
 - d4a069b3: 8237450: JDK13 annotation processors not run when a supported annotation type specifies a module
 - 11386e7c: 8225128: Add exception for expiring DocuSign root to VerifyCACerts test
 - 56282f71: 8238969: Miscellaneous cleanup
 - 36cd7bdb: 8239378: Add Classpath Exception to license in source file
 - f3cd52e3: 8210977: jdk/jfr/event/oldobject/TestThreadLocalLeak.java fails to find ThreadLocalObject
 - 58a03600: 8239019: testmake fails with FATAL: VCS_TYPE is empty
 - a6dbc711: 8239026: Support non-maven artifacts by JibArtifactManager
 - bf6c14f0: 8187305: Add logging for shared library loads/unloads
 - cea8931a: 8167493: Test that JFR event can be retransformed by an agent
 - ccb5defd: 8237780: Shenandoah: More reliable nmethod verification
 - 0e49c498: 8239224: libproc_impl.c previous_thr may be used uninitialized warning
 - b6c1b49c: 8239350: Add tests for JFR class redefinition events
 - f75f78ae: 8239265: JFR: Test cleanup of jdk.jfr.api.consumer package
 - 6f6b4c0e: 8232686: Turn parallel gc develop tracing flags into unified logging
 - 28c63004: 8238999: Remove MemRegion custom new/delete operator overloads
 - 301a2e19: 8237480: Add micros for DatagramSocket send/receive
 - cb2eeb7d: 8239142: C2's UseUniqueSubclasses optimization is broken for array accesses
 - 4e430ffb: 8239264: Clearup the legacy ObjectIdentifier constructor from int array
 - 8aff5bda: 8163251: Hard coded loop limit prevents reading of smart card data greater than 8k
 - 5d9c59f2: 8238236: Add JFR class redefinition events
 - 74bee688: 8239069: C2: SIGSEGV in IdealGraphPrinter::walk_nodes due to C->root() being NULL
 - b369aefc: 8238765: PhaseCFG::schedule_pinned_nodes cannot handle precedence edges from unmatched CFG nodes correctly
 - cf4291db: 8239000: handle ContendedPaddingWidth in vm_version_ppc
 - 41d457a0: 8239081: Shenandoah: Consolidate C1 LRB and native barriers
 - eaff9918: 8239005: [TESTBUG] test/hotspot/jtreg/runtime/StackGuardPages/TestStackGuardPages.java: exeinvoke.c: must initialize static state before calling do_overflow()
 - 52d46c31: 8238691: C2: turn subtype check into macro node
 - e4b27a48: 8183574: Unify the is_power_of_2 functions
 - 248b6171: 8213185: Properly handle run-test-prebuilt -> test-prebuilt migration
 - 2f170732: 8237818: Typo in Unsafe: resposibility
 - 0249cadd: 8238534: Deep sign macOS bundles before bundle archive is being created
 - 3c7858c2: 8239110: Zero VM build fails after JDK-8203883
 - c4681a95: 8160818: GssKrb5Client violates RFC 4752
 - 71ed4f27: 8238959: Add missing classpath exception to FileAcess and ConstantLookup
 - 612342ba: 8239092: Provide explicit specification for getKind methods of javax.lang.model
 - 110ef6f2: 8238196: tests that use SA Attach should not be allowed to run against signed binaries on Mac OS X 10.14.5 and later
 - 8119f836: 8238758: [JVMCI] fix JVMCI jtreg events tests to work with GraalVM
 - 3bb62dc0: 8236759: ShouldNotReachHere in PhaseIdealLoop::verify_strip_mined_scheduling

Changes:
  - all: https://git.openjdk.java.net/panama-foreign/pull/21/files
  - new: https://git.openjdk.java.net/panama-foreign/pull/21/files/d0d924ab..20169ca2

Webrevs:
 - full: https://webrevs.openjdk.java.net/panama-foreign/21/webrev.03
 - incr: https://webrevs.openjdk.java.net/panama-foreign/21/webrev.02-03

  Stats: 27519 lines in 744 files changed: 19013 ins; 5339 del; 3167 mod
  Patch: https://git.openjdk.java.net/panama-foreign/pull/21.diff
  Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/21/head:pull/21

PR: https://git.openjdk.java.net/panama-foreign/pull/21


More information about the panama-dev mailing list