All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] setfsuid02: Fix a fake failure for setfsuid02
@ 2022-10-28  3:21 You Zhou
  2022-10-31 10:59 ` Petr Vorel
  0 siblings, 1 reply; 5+ messages in thread
From: You Zhou @ 2022-10-28  3:21 UTC (permalink / raw)
  To: ltp

When run setfsuid02 case on x86_64 platform, I got a failure even if
the filesystem user ID is set successfully.
"
./setfsuid02
tst_test.c:1526: TINFO: Timeout per run is 0h 00m 30s
setfsuid02.c:31: TFAIL: setfsuid(invalid_fsuid) test for expected
			failure: retval 11 != 0: SUCCESS (0)

Summary:
passed   0
failed   1
broken   0
skipped  0
warnings 0
"

On both success and failure, setfsuid syscall returns the previous
filesystem user ID of the caller. In this case, if case sets
filesystem user ID successfully for the first time, this syscall
can return the ID previously set for the second time.

Reported-by: Pengfei Xu <pengfei.xu@intel.com>
Signed-off-by: You Zhou <you.zhou@intel.com>
---
 testcases/kernel/syscalls/setfsuid/setfsuid02.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/testcases/kernel/syscalls/setfsuid/setfsuid02.c b/testcases/kernel/syscalls/setfsuid/setfsuid02.c
index 850f17834..441d1e27a 100644
--- a/testcases/kernel/syscalls/setfsuid/setfsuid02.c
+++ b/testcases/kernel/syscalls/setfsuid/setfsuid02.c
@@ -28,8 +28,13 @@ static void run(void)
 	UID16_CHECK(invalid_uid, setfsuid);
 
 	TST_EXP_VAL_SILENT(SETFSUID(invalid_uid), current_uid);
+#if __x86_64__
+	TST_EXP_VAL(SETFSUID(invalid_uid), invalid_uid,
+		    "setfsuid(invalid_fsuid) test for expected failure:");
+#else
 	TST_EXP_VAL(SETFSUID(invalid_uid), current_uid,
 		    "setfsuid(invalid_fsuid) test for expected failure:");
+#endif
 }
 
 static struct tst_test test = {
-- 
2.25.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH] setfsuid02: Fix a fake failure for setfsuid02
  2022-10-28  3:21 [LTP] [PATCH] setfsuid02: Fix a fake failure for setfsuid02 You Zhou
@ 2022-10-31 10:59 ` Petr Vorel
  2022-10-31 21:43   ` Petr Vorel
  2022-11-01  1:41   ` Zhou, You
  0 siblings, 2 replies; 5+ messages in thread
From: Petr Vorel @ 2022-10-31 10:59 UTC (permalink / raw)
  To: You Zhou; +Cc: ltp

> When run setfsuid02 case on x86_64 platform, I got a failure even if
> the filesystem user ID is set successfully.
> "
> ./setfsuid02
> tst_test.c:1526: TINFO: Timeout per run is 0h 00m 30s
> setfsuid02.c:31: TFAIL: setfsuid(invalid_fsuid) test for expected
> 			failure: retval 11 != 0: SUCCESS (0)

> Summary:
> passed   0
> failed   1
> broken   0
> skipped  0
> warnings 0
> "

> On both success and failure, setfsuid syscall returns the previous
> filesystem user ID of the caller. In this case, if case sets
> filesystem user ID successfully for the first time, this syscall
> can return the ID previously set for the second time.

> Reported-by: Pengfei Xu <pengfei.xu@intel.com>
> Signed-off-by: You Zhou <you.zhou@intel.com>
> ---
>  testcases/kernel/syscalls/setfsuid/setfsuid02.c | 5 +++++
>  1 file changed, 5 insertions(+)

> diff --git a/testcases/kernel/syscalls/setfsuid/setfsuid02.c b/testcases/kernel/syscalls/setfsuid/setfsuid02.c
> index 850f17834..441d1e27a 100644
> --- a/testcases/kernel/syscalls/setfsuid/setfsuid02.c
> +++ b/testcases/kernel/syscalls/setfsuid/setfsuid02.c
> @@ -28,8 +28,13 @@ static void run(void)
>  	UID16_CHECK(invalid_uid, setfsuid);

>  	TST_EXP_VAL_SILENT(SETFSUID(invalid_uid), current_uid);
> +#if __x86_64__
> +	TST_EXP_VAL(SETFSUID(invalid_uid), invalid_uid,
> +		    "setfsuid(invalid_fsuid) test for expected failure:");
Hi You,

this is most certainly invalid way of fixing things.

Would you mind to test if the patch from Avinesh works for you?
https://lore.kernel.org/ltp/20221027140954.4094-1-akumar@suse.de/

Kind regards,
Petr

> +#else
>  	TST_EXP_VAL(SETFSUID(invalid_uid), current_uid,
>  		    "setfsuid(invalid_fsuid) test for expected failure:");
> +#endif
>  }

>  static struct tst_test test = {

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH] setfsuid02: Fix a fake failure for setfsuid02
  2022-10-31 10:59 ` Petr Vorel
@ 2022-10-31 21:43   ` Petr Vorel
  2022-11-01  1:41   ` Zhou, You
  1 sibling, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2022-10-31 21:43 UTC (permalink / raw)
  To: You Zhou, ltp

Hi You,

FYI fixed in 5398d6c41 ("setfsuid02: using -1 as invalid fsuid for setfsuid()").

BTW this test failed on other archs (at least on aarch64, ppc64le, I suspect
it's not arch specific), therefore your solution would not work.

Kind regards,
Petr



-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH] setfsuid02: Fix a fake failure for setfsuid02
  2022-10-31 10:59 ` Petr Vorel
  2022-10-31 21:43   ` Petr Vorel
@ 2022-11-01  1:41   ` Zhou, You
  2022-11-01  9:16     ` Petr Vorel
  1 sibling, 1 reply; 5+ messages in thread
From: Zhou, You @ 2022-11-01  1:41 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

Hi, Petr,

I try the patch from Avinesh, the test result is normal, so the purpose of this test case is to try to set an invalid uid?


Best wishes
You Zhou

-----Original Message-----
From: Petr Vorel <pvorel@suse.cz> 
Sent: Monday, October 31, 2022 6:59 PM
To: Zhou, You <you.zhou@intel.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] setfsuid02: Fix a fake failure for setfsuid02

> When run setfsuid02 case on x86_64 platform, I got a failure even if 
> the filesystem user ID is set successfully.
> "
> ./setfsuid02
> tst_test.c:1526: TINFO: Timeout per run is 0h 00m 30s
> setfsuid02.c:31: TFAIL: setfsuid(invalid_fsuid) test for expected
> 			failure: retval 11 != 0: SUCCESS (0)

> Summary:
> passed   0
> failed   1
> broken   0
> skipped  0
> warnings 0
> "

> On both success and failure, setfsuid syscall returns the previous 
> filesystem user ID of the caller. In this case, if case sets 
> filesystem user ID successfully for the first time, this syscall can 
> return the ID previously set for the second time.

> Reported-by: Pengfei Xu <pengfei.xu@intel.com>
> Signed-off-by: You Zhou <you.zhou@intel.com>
> ---
>  testcases/kernel/syscalls/setfsuid/setfsuid02.c | 5 +++++
>  1 file changed, 5 insertions(+)

> diff --git a/testcases/kernel/syscalls/setfsuid/setfsuid02.c 
> b/testcases/kernel/syscalls/setfsuid/setfsuid02.c
> index 850f17834..441d1e27a 100644
> --- a/testcases/kernel/syscalls/setfsuid/setfsuid02.c
> +++ b/testcases/kernel/syscalls/setfsuid/setfsuid02.c
> @@ -28,8 +28,13 @@ static void run(void)
>  	UID16_CHECK(invalid_uid, setfsuid);

>  	TST_EXP_VAL_SILENT(SETFSUID(invalid_uid), current_uid);
> +#if __x86_64__
> +	TST_EXP_VAL(SETFSUID(invalid_uid), invalid_uid,
> +		    "setfsuid(invalid_fsuid) test for expected failure:");
Hi You,

this is most certainly invalid way of fixing things.

Would you mind to test if the patch from Avinesh works for you?
https://lore.kernel.org/ltp/20221027140954.4094-1-akumar@suse.de/

Kind regards,
Petr

> +#else
>  	TST_EXP_VAL(SETFSUID(invalid_uid), current_uid,
>  		    "setfsuid(invalid_fsuid) test for expected failure:");
> +#endif
>  }

>  static struct tst_test test = {

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH] setfsuid02: Fix a fake failure for setfsuid02
  2022-11-01  1:41   ` Zhou, You
@ 2022-11-01  9:16     ` Petr Vorel
  0 siblings, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2022-11-01  9:16 UTC (permalink / raw)
  To: Zhou, You; +Cc: ltp

Hi You,

> Hi, Petr,

> I try the patch from Avinesh, the test result is normal, so the purpose of this test case is to try to set an invalid uid?

yes, the purpose is to test that setfsuid() syscall fails if an passed invalid fsuid.

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-11-01  9:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-28  3:21 [LTP] [PATCH] setfsuid02: Fix a fake failure for setfsuid02 You Zhou
2022-10-31 10:59 ` Petr Vorel
2022-10-31 21:43   ` Petr Vorel
2022-11-01  1:41   ` Zhou, You
2022-11-01  9:16     ` Petr Vorel

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.