[LTP] [PATCH v2 5/5] setsockopt0[38]: Use tst_is_compat_mode()

Cyril Hrubis chrubis@suse.cz
Tue May 21 17:12:30 CEST 2024


Hi!
>  testcases/kernel/syscalls/setsockopt/setsockopt03.c | 5 ++---
>  testcases/kernel/syscalls/setsockopt/setsockopt08.c | 6 ++----
>  2 files changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/setsockopt/setsockopt03.c b/testcases/kernel/syscalls/setsockopt/setsockopt03.c
> index 7a1458277..d910280c8 100644
> --- a/testcases/kernel/syscalls/setsockopt/setsockopt03.c
> +++ b/testcases/kernel/syscalls/setsockopt/setsockopt03.c
> @@ -48,9 +48,8 @@ struct payload {
>  
>  static void setup(void)
>  {
> -	if (tst_kernel_bits() == 32 || sizeof(long) > 4)
> -		tst_res(TCONF,
> -			"The vulnerability was only present in 32-bit compat mode");
> +	if (!tst_is_compat_mode())
> +		tst_res(TCONF, "The vulnerability was only present in 32-bit compat mode");
>  }
>  
>  static void run(void)
> diff --git a/testcases/kernel/syscalls/setsockopt/setsockopt08.c b/testcases/kernel/syscalls/setsockopt/setsockopt08.c
> index 7f8243de1..3b7bd8482 100644
> --- a/testcases/kernel/syscalls/setsockopt/setsockopt08.c
> +++ b/testcases/kernel/syscalls/setsockopt/setsockopt08.c
> @@ -95,10 +95,8 @@ static void *buffer;
>  
>  void setup(void)
>  {
> -	if (tst_kernel_bits() == 32 || sizeof(long) > 4) {
> -		tst_res(TINFO,
> -			"The vulnerability was only present in 32-bit compat mode");
> -	}
> +	if (!tst_is_compat_mode())
> +		tst_res(TINFO, "The vulnerability was only present in 32-bit compat mode");
>  
>  	tst_setup_netns();
>  }

I guess this is something that should be looked into after the release,
either we will need .needs_compat flag or relax the condtions...

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list