Skip to content

Commit fc5c00f

Browse files
committed
render: build the oracle heading from the path it reports on
The four leak-oracle rows in the verbose block took their heading from kasld_oracle_labels[], a second array keyed by the same index as kasld_oracle_paths[]. Swapping two entries reported one source's readability under another's heading — a wrong claim about the reader's privilege — and nothing caught it: the gatherer test pins each path to its own probe, not a heading to its path. Every label was "Readable " + the path + ":", so the array carried nothing the path did not already say, and text.c was its only reader. The JSON and markdown blocks name the path itself alongside the same readability bit, which is why they never consulted it and why a heading is not a property of an oracle. The heading is now composed where it is printed, next to the check_files rows that already work that way, and the array is gone.
1 parent ab848fe commit fc5c00f

3 files changed

Lines changed: 7 additions & 8 deletions

File tree

src/environment.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,6 @@ static void read_hardening_state(struct kasld_hardening *h) {
159159

160160
const char *const kasld_oracle_paths[KASLD_N_ORACLES] = {
161161
"/proc/kallsyms", "/proc/kcore", "/proc/iomem", "/proc/modules"};
162-
const char *const kasld_oracle_labels[KASLD_N_ORACLES] = {
163-
"Readable /proc/kallsyms:", "Readable /proc/kcore:",
164-
"Readable /proc/iomem:", "Readable /proc/modules:"};
165162

166163
/* Held-cap → the kasld leak it unlocks. Bit numbers are the stable capability
167164
* ABI (linux/capability.h): CAP_SYS_RAWIO=17, CAP_SYS_ADMIN=21, CAP_SYSLOG=34,

src/include/kasld/internal.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -795,8 +795,6 @@ struct kasld_hardening {
795795
#define KASLD_N_ORACLES 4
796796
extern const char *const
797797
kasld_oracle_paths[KASLD_N_ORACLES]; /* /proc/kallsyms… */
798-
extern const char *const
799-
kasld_oracle_labels[KASLD_N_ORACLES]; /* "Readable …:" */
800798

801799
/* SELinux runtime mode, read from /sys/fs/selinux/enforce. Absent covers both
802800
* "SELinux is not built in" and "selinuxfs is not reachable from here" — which

src/render/text.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2590,9 +2590,13 @@ void render_system_config(void) {
25902590
* log/debug/boot sources. */
25912591
for (int i = 0; i < KASLD_N_ORACLES; i++) {
25922592
int readable = vant->oracle_readable[i];
2593-
printf("%-30s%s%s%s\n", kasld_oracle_labels[i],
2594-
readable ? c(C_GREEN) : c(C_DIM), readable ? "yes" : "no",
2595-
c(C_RESET));
2593+
/* The heading is built from the path it reports on, so a row cannot come
2594+
* to name one source while answering for another. The other formats name
2595+
* the path itself, which is why no heading is carried alongside it. */
2596+
char label[64];
2597+
snprintf(label, sizeof(label), "Readable %s:", kasld_oracle_paths[i]);
2598+
printf("%-30s%s%s%s\n", label, readable ? c(C_GREEN) : c(C_DIM),
2599+
readable ? "yes" : "no", c(C_RESET));
25962600
}
25972601

25982602
const char *check_files[][2] = {

0 commit comments

Comments
 (0)