public inbox for cip-dev@lists.cip-project.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: cip-dev <cip-dev@lists.cip-project.org>
Subject: [isar-cip-core][PATCH] ltp: Fix build with latest Debian
Date: Mon, 12 Jan 2026 14:22:01 +0100	[thread overview]
Message-ID: <036d9b45-4225-4ea8-825b-e40780c1affe@siemens.com> (raw)

From: Jan Kiszka <jan.kiszka@siemens.com>

Something broke the build of ltp-full recently, likely some update of a
Debian build dependency. Backport a patch from the upcoming release to
our 20250930 to address this.

Close #147
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 ...date-struct-mnt_id_req-support-for-k.patch | 195 ++++++++++++++++++
 recipes-core/ltp/ltp-full_20250930.bb         |   2 +
 2 files changed, 197 insertions(+)
 create mode 100644 recipes-core/ltp/files/0001-listmount04.c-Update-struct-mnt_id_req-support-for-k.patch

diff --git a/recipes-core/ltp/files/0001-listmount04.c-Update-struct-mnt_id_req-support-for-k.patch b/recipes-core/ltp/files/0001-listmount04.c-Update-struct-mnt_id_req-support-for-k.patch
new file mode 100644
index 00000000..aecfe548
--- /dev/null
+++ b/recipes-core/ltp/files/0001-listmount04.c-Update-struct-mnt_id_req-support-for-k.patch
@@ -0,0 +1,195 @@
+From 2d066ead3d6ef504c82551b12306e751d23ddb45 Mon Sep 17 00:00:00 2001
+From: Wei Gao <wegao@suse.com>
+Date: Sun, 14 Dec 2025 02:15:20 +0000
+Subject: [PATCH] listmount04.c: Update struct mnt_id_req support for kernel >=
+ 6.18
+
+Kernel change from v6.18-rc7
+78f0e33cd6c93 ("fs/namespace: correctly handle errors returned by grab_requested_mnt_ns")
+causes the test failure with following error message:
+listmount04.c:128: TFAIL: invalid mnt_id_req.spare expected EINVAL: EBADF (9)
+
+The fix require following changes:
+
+* struct mnt_id_req got new member mnt_ns_fd in v6.18-rc7.  That is
+fixed in a fallback defintion in lapi/. If the fallback is used is now
+done via typedef (that requires also update in statmount.h).
+
+* New kernels (>= 6.18) have also different errno. This is fixed by
+runtime check.
+
+Link: https://lore.kernel.org/ltp/20251214021541.3256-1-wegao@suse.com/
+Reviewed-by: Petr Vorel <pvorel@suse.cz>
+Reviewed-by: Li Wang <liwang@redhat.com>
+Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
+Signed-off-by: Wei Gao <wegao@suse.com>
+[ pvorel: Shorten TCONF, rewrite commit message ]
+Signed-off-by: Petr Vorel <pvorel@suse.cz>
+---
+ configure.ac                                  |  2 +-
+ include/lapi/mount.h                          | 10 +++--
+ .../kernel/syscalls/listmount/listmount.h     |  2 +-
+ .../kernel/syscalls/listmount/listmount04.c   | 37 +++++++++++++++++--
+ .../kernel/syscalls/statmount/statmount.h     |  2 +-
+ 5 files changed, 44 insertions(+), 9 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 0480f46ca..a0ebbb34d 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -262,7 +262,7 @@ AC_CHECK_TYPES([struct cachestat_range],,,[#include <sys/mman.h>])
+ AC_CHECK_TYPES([struct cachestat],,,[#include <sys/mman.h>])
+ 
+ # Defined in <linux/mount.h>, but include/lapi/mount.h includes <sys/mount.h> */
+-AC_CHECK_TYPES([struct mnt_id_req],,,[#include <sys/mount.h>])
++AC_CHECK_MEMBERS([struct mnt_id_req.mnt_ns_fd],,,[#include <sys/mount.h>])
+ AC_CHECK_TYPES([struct statmount],,,[#include <sys/mount.h>])
+ AC_CHECK_MEMBERS([struct statmount.mnt_ns_id],,,[#include <unistd.h>
+ #include <linux/mount.h>])
+diff --git a/include/lapi/mount.h b/include/lapi/mount.h
+index 0f7bb5e43..3b296fc9c 100644
+--- a/include/lapi/mount.h
++++ b/include/lapi/mount.h
+@@ -45,14 +45,18 @@
+ # define MS_NOSYMFOLLOW 256
+ #endif
+ 
+-#ifndef HAVE_STRUCT_MNT_ID_REQ
+-struct mnt_id_req {
++struct mnt_id_req_fallback {
+ 	uint32_t size;
+-	uint32_t spare;
++	uint32_t mnt_ns_fd;
+ 	uint64_t mnt_id;
+ 	uint64_t param;
+ 	uint64_t mnt_ns_id;
+ };
++
++#ifndef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD
++typedef struct mnt_id_req_fallback mnt_id_req;
++#else
++typedef struct mnt_id_req mnt_id_req;
+ #endif
+ 
+ #ifndef HAVE_STRUCT_STATMOUNT
+diff --git a/testcases/kernel/syscalls/listmount/listmount.h b/testcases/kernel/syscalls/listmount/listmount.h
+index aad927f71..e7ef375d7 100644
+--- a/testcases/kernel/syscalls/listmount/listmount.h
++++ b/testcases/kernel/syscalls/listmount/listmount.h
+@@ -15,7 +15,7 @@
+ static inline ssize_t listmount(uint64_t mnt_id, uint64_t last_mnt_id,
+ 			 uint64_t list[], size_t num, unsigned int flags)
+ {
+-	struct mnt_id_req req = {
++	mnt_id_req req = {
+ 		.size = MNT_ID_REQ_SIZE_VER0,
+ 		.mnt_id = mnt_id,
+ 		.param = last_mnt_id,
+diff --git a/testcases/kernel/syscalls/listmount/listmount04.c b/testcases/kernel/syscalls/listmount/listmount04.c
+index a6921a249..2b8b49101 100644
+--- a/testcases/kernel/syscalls/listmount/listmount04.c
++++ b/testcases/kernel/syscalls/listmount/listmount04.c
+@@ -14,14 +14,18 @@
+ 
+ #define _GNU_SOURCE
+ 
++#include "config.h"
+ #include "tst_test.h"
+ #include "lapi/mount.h"
+ #include "lapi/syscalls.h"
+ 
+ #define MNT_SIZE 32
++#define BEFORE_6_18 1
++#define AFTER_6_18 2
+ 
+-static struct mnt_id_req *request;
++static mnt_id_req *request;
+ static uint64_t mnt_ids[MNT_SIZE];
++static int kver;
+ 
+ static struct tcase {
+ 	int req_usage;
+@@ -34,6 +38,7 @@ static struct tcase {
+ 	uint64_t flags;
+ 	int exp_errno;
+ 	char *msg;
++	int kver;
+ } tcases[] = {
+ 	{
+ 		.req_usage = 0,
+@@ -79,6 +84,18 @@ static struct tcase {
+ 		.nr_mnt_ids = MNT_SIZE,
+ 		.exp_errno = EINVAL,
+ 		.msg = "invalid mnt_id_req.spare",
++		.kver = BEFORE_6_18,
++	},
++	{
++		.req_usage = 1,
++		.size = MNT_ID_REQ_SIZE_VER0,
++		.spare = -1,
++		.mnt_id = LSMT_ROOT,
++		.mnt_ids = mnt_ids,
++		.nr_mnt_ids = MNT_SIZE,
++		.exp_errno = EBADF,
++		.msg = "invalid mnt_id_req.mnt_ns_fd",
++		.kver = AFTER_6_18,
+ 	},
+ 	{
+ 		.req_usage = 1,
+@@ -113,7 +130,12 @@ static struct tcase {
+ static void run(unsigned int n)
+ {
+ 	struct tcase *tc = &tcases[n];
+-	struct mnt_id_req *req = NULL;
++	mnt_id_req *req = NULL;
++
++	if (tc->kver && tc->kver != kver) {
++		tst_res(TCONF, "Test not suitable for current kernel version");
++		return;
++	}
+ 
+ 	memset(mnt_ids, 0, sizeof(mnt_ids));
+ 
+@@ -122,7 +144,7 @@ static void run(unsigned int n)
+ 		req->mnt_id = tc->mnt_id;
+ 		req->param = tc->param;
+ 		req->size = tc->size;
+-		req->spare = tc->spare;
++		req->mnt_ns_fd = tc->spare;
+ 	}
+ 
+ 	TST_EXP_FAIL(tst_syscall(__NR_listmount, req, tc->mnt_ids,
+@@ -130,8 +152,17 @@ static void run(unsigned int n)
+ 		"%s", tc->msg);
+ }
+ 
++static void setup(void)
++{
++	if (tst_kvercmp(6, 18, 0) >= 0)
++		kver = AFTER_6_18;
++	else
++		kver = BEFORE_6_18;
++}
++
+ static struct tst_test test = {
+ 	.test = run,
++	.setup = setup,
+ 	.tcnt = ARRAY_SIZE(tcases),
+ 	.min_kver = "6.11",
+ 	.bufs = (struct tst_buffers []) {
+diff --git a/testcases/kernel/syscalls/statmount/statmount.h b/testcases/kernel/syscalls/statmount/statmount.h
+index d21d7f8da..4217a82d8 100644
+--- a/testcases/kernel/syscalls/statmount/statmount.h
++++ b/testcases/kernel/syscalls/statmount/statmount.h
+@@ -16,7 +16,7 @@
+ static inline int statmount(uint64_t mnt_id, uint64_t mask, struct statmount *buf,
+ 		     size_t bufsize, unsigned int flags)
+ {
+-	struct mnt_id_req req = {
++	mnt_id_req req = {
+ 		.size = MNT_ID_REQ_SIZE_VER0,
+ 		.mnt_id = mnt_id,
+ 		.param = mask,
+-- 
+2.51.0
+
diff --git a/recipes-core/ltp/ltp-full_20250930.bb b/recipes-core/ltp/ltp-full_20250930.bb
index d57e875e..42a96328 100644
--- a/recipes-core/ltp/ltp-full_20250930.bb
+++ b/recipes-core/ltp/ltp-full_20250930.bb
@@ -11,4 +11,6 @@
 
 require recipes-core/ltp/ltp.inc
 
+SRC_URI += "file://0001-listmount04.c-Update-struct-mnt_id_req-support-for-k.patch"
+
 SRC_URI[sha256sum] = "048fa4d69ddbe8a94aa15da9bdc85713ab07a0abbc3de2b8bdd9757644aef1e4"
-- 
2.51.0


                 reply	other threads:[~2026-01-12 13:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=036d9b45-4225-4ea8-825b-e40780c1affe@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=cip-dev@lists.cip-project.org \
    /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