summaryrefslogtreecommitdiff
path: root/include/linux/kapi_syscall.h
blob: bc9387e0e052cda209edd0d5663959f01c04cf8c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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 */