[LTP] [PATCH 4/4] Remove libkeyutils use

Petr Vorel pvorel@suse.cz
Tue Sep 22 18:09:11 CEST 2026


Using directly <linux/keyctl.h> is enough. Move the rest of struct
checks in to configure.ac (together with other struct checks).

Follow-up: bc8ead0f06 ("lapi/keyctl.h: Remove <keyutils.h>")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 configure.ac                                   |  5 ++++-
 include/mk/config.mk.in                        |  1 -
 m4/ltp-keyutils.m4                             | 15 ---------------
 testcases/cve/Makefile                         |  2 --
 testcases/kernel/syscalls/add_key/Makefile     |  2 --
 testcases/kernel/syscalls/keyctl/Makefile      |  1 -
 testcases/kernel/syscalls/landlock/Makefile    |  2 --
 testcases/kernel/syscalls/request_key/Makefile |  2 --
 testcases/kernel/watchqueue/Makefile           |  2 --
 9 files changed, 4 insertions(+), 28 deletions(-)
 delete mode 100644 m4/ltp-keyutils.m4

diff --git a/configure.ac b/configure.ac
index 18bfdb88c7..6ad2ee7fac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -300,6 +300,10 @@ AC_CHECK_TYPES([struct uffdio_move],,,[#include <linux/userfaultfd.h>])
 AC_CHECK_TYPES([struct uffdio_poison],,,[#include <linux/userfaultfd.h>])
 AC_CHECK_TYPES([struct uffdio_writeprotect],,,[#include <linux/userfaultfd.h>])
 
+AC_CHECK_TYPES([struct keyctl_dh_params, struct keyctl_kdf_params,
+	struct keyctl_pkey_query, struct keyctl_pkey_params],,,
+	[#include <linux/keyctl.h>])
+
 # Tools knobs
 
 # Bash
@@ -422,7 +426,6 @@ LTP_CHECK_CLEAR_CACHE
 LTP_CHECK_CRYPTO
 LTP_CHECK_FORTIFY_SOURCE
 LTP_CHECK_KERNEL_DEVEL
-LTP_CHECK_KEYUTILS_SUPPORT
 LTP_CHECK_LIBMNL
 LTP_CHECK_SELINUX
 LTP_CHECK_SYNC_ADD_AND_FETCH
diff --git a/include/mk/config.mk.in b/include/mk/config.mk.in
index 4c3da304fc..d796306e3a 100644
--- a/include/mk/config.mk.in
+++ b/include/mk/config.mk.in
@@ -38,7 +38,6 @@ SELINUX_LIBS		:= @SELINUX_LIBS@
 HAVE_RPC		:= @HAVE_RPC@
 LIBTIRPC_CFLAGS		:= @LIBTIRPC_CFLAGS@
 LIBTIRPC_LIBS		:= @LIBTIRPC_LIBS@
-KEYUTILS_LIBS		:= @KEYUTILS_LIBS@
 HAVE_FTS_H		:= @HAVE_FTS_H@
 LIBMNL_LIBS		:= @LIBMNL_LIBS@
 LIBMNL_CFLAGS		:= @LIBMNL_CFLAGS@
diff --git a/m4/ltp-keyutils.m4 b/m4/ltp-keyutils.m4
deleted file mode 100644
index 4a6b23dbce..0000000000
--- a/m4/ltp-keyutils.m4
+++ /dev/null
@@ -1,15 +0,0 @@
-dnl SPDX-License-Identifier: GPL-2.0-or-later
-dnl Copyright (c) 2016 Fujitsu Ltd.
-dnl Copyright (c) 2017 Petr Vorel <pvorel@suse.cz>
-dnl Copyright (c) Linux Test Project, 2019-2026
-dnl Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
-
-AC_DEFUN([LTP_CHECK_KEYUTILS_SUPPORT], [
-	AC_CHECK_LIB([keyutils], [add_key],
-	[AC_DEFINE(HAVE_LIBKEYUTILS, 1, [Define to 1 if you have libkeyutils installed.])
-	      AC_SUBST(KEYUTILS_LIBS, "-lkeyutils")])
-
-	AC_CHECK_TYPES([struct keyctl_dh_params, struct keyctl_kdf_params,
-			struct keyctl_pkey_query, struct keyctl_pkey_params],,,
-			[#include <linux/keyctl.h>])
-])
diff --git a/testcases/cve/Makefile b/testcases/cve/Makefile
index b4e4178ebb..c7c160a1b1 100644
--- a/testcases/cve/Makefile
+++ b/testcases/cve/Makefile
@@ -9,8 +9,6 @@ CFLAGS			+= -D_GNU_SOURCE
 
 stack_clash:	CFLAGS += -fno-optimize-sibling-calls -Wno-infinite-recursion
 
-cve-2016-7042:	LDLIBS += $(KEYUTILS_LIBS)
-
 cve-2014-0196 cve-2016-7117 cve-2017-2671 cve-2017-17052 cve-2017-17053 ghostlock refluxfs:  CFLAGS += -pthread
 cve-2014-0196 cve-2016-7117 cve-2017-2671:  LDLIBS += -lrt
 
diff --git a/testcases/kernel/syscalls/add_key/Makefile b/testcases/kernel/syscalls/add_key/Makefile
index 0f51e0bc2f..1273a4e9cb 100644
--- a/testcases/kernel/syscalls/add_key/Makefile
+++ b/testcases/kernel/syscalls/add_key/Makefile
@@ -5,6 +5,4 @@ top_srcdir		?= ../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
 
-LDLIBS  += $(KEYUTILS_LIBS)
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/keyctl/Makefile b/testcases/kernel/syscalls/keyctl/Makefile
index 180ece25a2..14d1d20a4e 100644
--- a/testcases/kernel/syscalls/keyctl/Makefile
+++ b/testcases/kernel/syscalls/keyctl/Makefile
@@ -5,7 +5,6 @@ top_srcdir		?= ../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
 
-LDLIBS	+= $(KEYUTILS_LIBS)
 keyctl02: LDLIBS	+= -lpthread
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/landlock/Makefile b/testcases/kernel/syscalls/landlock/Makefile
index 3734d10349..02a66be910 100644
--- a/testcases/kernel/syscalls/landlock/Makefile
+++ b/testcases/kernel/syscalls/landlock/Makefile
@@ -5,6 +5,4 @@ top_srcdir		?= ../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
 
-landlock07: LDLIBS += $(KEYUTILS_LIBS)
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/request_key/Makefile b/testcases/kernel/syscalls/request_key/Makefile
index 58a99875e5..15e07c4ca1 100644
--- a/testcases/kernel/syscalls/request_key/Makefile
+++ b/testcases/kernel/syscalls/request_key/Makefile
@@ -6,6 +6,4 @@ top_srcdir		?= ../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
 
-LDLIBS		+= $(KEYUTILS_LIBS)
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/watchqueue/Makefile b/testcases/kernel/watchqueue/Makefile
index 896d66d429..cba769739b 100644
--- a/testcases/kernel/watchqueue/Makefile
+++ b/testcases/kernel/watchqueue/Makefile
@@ -4,5 +4,3 @@ top_srcdir			?= ../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
-
-LDLIBS += $(KEYUTILS_LIBS)
-- 
2.55.0



More information about the ltp mailing list