Skip to content

NDK obfuscation integration, correctness CI, and CI fixes - #1

Merged
quiaingmuarua merged 1 commit into
mainfrom
claude/agitated-brattain-a81427
Apr 21, 2026
Merged

NDK obfuscation integration, correctness CI, and CI fixes#1
quiaingmuarua merged 1 commit into
mainfrom
claude/agitated-brattain-a81427

Conversation

@quiaingmuarua

Copy link
Copy Markdown
Owner

Summary

  • NDK two-step IR pipeline: integrates Kotoamatsukami into Android NDK builds via NDK clang → .bc → host opt+plugin → obf.bc → NDK clang → .so, bypassing the ABI crash caused by PGO/BOLT differences between NDK's prebuilt clang-17 and any independently-built LLVM 17
  • Full 7-pass combo by default (54x IR bloat on RC4): split-basic-block → bogus-control-flow → substitution → flatten → add-junk-code → indirect-call → indirect-branch; tunable via -DKOTO_PASSES
  • Obfuscation correctness check in CI: compiles RC4 plain vs obfuscated, asserts identical output — catches any pass that breaks semantics
  • NDK smoke CI job: installs NDK 26, builds Kotoamatsukami.so, runs the pipeline, verifies JNI symbol is exported
  • Fix two pre-existing CI failures:
    • tests/run_koto_plugin_smoke.cmake / run_koto_opt_smoke.cmake were referenced but missing
    • libhello_pass_lib.so ASAN link error fixed with -shared-libasan -shared-libubsan
  • docs/ndk-obfuscation.md: pipeline diagram, pass benchmark table, per-pass explanations, customisation guide

Test plan

  • build-and-test — standard build + ctest (including new plugin_koto_* smoke tests)
  • build-and-test-sanitized — ASAN/UBSAN build (.so link error should now be resolved)
  • ndk-obfuscation-smoke — NDK 26 build + JNI symbol verification
  • Obfuscation correctness check step — RC4 output must match between plain and obfuscated

🤖 Generated with Claude Code

…link error

- tests/run_koto_plugin_smoke.cmake: new — drives plugin_koto_clang_smoke test
  (compiles example/test.c via clang -fpass-plugin=Kotoamatsukami)
- tests/run_koto_opt_smoke.cmake: new — drives plugin_koto_opt_flatten_smoke and
  plugin_koto_opt_substitution_smoke; copies per-test config to scratch dir so
  the plugin can find Kotoamatsukami.config via CWD lookup
- ci.yml: add -shared-libasan -shared-libubsan to CMAKE_SHARED_LINKER_FLAGS in
  the sanitized job; static ASAN runtime can't satisfy all symbols when linking
  a shared library — switching to the shared runtime resolves undefined refs to
  __asan_report_load* and __ubsan_handle_type_mismatch_v1

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@quiaingmuarua
quiaingmuarua merged commit 54adbfe into main Apr 21, 2026
1 of 3 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.

1 participant