[Release/Showcase] Minimal LD_PRELOAD “observe‑only” interposer for your own .so — hook, log, plot (with CI)
作者分享了一个轻量级的LD_PRELOAD模板用于逆向工程工作流,该模板通过.so文件插入函数,记录参数、返回值和延迟到CSV,并自动生成直方图,支持GitHub Actions自动化构建和绘图,适用于快速动态探查函数行为和性能分析。 2025-8-22 02:43:12 Author: www.reddit.com(查看原文) 阅读量:22 收藏

I put together a tiny, observe‑only LD_PRELOAD template aimed at RE workflows. It interposes a function in a self‑owned .so, logs args/ret/latency to CSV, and auto‑plots a histogram in GitHub Actions. Useful as a lightweight dynamic probe before pulling out heavier tooling.

  • What you get

    • libhook.so that forwards via dlsym(RTLD_NEXT, ...)

    • Demo target libdemo.so and a small driver

    • hook.csv + latency.png (generated locally or in CI artifacts)

    • Clean Makefile and a CI pipeline: build → run with LD_PRELOAD → plot → upload

  • Quick start

  • git clone https://github.com/adilungo39/libdemo-instrumentation cd libdemo-instrumentation make && make run && make plot

  • Artifacts are also downloadable from the repo’s Actions tab (ci-artifacts).

  • How it works (core idea)

  • real_demo_add = (demo_add_fn)dlsym(RTLD_NEXT, "demo_add"); // take timestamps around the real call, then append a CSV line

  • The interposer uses constructor/destructor hooks for setup/teardown and logs: ts,a,b,r,ms.

  • Why RE folks might care

Feedback welcome: features you’d want for RE (symbol selection, demangling, GOT/PLT tricks, multi‑thread correlation, JSON lines, env‑driven filters). If useful, feel free to fork or open issues.

Flair suggestion: Tooling / PoC

  • Fast dynamic probe to sanity‑check call behavior and timing

  • Template for writing custom interposers, adding filters, thread IDs, JSON output, p95/p99, etc.

  • CI‑friendly: every push produces fresh logs and plots

  • Scope and limitations

    • Linux/glibc, gcc; intended for self‑owned code or permitted scenarios

    • Minimal example (single symbol, simple logging); not a general tracer


文章来源: https://www.reddit.com/r/ReverseEngineering/comments/1mwuwj3/releaseshowcase_minimal_ld_preload_observeonly/
如有侵权请联系:admin#unsafe.sh