[LTP] [PATCH] setfsuid02: using -1 as invalid fsuid for setfsuid()

Petr Vorel pvorel@suse.cz
Mon Oct 31 14:50:10 CET 2022


Hi Martin, Avinesh,

> 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.
Right, thanks!

> > 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.
I'm somehow blind today. UID16_CHECK() in compat_tst_16.h calls
UID_SIZE_CHECK(), which just checks the uid value. I don't see setfsuid() call,
IMHO that's done in SETFSUID().

Kind regards,
Petr


More information about the ltp mailing list