[LTP] [PATCH] setfsuid02: using -1 as invalid fsuid for setfsuid()
Martin Doucha
mdoucha@suse.cz
Mon Oct 31 14:36:23 CET 2022
On 31. 10. 22 12:37, Petr Vorel wrote:
> Hi Avinesh,
>
>> a uid which does not have an entry in the /etc/passwd
>> file is not really an invalid fsuid for setfsuid(), so changing
>> the test to use -1 as an invalid fsuid.
>> And second setfsuid(-1) call is to verify that preceding call has
>> actually failed and there is no change in the fsuid.
>
> Here was supposed to be
> Fixes: 85f0b8478 ("setfsuid02: Rewrite using new LTP API")
>
> as the problem was introduced in your rewrite, right?
No, the original test was already broken, it just didn't do any real
failure checks so it always passed.
> It also does not make sense to check invalid_uid, it should have been
> current_uid in 85f0b8478 (my bad not catching this):
>
> UID16_CHECK(current_uid, setfsuid);
No, UID16_CHECK(invalid_uid, setfsuid); is the correct test call. The
test is supposed to verify that trying to set invalid_uid will fail, and
the only way to verify that it failed is to call setfsuid(invalid_uid)
again and check that it returns current_uid.
--
Martin Doucha mdoucha@suse.cz
QA Engineer for Software Maintenance
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic
More information about the ltp
mailing list