Documentation
¶
Overview ¶
Package procsyskernel reads Linux kernel information from /proc/sys/kernel/.
This package is in builtins/internal/ and is therefore exempt from the builtinAllowedSymbols allowlist check. It may use OS-specific APIs freely.
Sandbox bypass ¶
ReadFile intentionally bypasses the AllowedPaths sandbox (callCtx.OpenFile) and calls os.OpenFile directly. This is safe because procPath is always a kernel-managed pseudo-filesystem root (/proc by default) that is hardcoded by the caller — it is never derived from user-supplied input and cannot be redirected by a shell script. The caller is responsible for ensuring that procPath remains a safe, non-user-controlled path.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadFile ¶
ReadFile reads a single-line value from a /proc/sys/kernel/ pseudo-file. name is the filename (e.g. "ostype", "hostname"). procPath is the base proc path (e.g. "/proc" or "/host/proc").
The file is opened with O_NONBLOCK to prevent blocking on FIFOs, then validated via fstat to reject non-regular files. Reads are bounded to 4 KiB. The returned value is trimmed of trailing whitespace.
Types ¶
This section is empty.