Skip to content

fix(incision): repair target scanning and shared JVMTI - #730

Merged
Micalhl merged 1 commit into
TabooLib:dev/6.3.0from
FxRayHughes:fix/incision-shared-jvmti
Aug 22, 2026
Merged

fix(incision): repair target scanning and shared JVMTI#730
Micalhl merged 1 commit into
TabooLib:dev/6.3.0from
FxRayHughes:fix/incision-shared-jvmti

Conversation

@FxRayHughes

@FxRayHughes FxRayHughes commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

概要

本 PR 一并修复 Incision API v2 重构后暴露的两个独立运行时问题:

  1. 目标类扫描与安装状态错误:已加载目标和未来加载目标没有通过同一 JVM 级 native 视图判断,可能让 NMS 注入停留在错误的 PENDING_LOAD/UNAVAILABLE 状态,表现为 EnchantmentMenu.slotsChanged 等切术已注册但没有运行日志。
  2. 多插件 JVMTI native 无法共享:首个隔离插件加载 DLL 后,第二个插件再次 System.load 会触发 already loaded in another classloader;即使复用 native,多个插件的 transformer/native accessor 也必须按顺序共享,不能只执行 owner 或互相覆盖。

Bug 1:目标类扫描与 PENDING_LOAD

  • loaded-class count、retransform、defineClass、原始字节缓存与 accessor 统一通过 canonical native owner 查询
  • isClassLoaded 输出实际 JVMTI 匹配数量,避免静默误判
  • transformer 在 loaded-check 前注册:未来首次加载由 ClassFileLoadHook 捕获,已加载类同步 retransform
  • token 移除时清理空 transformer 索引
  • 新增 Backend 安装生命周期测试

真实回归同时覆盖:

  • Leaf 26.2 EnchantmentMenu.slotsChanged(Container) 的旧单行 Scope 注入
  • 启动时保持未加载的 PendingLoadTarget,验证 PENDING_LOAD → ClassFileLoadHook → weave

Bug 2:多插件 native 共享

  • bootstrap IncisionBridge 持有 JVM 级唯一 native owner
  • 后加载插件注册 native delegate,不再重复加载 DLL
  • ClassFileLoadHook 按 delegate 注册顺序串联字节码,两个插件的 advice 先后执行而非覆盖
  • 非 owner 插件的 native 操作通过受限协议代理给 owner
  • 插件卸载只移除自身 delegate,最后一个 lease 释放时才调用 nDispose
  • 新增 native owner/delegate 串联单元测试

验证

  • :module:incision:test 通过
  • Leaf 26.2 / Java 25 / 强制 JVMTI / 双 Incision 插件:375 pass / 0 fail / 1 not-applicable
  • backend-jvmti-pending-nms:PASS
  • backend-jvmti-pending-fixture:PASS
  • bridge-peer-dual-dispatch:PASS
  • bridge-peer-disable-isolation:PASS
  • 日志无 already loaded in another classloaderdispatch unavailable、未回滚的 RetransformClasses failure

对应真实服务端测试插件与脚本已提交到 FxRayHughes/Incision-Test@74fba53

Route loaded-class scans and native operations through the canonical owner, then chain every plugin transformer through the bootstrap bridge.
@FxRayHughes
FxRayHughes force-pushed the fix/incision-shared-jvmti branch from e223440 to cc64ef3 Compare August 22, 2026 04:10
@FxRayHughes FxRayHughes changed the title fix(incision): share JVMTI backend across plugins fix(incision): repair target scanning and shared JVMTI Aug 22, 2026
@Micalhl
Micalhl merged commit dd3e6ae into TabooLib:dev/6.3.0 Aug 22, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants