* [LTP] [PATCH] syscalls/setfsgid02: Bugfix for running as root
@ 2021-05-08 6:48 zhaogongyi
0 siblings, 0 replies; 3+ messages in thread
From: zhaogongyi @ 2021-05-08 6:48 UTC (permalink / raw)
To: ltp
Hi Cyril,
Thanks for your review!
I have resubmitted the patch and rewrite setfsgid02.c,
please see: https://patchwork.ozlabs.org/project/ltp/patch/20210508064351.10737-1-zhaogongyi@huawei.com/
Thanks so much!
Best Regards,
Gongyi
>
> Hi!
> > When we run the test as root id, and with the option "-i 2", test will
> > fail.
>
> Looking at the test there is much more to fix.
>
> - the description does not match what the test is doing
> - the pass/fail condition and TFAIL message does not make any sense
>
> And its the same for the rest of the setfsgid tests.
>
> Looking at the manual pages for this oddball syscall we should check if:
>
> - unpriviledged process cannot change the value i.e. value that is
> different from return from ret=setfsgid(-1) is passed as
> setfsgid(ret+1) followed by setfsgid(-1) and all of these returns the
> same value and the value also matches process effective group ID
>
> - priviledged process can change the value i.e. the same as
> unpriviledged but we expect the last setfsgid(-1) return
> the new value. We either have to reset the setfsgid() at the end of
> the test or run it in a fork()-ed process so that we start with a
> clean plate for each iteration
>
> --
> Cyril Hrubis
> chrubis@suse.cz
^ permalink raw reply [flat|nested] 3+ messages in thread
* [LTP] [PATCH] syscalls/setfsgid02: Bugfix for running as root
2021-04-28 12:49 Zhao Gongyi
@ 2021-04-28 13:56 ` Cyril Hrubis
0 siblings, 0 replies; 3+ messages in thread
From: Cyril Hrubis @ 2021-04-28 13:56 UTC (permalink / raw)
To: ltp
Hi!
> When we run the test as root id, and with the option "-i 2",
> test will fail.
Looking at the test there is much more to fix.
- the description does not match what the test is doing
- the pass/fail condition and TFAIL message does not make any sense
And its the same for the rest of the setfsgid tests.
Looking at the manual pages for this oddball syscall we should check if:
- unpriviledged process cannot change the value i.e. value that is
different from return from ret=setfsgid(-1) is passed as
setfsgid(ret+1) followed by setfsgid(-1) and all of these returns the
same value and the value also matches process effective group ID
- priviledged process can change the value i.e. the same as
unpriviledged but we expect the last setfsgid(-1) return
the new value. We either have to reset the setfsgid() at the end of
the test or run it in a fork()-ed process so that we start with a
clean plate for each iteration
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 3+ messages in thread
* [LTP] [PATCH] syscalls/setfsgid02: Bugfix for running as root
@ 2021-04-28 12:49 Zhao Gongyi
2021-04-28 13:56 ` Cyril Hrubis
0 siblings, 1 reply; 3+ messages in thread
From: Zhao Gongyi @ 2021-04-28 12:49 UTC (permalink / raw)
To: ltp
When we run the test as root id, and with the option "-i 2",
test will fail.
Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
---
testcases/kernel/syscalls/setfsgid/setfsgid02.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/syscalls/setfsgid/setfsgid02.c b/testcases/kernel/syscalls/setfsgid/setfsgid02.c
index 4788957e2..a5485294e 100644
--- a/testcases/kernel/syscalls/setfsgid/setfsgid02.c
+++ b/testcases/kernel/syscalls/setfsgid/setfsgid02.c
@@ -49,10 +49,11 @@ int main(int ac, char **av)
setup();
+ gid = 1;
+
for (lc = 0; TEST_LOOPING(lc); lc++) {
tst_count = 0;
- gid = 1;
while (getgrgid(gid))
gid++;
@@ -73,6 +74,8 @@ int main(int ac, char **av)
tst_resm(TPASS, "setfsgid() returned expected value : "
"%ld", TEST_RETURN);
}
+
+ gid++;
}
cleanup();
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-08 6:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-08 6:48 [LTP] [PATCH] syscalls/setfsgid02: Bugfix for running as root zhaogongyi
-- strict thread matches above, loose matches on Subject: below --
2021-04-28 12:49 Zhao Gongyi
2021-04-28 13:56 ` Cyril Hrubis
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.