summaryrefslogtreecommitdiff
path: root/include/linux/kapi_syscall.h
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2026-10-14 15:14:32 +0100
committerMark Brown <broonie@kernel.org>2026-10-14 15:14:32 +0100
commit9c513523039dc8ee83f8f527acdcbc7a792d83bc (patch)
tree4107fcfc1919cd3dfbaf37ff86963a0505b3da73 /include/linux/kapi_syscall.h
parent85bc78c75e7be7aee8f012aee5f4d72bc4dc29e4 (diff)
parentef777ef05ebcc5ea5393b4bd5af6fc3ad1b3aec9 (diff)
downloadlinux-next-9c513523039dc8ee83f8f527acdcbc7a792d83bc.tar.gz
linux-next-9c513523039dc8ee83f8f527acdcbc7a792d83bc.zip
Merge branch 'spec' of https://git.kernel.org/pub/scm/linux/kernel/git/sashal/kapi.git
# Conflicts: # Makefile # fs/open.c
Diffstat (limited to 'include/linux/kapi_syscall.h')
-rw-r--r--include/linux/kapi_syscall.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/include/linux/kapi_syscall.h b/include/linux/kapi_syscall.h
new file mode 100644
index 000000000000..bc9387e0e052
--- /dev/null
+++ b/include/linux/kapi_syscall.h
@@ -0,0 +1,35 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2026 Sasha Levin <sashal@kernel.org>
+ *
+ * Spec lookup and syscall validation entry points of the kernel API
+ * specification framework, kept apart from <linux/kernel_api_spec.h> so that
+ * <linux/syscalls.h> can declare them cheaply.
+ */
+
+#ifndef _LINUX_KAPI_SYSCALL_H
+#define _LINUX_KAPI_SYSCALL_H
+
+#include <linux/types.h>
+
+struct kernel_api_spec;
+
+const struct kernel_api_spec *kapi_get_spec(const char *name);
+
+#ifdef CONFIG_KAPI_RUNTIME_CHECKS
+int kapi_validate_syscall_params(const struct kernel_api_spec *spec,
+ const s64 *params, int param_count);
+int kapi_validate_syscall_return(const struct kernel_api_spec *spec, s64 retval);
+#else
+static inline int kapi_validate_syscall_params(const struct kernel_api_spec *spec,
+ const s64 *params, int param_count)
+{
+ return 0;
+}
+static inline int kapi_validate_syscall_return(const struct kernel_api_spec *spec, s64 retval)
+{
+ return 0;
+}
+#endif
+
+#endif /* _LINUX_KAPI_SYSCALL_H */