Skip to content

Commit 027fe95

Browse files
committed
proc_config: document why the zcat popen fallback is safe
The double-quoted path interpolated into the popen("zcat") fallback is not an injection risk: it is the fixed literal "/proc/config.gz", or that literal under the KASLD_SYSROOT prefix — an env var set by the same user who runs kasld, which is never setuid. No trust boundary is crossed.
1 parent c7109c4 commit 027fe95

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/components/proc_config.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,13 @@ static FILE *open_proc_config(void) {
8787
}
8888
#endif
8989

90-
/* Fallback: decompress via zcat and buffer into a seekable tmpfile. */
90+
/* Fallback when zlib is not linked (e.g. the static cross builds): decompress
91+
* via zcat and buffer into a seekable tmpfile. Interpolating `cfg` into the
92+
* shell command is safe: it is the fixed literal "/proc/config.gz", or that
93+
* literal under the KASLD_SYSROOT prefix — an environment variable set by the
94+
* same user who runs kasld. kasld is never setuid, so no privilege boundary
95+
* is crossed and the double-quoting is sufficient (no untrusted input reaches
96+
* the shell). */
9197
char cmd[KASLD_PATH_MAX + 16];
9298
snprintf(cmd, sizeof(cmd), "zcat \"%s\"", cfg);
9399
FILE *proc = popen(cmd, "r");

0 commit comments

Comments
 (0)