semctl09: Fix EPERM warning in cleanup()
PATCH 1/1 semctl09: Fix EPERM warning in cleanup()
If semctl09 failed in one of the SAFE_*() functions during unprivileged user test case, SAFE_SEMCTL() in cleanup() would fail with EPERM because the sem_id is owned by root. Make sure that cleanup() always runs with root EUID.
Signed-off-by Martin Doucha <[email protected]>
--- testcases/kernel/syscalls/ipc/semctl/semctl09.c | 2 ++ 1 file changed, 2 insertions(+)
testcases/kernel/syscalls/ipc/semctl/semctl09.c +2 -0
@@ -187,6 +187,8 @@ static void setup(void)static void cleanup (void ) { +SAFE_SETEUID (root_uid); +if (sem_id >=0 )SAFE_SEMCTL (sem_id,0 ,IPC_RMID ); }
Signature · 1 line
2.29.2
PATCH 1/1 semctl09: Fix EPERM warning in cleanup()
Hi Martin,
Quoted 3 lines
If semctl09 failed in one of the SAFE_*() functions during unprivileged user test case,
SAFE_SEMCTL()incleanup()would fail with EPERM because thesem_idis owned by root. Make sure thatcleanup()always runs with root EUID.
Thanks a lot, merged!
Kind regards,
Petr