|
Add a selftest for CONFIG_KAPI_RUNTIME_CHECKS that exercises
sys_open/sys_read/sys_write/sys_close through raw syscall() and
verifies KAPI pre-validation catches invalid parameters while
allowing valid operations through.
Test cases (TAP output):
1-4: Valid open/read/write/close succeed
5-8: Unknown open flag bits and a NULL path are rejected with EINVAL,
while mode bits above 07777 are accepted (the kernel masks them)
9-20: Boundary conditions and error paths (bad and closed fds, zero
counts, over-long paths, unmapped buffers, wrong access mode)
21-27: Pipe, file descriptor lifecycle and other error paths
28-30: A normal open/read/write/close sequence, and read()/write() with
a NULL buffer and a zero count returning 0
31: dmesg contains the expected KAPI warning strings
Tests that depend on CONFIG_KAPI_RUNTIME_CHECKS are skipped when an open()
with an unknown flag bit succeeds, which means the checks are not active.
Assisted-by: LLM
Signed-off-by: Sasha Levin <sashal@kernel.org>
|