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

Petr Vorel pvorel@suse.cz
Tue Nov 26 15:35:42 CET 2024


Hi Cyril,

> 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...

Looking into this old patch, do we relax the conditions or use .needs_abi_bits = 32?
setsockopt08.c prints only TINFO, thus !tst_is_compat_mode() would have to be
used for the check.

Kind regards,
Petr


More information about the ltp mailing list