Skip to content

Commit 7043b78

Browse files
committed
cleanup: align comments and headers with the code they describe
A sweep of comments, header blocks, and explain strings had drifted from the code they describe. No behavior changes.
1 parent 04c3bef commit 7043b78

25 files changed

Lines changed: 48 additions & 39 deletions

src/components/bcm_msg_head_struct.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// Data leaked: kernel stack pointer (uninitialized struct padding)
1212
// Kernel subsystem: net/can — CAN BCM (net/can/bcm.c)
1313
// Data structure: struct bcm_msg_head (4-byte padding hole after flags)
14-
// Address type: virtual (kernel stack)
14+
// Address type: virtual (kernel text, recovered from stack padding)
1515
// Method: heuristic
1616
// CVE: CVE-2021-34693
1717
// Patched: v5.12 (multiple commits)

src/components/boot_config.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
// Check kernel config for CONFIG_RELOCATABLE, CONFIG_RANDOMIZE_BASE,
44
// and CONFIG_PAGE_OFFSET (32-bit vmsplit).
55
//
6-
// Detection component — does not leak an address.
6+
// Detection component; on 32-bit vmsplit arches also emits the parsed
7+
// CONFIG_PAGE_OFFSET as the page-offset base.
78
// Purpose: reads /boot/config-$(uname -r) to determine whether
89
// CONFIG_RANDOMIZE_BASE is set (KASLR compiled in) and what the
910
// 32-bit vmsplit (CONFIG_PAGE_OFFSET) is. Readable when /boot is

src/components/dmesg_backtrace.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,8 @@ static void scan_directmap(const char *line, struct btctx *c) {
276276
* text; tp/sp are not, but LoongArch is coupled (text and data share the
277277
* 0x9000... window) so they cannot be excluded by address range — hence the two
278278
* registers are read positionally by field name rather than range-scanned.
279-
* Always compiled (so it is unit-testable); only invoked on LoongArch, where
280-
* the marked-unused attribute is moot. */
279+
* Always compiled; only invoked on LoongArch, where the marked-unused
280+
* attribute is moot. */
281281
__attribute__((unused)) static void
282282
parse_loongarch_pc_ra(const char *line, unsigned long *pc, unsigned long *ra) {
283283
*pc = 0;

src/components/dmesg_cma_reserved.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,7 @@ int main(void) {
176176
}
177177

178178
/* CMA pools are firmware/kernel-reserved memory carved out of DRAM —
179-
* each is emitted as its own RESERVED_MEM band in the parse callbacks. The
180-
* directmap projection below derives one virtual landmark from the lowest. */
179+
* each is emitted as its own RESERVED_MEM band in the parse callbacks. */
181180
kasld_info("lowest reserved pool: 0x%016lx", r.lo);
182181
if (r.hi && r.hi != r.lo)
183182
kasld_info("highest reserved pool: 0x%016lx", r.hi);

src/components/dmesg_crashkernel.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,7 @@ int main(void) {
184184
if (r.hi && r.hi != r.lo)
185185
kasld_info("crashkernel end: 0x%016lx", r.hi);
186186

187-
/* Per-region forbidden bands are emitted in the parse callbacks; the
188-
* directmap projection below derives one virtual landmark from the lowest. */
187+
/* Per-region forbidden bands are emitted in the parse callbacks. */
189188

190189
return 0;
191190
}

src/components/dmesg_free_reserved_area.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ KASLD_META("method:parsed\n"
7373
"patch:v4.10\n");
7474

7575
/* Parse a "Freeing <name> memory: <size>K (<start> - <end>)" line.
76-
* Emits a kasld_result() for the start address. Returns 1 on success. */
76+
* Emits a kasld_result_sample() for the start address. Returns 1 on success. */
7777
static int on_match(const char *line, void *ctx) {
7878
(void)ctx;
7979
const char *name_start;

src/components/dmesg_reserved_mem.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ int main(void) {
124124
kasld_info("lowest reserved mem physical address: 0x%016lx", r.lo);
125125
kasld_info("highest reserved mem physical address: 0x%016lx", r.hi);
126126

127-
/* Per-region forbidden bands are emitted in on_match(); the directmap
128-
* projection below derives one virtual landmark from the lowest region. */
127+
/* Per-region forbidden bands are emitted in on_match(). */
129128

130129
return 0;
131130
}

src/components/dmesg_reserved_mem_opensbi.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
// Data leaked: physical DRAM base address (OpenSBI M-mode reservation)
2424
// Kernel subsystem: drivers/of/fdt_reserved_mem — mmode_resv0 DT node
2525
// Data structure: reserved memory node (physical address of DRAM base)
26-
// Address type: physical (DRAM)
26+
// Address type: physical (DRAM); on linear-map-coupled RISC-V also a
27+
// derived virtual kernel-image landmark
2728
// Method: parsed (dmesg string)
2829
// Status: unfixed (printed unconditionally on RISC-V with OpenSBI)
2930
// Access check: do_syslog() → check_syslog_permissions(); gated by

src/components/function_order_fingerprint.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static const char *const probe_tails[] = {
6060
/* Minimums below which the span is statistically meaningless -> abstain. */
6161
#define MIN_PROBES 6
6262
#define MIN_T_SYMS 1000
63-
#define REORDER_RATIO 0.30 /* span/total_T at/above which we flag reordered */
63+
#define REORDER_RATIO 0.30 /* span/total_T threshold for the reordered flag */
6464

6565
KASLD_EXPLAIN(
6666
"Measures how far the kernel/sys.c syscall wrappers are scattered across "

src/components/kernfs_ns_hash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ static uint32_t base_offset_lookup(void) {
315315
/* Scan candidate bases b in [lo, hi] step `step`, testing salt = b + off, and
316316
* return 1 with the UNIQUE matching salt in *salt; 0 if none or ambiguous.
317317
* A wrong candidate cannot reproduce every cookie, so a lone survivor is the
318-
* true salt. Split out so the recovery is testable over a bounded window. */
318+
* true salt. Split out so the recovery runs over a bounded window. */
319319
static int kernfs_scan(const struct kernfs_pair *pr, int n, unsigned long lo,
320320
unsigned long hi, unsigned long step, uint32_t off,
321321
unsigned long *salt) {

0 commit comments

Comments
 (0)