Skip to content

Commit d4915b7

Browse files
committed
components: rename kebab-cased to snake_case
Component names were split 55 snake_case / 31 kebab-case / 1 mixed (dmesg_kaslr-disabled), visible in -v output, -s glob patterns, install paths, and docs. Standardise on the majority convention.
1 parent 68b9224 commit d4915b7

61 files changed

Lines changed: 102 additions & 98 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -389,11 +389,11 @@ because they have different implications for the inference engine:
389389
#### Disabled — `SF_KASLR_DISABLED`
390390

391391
A handful of components detect a definitive opt-out and emit the scalar
392-
fact `SF_KASLR_DISABLED` via `kasld_emit_scalar()`proc-cmdline (the
393-
`nokaslr` boot flag), boot-config / proc-config (no
394-
`CONFIG_RANDOMIZE_BASE`), dmesg_kaslr-disabled (the cmdline /
392+
fact `SF_KASLR_DISABLED` via `kasld_emit_scalar()`proc_cmdline (the
393+
`nokaslr` boot flag), boot_config / proc_config (no
394+
`CONFIG_RANDOMIZE_BASE`), dmesg_kaslr_disabled (the cmdline /
395395
hibernation / loongarch "KASLR disabled" / "KASLR is disabled" lines),
396-
hibernation_nokaslr (LoongArch hibernation override), riscv64-no-seed
396+
hibernation_nokaslr (LoongArch hibernation override), riscv64_no_seed
397397
(FDT without `/chosen/kaslr-seed`), loongarch_kexec_file_nokaslr
398398
(`kexec_file` token), s390_kdump_nokaslr (`elfcorehdr=` kdump handoff).
399399
The orchestrator reads the scalar to set the summary's `kaslr.disabled`
@@ -422,7 +422,7 @@ memory"). The kernel was still relocated by the boot stub to a
422422
firmware-/boot-stub-deterministic position — *not* the link-time
423423
default — so this signal MUST NOT be fed to `kaslr_disabled_pin`.
424424

425-
The dmesg_kaslr-disabled component distinguishes the two by inspecting
425+
The dmesg_kaslr_disabled component distinguishes the two by inspecting
426426
the exact reason string in the kernel's "KASLR disabled" line and emits
427427
the appropriate fact. The summary flag `kaslr.disabled` stays *false*
428428
in this state: the engine has not pinned the kernel to a known address,

Makefile

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ SRC_DIR := ./src
9797
HDRS := $(wildcard $(SRC_DIR)/include/*.h $(SRC_DIR)/include/kasld/*.h \
9898
$(SRC_DIR)/include/kasld/arch/*.h)
9999

100-
# Detect zlib (optional, for native gzip decompression in proc-config)
100+
# Detect zlib (optional, for native gzip decompression in proc_config)
101101
HAVE_ZLIB := $(shell echo 'int main(void){return 0;}' | $(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) -xc - -lz -o /dev/null 2>/dev/null && echo 1)
102102

103103
# Detect pthread (optional, for parallel inference worker pool in orchestrator)
@@ -146,7 +146,8 @@ SRC_FILES := $(wildcard $(COMP_SRC_DIR)/*.c)
146146
BIN_FILES := $(patsubst $(COMP_SRC_DIR)/%.c,$(COMP_DIR)/%,$(SRC_FILES))
147147

148148
# cc-component <cmd...>: run the compiler. Three outcomes:
149-
# - Success: silent (same as today's `-cc ...` line).
149+
# - Success: print `[built] <component>` so per-arch builds (especially
150+
# `make cross`) make visible which components landed on this arch.
150151
# - Failure caused ONLY by the arch-gate `#error "Architecture is not
151152
# supported"` (and nothing else): print a single
152153
# `[skip] <component> (architecture-gated)` line. The build of *this*
@@ -158,9 +159,11 @@ BIN_FILES := $(patsubst $(COMP_SRC_DIR)/%.c,$(COMP_DIR)/%,$(SRC_FILES))
158159
# semantic).
159160
define cc-component
160161
@out=$$($(1) 2>&1); st=$$?; \
161-
if [ $$st -ne 0 ] && \
162-
echo "$$out" | grep -q '#error.*Architecture is not supported'; then \
163-
echo "[skip] $(notdir $@) (architecture-gated)"; \
162+
if [ $$st -eq 0 ]; then \
163+
echo "[built] $(notdir $@)"; \
164+
if [ -n "$$out" ]; then printf '%s\n' "$$out" >&2; fi; \
165+
elif echo "$$out" | grep -q '#error.*Architecture is not supported'; then \
166+
echo "[skip] $(notdir $@) (architecture-gated)"; \
164167
elif [ -n "$$out" ]; then \
165168
printf '%s\n' "$$out" >&2; \
166169
fi
@@ -187,9 +190,9 @@ check-headers: | $(COMP_DIR)
187190
$(COMP_DIR)/%: $(COMP_SRC_DIR)/%.c $(HDRS) | $(COMP_DIR)
188191
$(call cc-component, $(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) -I$(SRC_DIR) $< -o $@)
189192

190-
# proc-config: link with zlib when available for native gzip decompression
193+
# proc_config: link with zlib when available for native gzip decompression
191194
ifeq ($(HAVE_ZLIB),1)
192-
$(COMP_DIR)/proc-config: $(COMP_SRC_DIR)/proc-config.c $(HDRS) | $(COMP_DIR)
195+
$(COMP_DIR)/proc_config: $(COMP_SRC_DIR)/proc_config.c $(HDRS) | $(COMP_DIR)
193196
$(call cc-component, $(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) -I$(SRC_DIR) -DHAVE_ZLIB $< -lz -o $@)
194197
endif
195198

docs/bypass-techniques.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ The following KASLD components read from `dmesg` and `/var/log/dmesg`:
5858
* [dmesg_fake_numa_init.c](../src/components/dmesg_fake_numa_init.c)
5959
* [dmesg_free_area_init_node.c](../src/components/dmesg_free_area_init_node.c)
6060
* [dmesg_free_reserved_area.c](../src/components/dmesg_free_reserved_area.c)
61-
* [dmesg_kaslr-disabled.c](../src/components/dmesg_kaslr-disabled.c)
61+
* [dmesg_kaslr_disabled.c](../src/components/dmesg_kaslr_disabled.c)
6262
* [dmesg_last_pfn.c](../src/components/dmesg_last_pfn.c)
6363
* [dmesg_mem_init_kernel_layout.c](../src/components/dmesg_mem_init_kernel_layout.c)
6464
* [dmesg_mmu_idmap.c](../src/components/dmesg_mmu_idmap.c)
@@ -131,12 +131,12 @@ these files are readable by unprivileged users by default.
131131

132132
The following KASLD components read from `/proc`:
133133

134-
* [proc-kallsyms.c](../src/components/proc-kallsyms.c) — kernel symbol addresses from `/proc/kallsyms`
135-
* [proc-modules.c](../src/components/proc-modules.c) — loaded module addresses from `/proc/modules`
136-
* [proc-zoneinfo.c](../src/components/proc-zoneinfo.c) — memory zone boundaries from `/proc/zoneinfo`
137-
* [proc-cpuinfo.c](../src/components/proc-cpuinfo.c) — CPU information from `/proc/cpuinfo`
138-
* [proc-pid-syscall.c](../src/components/proc-pid-syscall.c) — kernel stack pointer from `/proc/<pid>/syscall`
139-
* [proc-stat-wchan.c](../src/components/proc-stat-wchan.c) — wait channel address from `/proc/<pid>/stat`
134+
* [proc_kallsyms.c](../src/components/proc_kallsyms.c) — kernel symbol addresses from `/proc/kallsyms`
135+
* [proc_modules.c](../src/components/proc_modules.c) — loaded module addresses from `/proc/modules`
136+
* [proc_zoneinfo.c](../src/components/proc_zoneinfo.c) — memory zone boundaries from `/proc/zoneinfo`
137+
* [proc_cpuinfo.c](../src/components/proc_cpuinfo.c) — CPU information from `/proc/cpuinfo`
138+
* [proc_pid_syscall.c](../src/components/proc_pid_syscall.c) — kernel stack pointer from `/proc/<pid>/syscall`
139+
* [proc_stat_wchan.c](../src/components/proc_stat_wchan.c) — wait channel address from `/proc/<pid>/stat`
140140
* [proc_timer_list.c](../src/components/proc_timer_list.c) — per-CPU timer base addresses from `/proc/timer_list`
141141

142142
The following KASLD components read from `/sys`:
@@ -154,9 +154,9 @@ The following KASLD components read from `/sys`:
154154
* [sysfs_firmware_memmap.c](../src/components/sysfs_firmware_memmap.c) — firmware memory map from `/sys/firmware/memmap/`
155155
* [sysfs_iommu_reserved_regions.c](../src/components/sysfs_iommu_reserved_regions.c) — physical DRAM addresses of IOMMU reserved regions from `/sys/kernel/iommu_groups/*/reserved_regions`
156156
* [sysfs_iscsi_transport_handle.c](../src/components/sysfs_iscsi_transport_handle.c) — iSCSI transport handle from `/sys/class/iscsi_transport/`
157-
* [sysfs-kernel-notes-xen.c](../src/components/sysfs-kernel-notes-xen.c) — Xen notes from `/sys/kernel/notes`
157+
* [sysfs_kernel_notes_xen.c](../src/components/sysfs_kernel_notes_xen.c) — Xen notes from `/sys/kernel/notes`
158158
* [sysfs_memory_blocks.c](../src/components/sysfs_memory_blocks.c) — memory block addresses from `/sys/devices/system/memory/`
159-
* [sysfs-module-sections.c](../src/components/sysfs-module-sections.c) — module section addresses from `/sys/module/*/sections/`
159+
* [sysfs_module_sections.c](../src/components/sysfs_module_sections.c) — module section addresses from `/sys/module/*/sections/`
160160
* [sysfs_nd_region.c](../src/components/sysfs_nd_region.c) — NVDIMM/PMem region physical start addresses from `/sys/bus/nd/devices/region*/`
161161
* [sysfs_nf_conntrack.c](../src/components/sysfs_nf_conntrack.c) — netfilter conntrack hash from `/sys/module/nf_conntrack/`
162162
* [sysfs_pci_resource.c](../src/components/sysfs_pci_resource.c) — PCI BAR addresses from `/sys/bus/pci/devices/`
@@ -174,9 +174,9 @@ enabled, the `PAGE_OFFSET` (vmsplit), and other layout-relevant settings.
174174

175175
The following KASLD components read boot configuration:
176176

177-
* [boot-config.c](../src/components/boot-config.c) — reads `/boot/config-*` for `CONFIG_RELOCATABLE`, `CONFIG_RANDOMIZE_BASE`, and `CONFIG_PAGE_OFFSET`
178-
* [proc-config.c](../src/components/proc-config.c) — reads `/proc/config.gz` for the same configuration options
179-
* [proc-cmdline.c](../src/components/proc-cmdline.c) — reads `/proc/cmdline` to check for `nokaslr`
177+
* [boot_config.c](../src/components/boot_config.c) — reads `/boot/config-*` for `CONFIG_RELOCATABLE`, `CONFIG_RANDOMIZE_BASE`, and `CONFIG_PAGE_OFFSET`
178+
* [proc_config.c](../src/components/proc_config.c) — reads `/proc/config.gz` for the same configuration options
179+
* [proc_cmdline.c](../src/components/proc_cmdline.c) — reads `/proc/cmdline` to check for `nokaslr`
180180
* [hibernation_nokaslr.c](../src/components/hibernation_nokaslr.c) — checks whether hibernation resume has disabled KASLR
181181

182182
## Side-channels
@@ -303,7 +303,7 @@ The following KASLD components exploit syscall and interface leaks:
303303
* [mincore.c](../src/components/mincore.c)`mincore()` heap page disclosure via uninitialized memory (CVE-2017-16994; patched in v4.15)
304304
* [bcm_msg_head_struct.c](../src/components/bcm_msg_head_struct.c) — CAN BCM `bcm_msg_head` struct uninitialized 4-byte padding hole leaks kernel stack pointer via `recvmsg()` (CVE-2021-34693; patched in v5.12)
305305
* [pppd_kallsyms.c](../src/components/pppd_kallsyms.c) — set-uid-root `pppd` opens `/proc/kallsyms` as root, bypassing the `kptr_restrict` open-time check in pre-v4.8 kernels
306-
* [qemu-tcg-iret.c](../src/components/qemu-tcg-iret.c) — QEMU TCG `iret` emulation bug causes the hypervisor to read from the host kernel stack instead of the guest user stack, leaking a kernel address (patched in QEMU 9.1; not a kernel bug)
306+
* [qemu_tcg_iret.c](../src/components/qemu_tcg_iret.c) — QEMU TCG `iret` emulation bug causes the hypervisor to read from the host kernel stack instead of the guest user stack, leaking a kernel address (patched in QEMU 9.1; not a kernel bug)
307307

308308
## ioctl leaks
309309

@@ -371,7 +371,7 @@ space directly, without reading any files or exploiting vulnerabilities.
371371

372372
The following KASLD components use brute-force probing:
373373

374-
* [mmap-brute-vmsplit.c](../src/components/mmap-brute-vmsplit.c) — determines `PAGE_OFFSET` (vmsplit) on 32-bit systems by mapping pages across the address space until failure
374+
* [mmap_brute_vmsplit.c](../src/components/mmap_brute_vmsplit.c) — determines `PAGE_OFFSET` (vmsplit) on 32-bit systems by mapping pages across the address space until failure
375375

376376
## Weak entropy
377377

@@ -421,7 +421,7 @@ This state is materially different from a deliberate opt-out
421421
not from compile-time information.
422422

423423
KASLD emits a distinct scalar fact for each. The
424-
`dmesg_kaslr-disabled` component classifies each `KASLR disabled` line
424+
`dmesg_kaslr_disabled` component classifies each `KASLR disabled` line
425425
by its reason and emits `SF_KASLR_DISABLED` (opt-out) or
426426
`SF_KASLR_RANDOMIZATION_FAILED` (machinery failed). Only the former
427427
drives the engine's `kaslr_disabled_pin` rule. See

docs/kaslr.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ and memory layout interpretation depend on knowing the correct vmsplit.
300300
Since KASLD is typically compiled on one system and deployed to another,
301301
the compile-time `PAGE_OFFSET` assumption may not match the target system.
302302
KASLD handles this at runtime: components that detect the actual `PAGE_OFFSET`
303-
(e.g. `mmap-brute-vmsplit`, `boot-config`) emit a `pageoffset` tagged result,
303+
(e.g. `mmap_brute_vmsplit`, `boot_config`) emit a `pageoffset` tagged result,
304304
and the orchestrator automatically adjusts all layout boundaries before
305305
performing validation and analysis.
306306

docs/usage.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ Readable debugfs: no
137137
Readable /boot/System.map: yes
138138
Readable /boot/config: yes
139139
140-
--- boot-config ---
140+
--- boot_config ---
141141
[.] checking for CONFIG_VMSPLIT_1G...
142142
[.] checking for CONFIG_VMSPLIT_2G...
143143
[.] checking for CONFIG_VMSPLIT_2G_OPT...
@@ -149,7 +149,7 @@ S physical_start conf=parsed value=0x1000000
149149
S kernel_align conf=parsed value=0x200000
150150
[.] checking for CONFIG_RANDOMIZE_BASE...
151151
152-
--- boot-params-facts ---
152+
--- boot_params_facts ---
153153
S init_size conf=parsed value=0x37ed000
154154
S kernel_align conf=parsed value=0x200000
155155
@@ -167,24 +167,24 @@ leaked initrd physical start: 0x000000003173d000
167167
leaked initrd physical end: 0x0000000034b95ea8
168168
P initrd pos=base conf=parsed lo=0x3173d000 hi=0x34b95ea8
169169
170-
--- bootconfig-facts ---
170+
--- bootconfig_facts ---
171171
172-
--- cmdline-hugepages ---
172+
--- cmdline_hugepages ---
173173
[-] no `hugepages=` on /proc/cmdline
174174
175-
--- cmdline-mem ---
175+
--- cmdline_mem ---
176176
[-] no `mem=` token on /proc/cmdline
177177
178-
--- cmdline-memmap ---
178+
--- cmdline_memmap ---
179179
[-] no avoidance `memmap=` reservations on cmdline
180180
181-
--- cmdline-region ---
181+
--- cmdline_region ---
182182
P cmdline pos=base conf=parsed lo=0x8f000 hi=0x8f7fe
183183
184-
--- cpuinfo-facts ---
184+
--- cpuinfo_facts ---
185185
S phys_addr_bits conf=parsed value=0x2d
186186
187-
--- devicetree-facts ---
187+
--- devicetree_facts ---
188188
189189
--- dmesg_acpi_dynamic_ssdt ---
190190
[.] searching dmesg for ACPI dynamic OEM table loads ...
@@ -271,7 +271,7 @@ S phys_addr_bits conf=parsed value=0x2d
271271
[-] fopen(/var/log/dmesg): No such file or directory
272272
[-] dmesg: access denied (klogctl and /var/log/dmesg both inaccessible)
273273
274-
--- dmesg_kaslr-disabled ---
274+
--- dmesg_kaslr_disabled ---
275275
[.] searching dmesg for 'KASLR disabled' or 'KASLR is disabled' ...
276276
[-] klogctl(SYSLOG_ACTION_SIZE_BUFFER): Operation not permitted
277277
[-] fopen(/var/log/dmesg): No such file or directory
@@ -321,10 +321,10 @@ S phys_addr_bits conf=parsed value=0x2d
321321
[-] fopen(/var/log/dmesg): No such file or directory
322322
[-] dmesg: access denied (klogctl and /var/log/dmesg both inaccessible)
323323
324-
--- efi-present ---
324+
--- efi_present ---
325325
S efi_present conf=parsed value=0x0
326326
327-
--- fdt-facts ---
327+
--- fdt_facts ---
328328
329329
--- firmware_memmap ---
330330
P ram pos=base conf=parsed lo=0x100000 hi=0x7fedffff
@@ -333,7 +333,7 @@ P ram pos=base conf=parsed lo=0x0 hi=0x9e7ff
333333
334334
--- hibernation_nokaslr ---
335335
336-
--- kernel-image-facts ---
336+
--- kernel_image_facts ---
337337
S image_size conf=parsed value=0x2861320
338338
339339
--- kernel_notes_buildid ---
@@ -342,46 +342,46 @@ kernel.lto: 0
342342
kernel.build_salt: "6.12.38+deb13-amd64"
343343
kernel.build_id: 5783470ea1883c7d668e98f3c2928751600ccd28
344344
345-
--- meminfo-facts ---
345+
--- meminfo_facts ---
346346
S memtotal conf=parsed value=0x78fa7000
347347
S max_pfn conf=parsed value=0x80000
348348
349-
--- page-size ---
349+
--- page_size ---
350350
S page_size conf=parsed value=0x1000
351351
352352
--- perf_event_open ---
353353
[.] trying perf_event_open sampling ...
354354
[-] syscall(SYS_perf_event_open): Permission denied
355355
[-] no kernel address found via perf_event_open
356356
357-
--- proc-cmdline ---
357+
--- proc_cmdline ---
358358
[.] trying /proc/cmdline ...
359359
[-] Kernel was not booted with nokaslr flag.
360360
361-
--- proc-config ---
361+
--- proc_config ---
362362
[.] checking /proc/config.gz ...
363363
[-] Could not read /proc/config.gz
364364
365-
--- proc-cpuinfo ---
365+
--- proc_cpuinfo ---
366366
[.] checking /proc/cpuinfo ...
367367
[.] Address sizes: 45 bits physical, 48 bits virtual
368368
[.] Paging level 4: PAGE_OFFSET floor -> 0xffff800000000000
369369
V page_offset pos=base conf=parsed lo=0xffff800000000000
370370
371-
--- proc-iomem-kernel ---
371+
--- proc_iomem_kernel ---
372372
[-] /proc/iomem appears masked (kptr_restrict?); addresses read as 0
373373
374-
--- proc-kallsyms ---
374+
--- proc_kallsyms ---
375375
376-
--- proc-modules ---
376+
--- proc_modules ---
377377
[.] reading /proc/modules ...
378378
[-] no kernel address found in /proc/modules
379379
380-
--- proc-stat-wchan ---
380+
--- proc_stat_wchan ---
381381
[.] checking /proc/173583/stat 'wchan' field ...
382382
[-] no kernel address found in /proc/pid/stat wchan
383383
384-
--- proc-zoneinfo ---
384+
--- proc_zoneinfo ---
385385
[.] searching /proc/zoneinfo for zone start_pfn and spanned ...
386386
lowest zone start PFN: 1 (phys 0x0000000000001000)
387387
P ram pos=interior conf=parsed sample=0x1000
@@ -393,7 +393,7 @@ note: phys and virt KASLR are decoupled on this arch; cannot derive directmap vi
393393
[.] scanning /proc/timer_list for timer base addresses ...
394394
[-] fopen: Permission denied
395395
396-
--- qemu-tcg-iret ---
396+
--- qemu_tcg_iret ---
397397
[.] trying QEMU TCG iret leak ...
398398
[-] QEMU TCG IRET fault not triggered
399399
@@ -403,12 +403,12 @@ IDT base: 0xfffffe0000000000
403403
IDT limit: 0x0fff (4096 bytes, 256 entries)
404404
[-] IDT is in the CPU entry area (CONFIG_PAGE_TABLE_ISOLATION=y) — no leak
405405
406-
--- sysfs-kernel-notes-xen ---
406+
--- sysfs_kernel_notes_xen ---
407407
[.] checking /sys/kernel/notes ...
408408
[-] Xen notes appear stale (unrelocated); discarding
409409
[-] no kernel addresses found in ELF notes
410410
411-
--- sysfs-module-sections ---
411+
--- sysfs_module_sections ---
412412
[.] trying /sys/modules/*/sections/.text ...
413413
[-] no kernel address found in /sys/module sections
414414
@@ -498,13 +498,13 @@ note: phys and virt KASLR are decoupled on this arch; cannot derive directmap vi
498498
[-] timeout after 28672 iterations (5s); likely patched
499499
[-] kernel base not found in mincore info leak
500500
501-
--- mmap-arm64-va-bits ---
501+
--- mmap_arm64_va_bits ---
502502
503-
--- mmap-brute-vmsplit ---
503+
--- mmap_brute_vmsplit ---
504504
[.] searching 32-bit address space for kernel virtual address space start ...
505505
[-] Could not locate kernel virtual address space
506506
507-
--- mmap-riscv64-va-bits ---
507+
--- mmap_riscv64_va_bits ---
508508
509509
--- nilfs2_ioctl ---
510510
[.] trying nilfs2 NILFS_IOCTL_GET_SUINFO heap leak ...
@@ -543,7 +543,7 @@ Physical DRAM / initrd [1]:
543543
544544
----------------------------------------
545545
Physical DRAM / cmdline [1]:
546-
0x000000000008f000 cmdline (cmdline-region, parsed)
546+
0x000000000008f000 cmdline (cmdline_region, parsed)
547547
==> 0x000000000008f000 (parsed, 1 source)
548548
549549
----------------------------------------

extra/check-results

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
# sudo ./extra/check-results results.txt
2525
# validate from stdin pipe:
2626
# ./build/*/kasld -v 2>&1 | sudo ./extra/check-results
27-
# ./build/*/components/proc-kallsyms 2>&1 | sudo ./extra/check-results -
27+
# ./build/*/components/proc_kallsyms 2>&1 | sudo ./extra/check-results -
2828
#
2929
# Requires: root (for unhashed /proc/kallsyms and /proc/iomem)
3030
# ---

0 commit comments

Comments
 (0)