These are all tracing W=1 warnings in arm64 allmodconfig about missing prototypes: kernel/trace/trace_kprobe_selftest.c:7:5: error: no previous prototype for 'kprobe_trace_selftest_target' [-Werror=missing-pro totypes] kernel/trace/ftrace.c:329:5: error: no previous prototype for '__register_ftrace_function' [-Werror=missing-prototypes] kernel/trace/ftrace.c:372:5: error: no previous prototype for '__unregister_ftrace_function' [-Werror=missing-prototypes] kernel/trace/ftrace.c:4130:15: error: no previous prototype for 'arch_ftrace_match_adjust' [-Werror=missing-prototypes] kernel/trace/fgraph.c:243:15: error: no previous prototype for 'ftrace_return_to_handler' [-Werror=missing-prototypes] kernel/trace/fgraph.c:358:6: error: no previous prototype for 'ftrace_graph_sleep_time_control' [-Werror=missing-prototypes] arch/arm64/kernel/ftrace.c:460:6: error: no previous prototype for 'prepare_ftrace_return' [-Werror=missing-prototypes] arch/arm64/kernel/ptrace.c:2172:5: error: no previous prototype for 'syscall_trace_enter' [-Werror=missing-prototypes] arch/arm64/kernel/ptrace.c:2195:6: error: no previous prototype for 'syscall_trace_exit' [-Werror=missing-prototypes] Move the declarations to an appropriate header where they can be seen by the caller and callee, and make sure the headers are included where needed. Link: https://lore.kernel.org/linux-trace-kernel/20230517125215.930689-1-arnd@kernel.org Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Will Deacon <will@kernel.org> Cc: Kees Cook <keescook@chromium.org> Cc: Florent Revest <revest@chromium.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Catalin Marinas <catalin.marinas@arm.com> [ Fixed ftrace_return_to_handler() to handle CONFIG_HAVE_FUNCTION_GRAPH_RETVAL case ] Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
91 lines
2 KiB
C
91 lines
2 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright (C) 2012 ARM Ltd.
|
|
*/
|
|
#ifndef __ASM_SYSCALL_H
|
|
#define __ASM_SYSCALL_H
|
|
|
|
#include <uapi/linux/audit.h>
|
|
#include <linux/compat.h>
|
|
#include <linux/err.h>
|
|
|
|
typedef long (*syscall_fn_t)(const struct pt_regs *regs);
|
|
|
|
extern const syscall_fn_t sys_call_table[];
|
|
|
|
#ifdef CONFIG_COMPAT
|
|
extern const syscall_fn_t compat_sys_call_table[];
|
|
#endif
|
|
|
|
static inline int syscall_get_nr(struct task_struct *task,
|
|
struct pt_regs *regs)
|
|
{
|
|
return regs->syscallno;
|
|
}
|
|
|
|
static inline void syscall_rollback(struct task_struct *task,
|
|
struct pt_regs *regs)
|
|
{
|
|
regs->regs[0] = regs->orig_x0;
|
|
}
|
|
|
|
static inline long syscall_get_return_value(struct task_struct *task,
|
|
struct pt_regs *regs)
|
|
{
|
|
unsigned long val = regs->regs[0];
|
|
|
|
if (is_compat_thread(task_thread_info(task)))
|
|
val = sign_extend64(val, 31);
|
|
|
|
return val;
|
|
}
|
|
|
|
static inline long syscall_get_error(struct task_struct *task,
|
|
struct pt_regs *regs)
|
|
{
|
|
unsigned long error = syscall_get_return_value(task, regs);
|
|
|
|
return IS_ERR_VALUE(error) ? error : 0;
|
|
}
|
|
|
|
static inline void syscall_set_return_value(struct task_struct *task,
|
|
struct pt_regs *regs,
|
|
int error, long val)
|
|
{
|
|
if (error)
|
|
val = error;
|
|
|
|
if (is_compat_thread(task_thread_info(task)))
|
|
val = lower_32_bits(val);
|
|
|
|
regs->regs[0] = val;
|
|
}
|
|
|
|
#define SYSCALL_MAX_ARGS 6
|
|
|
|
static inline void syscall_get_arguments(struct task_struct *task,
|
|
struct pt_regs *regs,
|
|
unsigned long *args)
|
|
{
|
|
args[0] = regs->orig_x0;
|
|
args++;
|
|
|
|
memcpy(args, ®s->regs[1], 5 * sizeof(args[0]));
|
|
}
|
|
|
|
/*
|
|
* We don't care about endianness (__AUDIT_ARCH_LE bit) here because
|
|
* AArch64 has the same system calls both on little- and big- endian.
|
|
*/
|
|
static inline int syscall_get_arch(struct task_struct *task)
|
|
{
|
|
if (is_compat_thread(task_thread_info(task)))
|
|
return AUDIT_ARCH_ARM;
|
|
|
|
return AUDIT_ARCH_AARCH64;
|
|
}
|
|
|
|
int syscall_trace_enter(struct pt_regs *regs);
|
|
void syscall_trace_exit(struct pt_regs *regs);
|
|
|
|
#endif /* __ASM_SYSCALL_H */
|