VulpixelMC / YummyQuiltHacks

A series of yummy 😋 hacks and utilities for covering legitimate usecases in immoral ways
Mozilla Public License 2.0
6 stars 2 forks source link

Mod outright fails to run in varying ways outside of development enviroment #18

Open cocona20xx opened 1 year ago

cocona20xx commented 1 year ago

Tested on the 0.2.x branch in Prism Launcher. Depending on the loader version, the game crashes at launch in different ways: On loader 0.17.0 (the version yqh is currently built against):

Exception caught from launcher
java.lang.RuntimeException: Could not find game constructor in net.minecraft.client.main.Main!
    at org.quiltmc.loader.impl.game.minecraft.patch.EntrypointPatch.process(EntrypointPatch.java:146)
    at org.quiltmc.loader.impl.entrypoint.GameTransformer.locateEntrypoints(GameTransformer.java:90)
    at org.quiltmc.loader.impl.game.minecraft.MinecraftGameProvider.initialize(MinecraftGameProvider.java:311)
    at org.quiltmc.loader.impl.launch.knot.Knot.init(Knot.java:135)
    at org.quiltmc.loader.impl.launch.knot.Knot.launch(Knot.java:70)
    at org.quiltmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:24)
    at org.prismlauncher.launcher.impl.StandardLauncher.launch(StandardLauncher.java:88)
    at org.prismlauncher.EntryPoint.listen(EntryPoint.java:126)
    at org.prismlauncher.EntryPoint.main(EntryPoint.java:71)
Exiting with ERROR

Starting on 0.17.1, this happens:

Agent Attached
Exception caught from launcher
java.lang.ExceptionInInitializerError
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:467)
    at org.quiltmc.loader.impl.QuiltLoaderImpl.setupLanguageAdapters(QuiltLoaderImpl.java:480)
    at org.quiltmc.loader.impl.QuiltLoaderImpl.finishModLoading(QuiltLoaderImpl.java:355)
    at org.quiltmc.loader.impl.QuiltLoaderImpl.freeze(QuiltLoaderImpl.java:124)
    at org.quiltmc.loader.impl.launch.knot.Knot.init(Knot.java:142)
    at org.quiltmc.loader.impl.launch.knot.Knot.launch(Knot.java:70)
    at org.quiltmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:24)
    at org.prismlauncher.launcher.impl.StandardLauncher.launch(StandardLauncher.java:88)
    at org.prismlauncher.EntryPoint.listen(EntryPoint.java:126)
    at org.prismlauncher.EntryPoint.main(EntryPoint.java:71)
Caused by: java.lang.ClassNotFoundException: org.quiltmc.loader.impl.launch.knot.UnsafeKnotClassLoader
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
    at net.cursedmc.yqh.YummyQuiltHacks.<clinit>(YummyQuiltHacks.java:70)
    ... 11 more
Exiting with ERROR

The above occurs on all 0.17.x loader versions, seemingly.

Meanwhile, this happens on 0.18.8 (most recent stable loader version) and all other 0.18.x loader versions:

Error opening zip file or JAR manifest missing: /yummy_agent.jar
Exception caught from launcher
java.lang.ExceptionInInitializerError
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:467)
    at org.quiltmc.loader.impl.QuiltLoaderImpl.setupLanguageAdapters(QuiltLoaderImpl.java:1027)
    at org.quiltmc.loader.impl.QuiltLoaderImpl.finishModLoading(QuiltLoaderImpl.java:924)
    at org.quiltmc.loader.impl.QuiltLoaderImpl.freeze(QuiltLoaderImpl.java:170)
    at org.quiltmc.loader.impl.launch.knot.Knot.init(Knot.java:148)
    at org.quiltmc.loader.impl.launch.knot.Knot.launch(Knot.java:76)
    at org.quiltmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:28)
    at org.prismlauncher.launcher.impl.StandardLauncher.launch(StandardLauncher.java:88)
    at org.prismlauncher.EntryPoint.listen(EntryPoint.java:126)
    at org.prismlauncher.EntryPoint.main(EntryPoint.java:71)
Caused by: java.lang.IllegalStateException: Could not self-attach to current VM using external process
    at net.bytebuddy.agent.ByteBuddyAgent.installExternal(ByteBuddyAgent.java:701)
    at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:631)
    at net.bytebuddy.agent.ByteBuddyAgent.attach(ByteBuddyAgent.java:298)
    at net.bytebuddy.agent.ByteBuddyAgent.attach(ByteBuddyAgent.java:263)
    at net.bytebuddy.agent.ByteBuddyAgent.attach(ByteBuddyAgent.java:245)
    at net.cursedmc.yqh.YummyQuiltHacks.<clinit>(YummyQuiltHacks.java:67)
    ... 11 more
Exiting with ERROR

TL;DR doing crimes via self-attaching to the VM might not be doable anymore and probably didn't work in production to begin with??

sylv256 commented 1 year ago

What JVM do you use?

cocona20xx commented 1 year ago

Java 17

sylv256 commented 1 year ago

What type of JVM? Send your logs please

cocona20xx commented 1 year ago

Zulu JDK ARM64, one sec—will send the log from the 0.18.x loader crash

sylv256 commented 1 year ago

TL;DR doing crimes via self-attaching to the VM might not be doable anymore and probably didn't work in production to begin with??

It's necessary to attach to the VM in order to attach an instrumentation agent. Unfortunately, not all JVMs support this, and some will outright complain about illegal access (for "security reasons"). What we could do is put a warning in the console stating that limited YQH support is provided, and that any errors regarding instrumentation are due to an unsupported JVM.

cocona20xx commented 1 year ago

https://paste.ee/p/PrIIn

cocona20xx commented 1 year ago

(yes, this is all it gives us; the latest.log has even less detail)

sylv256 commented 1 year ago

I need the ones on 0.17.0 and 0.17.1 specifically. The 0.18.x loader issue is being fixed in #17.

cocona20xx commented 1 year ago

Is Adoptium known to not throw a fit due to illegal access? Could dl that to check if it works with that JDK

cocona20xx commented 1 year ago

I need the ones on 0.17.0 and 0.17.1 specifically. The 0.18.x loader issue is being fixed in #17.

ah, one second then

sylv256 commented 1 year ago

Yes, we* generally use Adoptium or Temurin. I'd just like to know if this can be mitigated somehow. Oracle OpenJDK is guaranteed to work (hence why this shouldn't be a problem for most users).

cocona20xx commented 1 year ago

https://paste.ee/p/sq8H5 and https://paste.ee/p/3jlN3 are the 0.17.0 and 0.17.1 logs respectively

cocona20xx commented 1 year ago

Still happens under Temurin in exactly the same way, fyi

sylv256 commented 1 year ago

I'll have to look into this either tomorrow or in a few days.