public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Li Wang <liwang@redhat.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v3 05/11] Add landlock01 test
Date: Fri, 12 Jul 2024 09:57:58 +0200	[thread overview]
Message-ID: <20240712075758.GB103986@pevik> (raw)
In-Reply-To: <CAEemH2eYZ05Fn0ZYhpG16UUzYo=F3GKBpYeRG_X2BUdrLbY8PA@mail.gmail.com>

Hi Andrea, Li,

...
> >> First, this fails at least on various kernel versions (tested: Tumbleweed
> >> 6.10.0-rc7-3.g92abc10-default, and SLE15-SP4 5.14.21 with lsm=landlock and
> >> Debian 6.6.15-amd64):

> >> landlock01.c:49: TFAIL: Size is too small expected EINVAL: ENOMSG (42)

> >> Is it a kernel bug or a test bug?


> > You probably need to check the `/usr/include/linux/landlock.h` header file
> > exist,
> > and to see if 'struct landlock_ruleset_attr' contains the new field
> > 'handled_access_net'.

> > If not exist or does not contain that, the test defines 'struct
> > landlock_ruleset_attr'
> > in lapi/landlock.h which contains handled_access_net directly, this is
> > likely the
> > root cause lead test failed on your box.

> And, if the header file does not exist, the macro condition will choose to
> use 'rule_size - 1',
> and that caused the ENOMSG error during test on the newer kernel.

> #ifdef HAVE_STRUCT_LANDLOCK_RULESET_ATTR_HANDLED_ACCESS_NET
>     rule_small_size = rule_size - sizeof(uint64_t) - 1;
> #else
>     rule_small_size = rule_size - 1;
> #endif

> So to keep the kernel-headers and running kernel version consistent should
> be required
> for the landlock01 test. Otherwise the #ifdef possibly won't work correctly.

FYI Having inconsistent kernel headers and running kernel would be a problem for
more LTP tests than just landlock01 (basically many tests which have autotools
check). But this can be problematic for some development (e.g. linux-next).
Therefore we at least assume UAPI headers shouldn't be newer than running
kernel, see https://lore.kernel.org/ltp/ZJP_qPeJ37H4qhEN@yuki/.

> I guess we might have to resolve this on the test side.

Trying to compare versions <linux/version.h> could be used:

#define LINUX_VERSION_CODE 395008
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + ((c) > 255 ? 255 : (c)))
#define LINUX_VERSION_MAJOR 6
#define LINUX_VERSION_PATCHLEVEL 7
#define LINUX_VERSION_SUBLEVEL 0

We already use KERNEL_VERSION() in kdump and device-drivers tests.

Kind regards,
Petr

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

  reply	other threads:[~2024-07-12  7:58 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-11 11:18 [LTP] [PATCH v3 00/11] landlock testing suite Andrea Cervesato
2024-07-11 11:18 ` [LTP] [PATCH v3 01/11] Add landlock syscalls definitions Andrea Cervesato
2024-07-11 11:18 ` [LTP] [PATCH v3 02/11] Add lapi/landlock.h fallback Andrea Cervesato
2024-07-11 11:18 ` [LTP] [PATCH v3 03/11] Added three more SAFE_* macros for landlock sandbox: Andrea Cervesato
2024-07-11 11:18 ` [LTP] [PATCH v3 04/11] Add SAFE_PRCTL macro Andrea Cervesato
2024-07-11 20:06   ` Petr Vorel
2024-07-11 11:18 ` [LTP] [PATCH v3 05/11] Add landlock01 test Andrea Cervesato
2024-07-11 20:40   ` Petr Vorel
2024-07-12  2:11     ` Li Wang
2024-07-12  3:03       ` Li Wang
2024-07-12  7:57         ` Petr Vorel [this message]
2024-07-12  8:28           ` Li Wang
2024-07-12  9:22             ` Petr Vorel
2024-07-12  7:07       ` Petr Vorel
2024-07-11 11:18 ` [LTP] [PATCH v3 06/11] Add landlock02 test Andrea Cervesato
2024-07-11 20:32   ` Petr Vorel
2024-07-16 16:59     ` Petr Vorel
2024-07-11 11:18 ` [LTP] [PATCH v3 07/11] Add landlock03 test Andrea Cervesato
2024-07-16 17:15   ` Petr Vorel
2024-07-11 11:18 ` [LTP] [PATCH v3 08/11] Add CAP_MKNOD fallback in lapi/capability.h Andrea Cervesato
2024-07-12  7:49   ` Li Wang
2024-07-11 11:18 ` [LTP] [PATCH v3 09/11] Add landlock04 test Andrea Cervesato
2024-07-12  7:50   ` Li Wang
2024-07-16 17:27   ` Petr Vorel
2024-07-24 10:41     ` Andrea Cervesato via ltp
2024-07-24 12:12     ` Li Wang
2024-07-24 13:30       ` Petr Vorel
2024-07-24 13:37         ` Li Wang
2024-07-24 13:41           ` Petr Vorel
2024-07-24 13:41           ` Li Wang
2024-07-24 13:47       ` Andrea Cervesato via ltp
2024-07-25  7:12         ` Andrea Cervesato via ltp
     [not found]           ` <54317d90-ec53-49ff-bbff-15200f09c8d2@suse.com>
2024-07-25  9:06             ` [LTP] LTP landlock test is failing for all kernels <= 6.6 Mickaël Salaün
2024-07-25  9:17               ` Andrea Cervesato via ltp
2024-07-11 11:18 ` [LTP] [PATCH v3 10/11] Add landlock05 test Andrea Cervesato
2024-07-11 11:18 ` [LTP] [PATCH v3 11/11] Add landlock06 test Andrea Cervesato

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240712075758.GB103986@pevik \
    --to=pvorel@suse.cz \
    --cc=liwang@redhat.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox