[LTP] [PATCH 0/4] syscalls/ipc: shmctl04: Fix /proc/sysvipc/shm parsing

Guixiong Wei via ltp
2026-02-23T10:58:20Z

Hi,

This series fixes shmctl04 parsing and reporting for /proc/sysvipc/shm.

On systems with large SHM segments, the "bytes" column in /proc/sysvipc/shm may
exceed int range, which can lead to truncation and incorrect accounting. The
series parses the size column as unsigned long, requires fscanf() to match all
expected fields to avoid using stale values on partial matches, fixes format
specifiers when reporting counters, and uses SAFE_FOPEN/SAFE_FCLOSE for /proc
reads.

Thanks.

Guixiong Wei (4):
syscalls/ipc: shmctl04: Parse /proc/sysvipc/shm size as unsigned long
syscalls/ipc: shmctl04: Require full fscanf match
syscalls/ipc: shmctl04: Use SAFE_FOPEN for /proc parsing
syscalls/ipc: shmctl04: Fix shm_info print formats

.../kernel/syscalls/ipc/shmctl/shmctl04.c | 24 ++++++++++---------
1 file changed, 13 insertions(+), 11 deletions(-)

--
2.20.1