summaryrefslogtreecommitdiff
path: root/include/linux/kapi_syscall.h
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2026-10-10 01:31:20 +0100
committerMark Brown <broonie@kernel.org>2026-10-10 01:31:20 +0100
commitdba9716e82ae2c9eacfdc0925360375cd0bb6830 (patch)
treeb0a41f80f6a35a4be3c607e3957a9d08718baca8 /include/linux/kapi_syscall.h
parentc148298f22c67c053bf6507ed092e0ae58a4b2a8 (diff)
parentef777ef05ebcc5ea5393b4bd5af6fc3ad1b3aec9 (diff)
downloadlinux-next-dba9716e82ae2c9eacfdc0925360375cd0bb6830.tar.gz
linux-next-dba9716e82ae2c9eacfdc0925360375cd0bb6830.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 */