* [LTP] [PATCH] semctl09: Fix EPERM warning in cleanup()
@ 2021-01-25 11:41 Martin Doucha
2021-01-25 12:23 ` Petr Vorel
0 siblings, 1 reply; 2+ messages in thread
From: Martin Doucha @ 2021-01-25 11:41 UTC (permalink / raw)
To: ltp
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 <mdoucha@suse.cz>
---
testcases/kernel/syscalls/ipc/semctl/semctl09.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/testcases/kernel/syscalls/ipc/semctl/semctl09.c b/testcases/kernel/syscalls/ipc/semctl/semctl09.c
index d36ba62e5..f0c757cdd 100644
--- a/testcases/kernel/syscalls/ipc/semctl/semctl09.c
+++ b/testcases/kernel/syscalls/ipc/semctl/semctl09.c
@@ -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);
}
--
2.29.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-01-25 12:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-25 11:41 [LTP] [PATCH] semctl09: Fix EPERM warning in cleanup() Martin Doucha
2021-01-25 12:23 ` Petr Vorel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox