Skip to content

v0.0.8

Latest

Choose a tag to compare

@nightshift-labs-ai nightshift-labs-ai released this 19 Nov 00:00

In short

  • Static keys get a class (hardening, feature, tracepoint or debug, read from the binary): List static-key sites has a Class column with hardening and feature keys first, Annotate's summary names the hardening keys and their build default (cr_pinning off (on in this file) on the MemLens demo kernel, a memory image), and --list jump --class <class> keeps one class.
  • More dynamic-debug sites read as pr_debug file:line "format" instead of descriptor.13+0x28: on the MemLens demo kernel 2,198 pr_debug sites (was 1,941).
  • The decompile check's wait can be cancelled: the comments and references stay and the summary says how to run the check later. Tested only with fake ida_* modules; not yet run in IDA.

Details

  • Decompile check (menu): you can cancel its wait for IDA to analyse the new references. Prompted by a judge-style review: the wait has no time limit, so on a whole vmlinux it can be long, and it had no Cancel button. The wait has a box of its own with a Cancel button; writing the comments and references, decompiling again and counting for the summary keep their boxes without one. On Cancel (ida_auto.auto_wait() returns false, as its IDA 9.1-9.5 stubs document) the second decompile pass is skipped, the comments and references Annotate wrote stay, and the summary window still opens, with decompile check cancelled: IDA goes on analysing; when it has finished, Remove annotations and Annotate again to run the check. The WARN fall-through waits keep no Cancel button: they read the reanalysed sites right after each wait. Tested only with fake ida_* modules (an auto_wait() that returns false); not yet run in IDA. tests/check_ida_api.py also checks the wait-box and auto_wait() documentation it relies on (replace_wait_box is no longer used).

  • Static keys get a class: hardening (a fixed list of 11 key names such as init_on_alloc, randomize_kstack_offset, cr_pinning, switch_mm_cond_ibpb, arm64's dynamic_scs_enabled), feature, tracepoint or debug (dynamic debug), all read from the binary. kflow: List static-key sites has a Class column and lists hardening and feature keys first; Annotate's summary window has one line with the hardening keys and their build default, only when there are any (at most 3 names, keys whose state in the file differs from the default picked first, then +N more); the command line prints the sites per class and the defaults, and --list jump --class <class> keeps one class (or says that it has no sites, or that the __jump_table was not found or not decoded); --json static-key records, also the headless runner's, have a class field. The build default is bit 0 (JUMP_TYPE_TRUE) of the key's struct static_key type word, not likely/unlikely (switch_mm_cond_ibpb is tested with static_branch_likely but is off by default); where the key's state in the file differs (a memory image), the line says so: cr_pinning off (on in this file) on the MemLens demo kernel (the window in the fake-IDA test: init_on_alloc on, randomize_kstack_offset on, cr_pinning off (on in this file), +7 more); bypass_usercopy_checks adds (checks on) / (checks off). python3 -m kflow <file>, re-run on this branch: MemLens demo kernel hardening 82, feature 5,229, tracepoint 1,728, debug 2,198 sites, init_on_alloc and randomize_kstack_offset on, the other 8 off; GKI 6.1 hardening 40, feature 7,906, tracepoint 2,683, debug 0, init_on_alloc on, init_on_free and randomize_kstack_offset off, as its embedded config says; try module dm-mod.ko feature 12, tracepoint 3, debug 7. In IDA a key in a SEG_BSS segment is off; the new IDA calls are covered by tests/check_ida_api.py and tests/check_ida_names.py (IDA 9.1-9.4 stubs). README: one sentence on the chooser line (1,906 -> 1,943 words, wc -w).

  • Dynamic-debug keys of pr_debug_ratelimited, dev_dbg_ratelimited and net_dbg_ratelimited (a struct _ddebug called descriptor.N) and _ddebug records without a symbol of their own now read pr_debug file:line "format" like the others, instead of descriptor.13+0x28 or __UNIQUE_ID_ddebug514+0x60 (the struct must read as one: a source-file name and a line). python3 -m kflow <file>, re-run: try module dm-mod.ko 5 of its 22 keys (pr_debug sites 2 -> 7, symbol+offset 5 -> 0); MemLens demo kernel pr_debug sites 1,941 -> 2,198 (68 descriptor* and 189 unnamed records), symbol+offset 439 -> 182, so the debug class is 257 sites larger than the 1,941 the summary used to print; Ubuntu 6.8 amd64 3,313 -> 3,382; GKI 6.1 has none.

  • Current totals in docs/VERIFICATION.md: 235 checks (tests/check_ida_api.py, IDA stubs 0.0.11; v0.0.7 said 232) and 96 ida_* names.

Built by an AI agent (Claude, operated by Nightshift Labs). Not yet run in real IDA.