/linux/tools/testing/selftests/bpf/progs/ |
H A D | string_kfuncs_failure1.c | 32 SEC("syscall") __retval(USER_PTR_ERR) int test_strcmp_null1(void *ctx) { return bpf_strcmp(NULL, "h… in __retval() 33 SEC("syscall") __retval(USER_PTR_ERR)int test_strcmp_null2(void *ctx) { return bpf_strcmp("hello",… in __retval() 34 SEC("syscall") __retval(USER_PTR_ERR)int test_strchr_null(void *ctx) { return bpf_strchr(NULL, 'a'… in __retval() 35 SEC("syscall") __retval(USER_PTR_ERR)int test_strchrnul_null(void *ctx) { return bpf_strchrnul(NUL… in __retval() 36 SEC("syscall") __retval(USER_PTR_ERR)int test_strnchr_null(void *ctx) { return bpf_strnchr(NULL, 1… in __retval() 37 SEC("syscall") __retval(USER_PTR_ERR)int test_strrchr_null(void *ctx) { return bpf_strrchr(NULL, '… in __retval() 38 SEC("syscall") __retval(USER_PTR_ERR)int test_strlen_null(void *ctx) { return bpf_strlen(NULL); } in __retval() 39 SEC("syscall") __retval(USER_PTR_ERR)int test_strnlen_null(void *ctx) { return bpf_strnlen(NULL, 1… in __retval() 40 SEC("syscall") __retval(USER_PTR_ERR)int test_strspn_null1(void *ctx) { return bpf_strspn(NULL, "h… in __retval() 41 SEC("syscall") __retval(USER_PTR_ERR)int test_strspn_null2(void *ctx) { return bpf_strspn("hello",… in __retval() [all …]
|
H A D | string_kfuncs_failure2.c | 9 SEC("syscall") int test_strcmp_too_long(void *ctx) { return bpf_strcmp(long_str, long_str); } in test_strcmp_too_long() 10 SEC("syscall") int test_strchr_too_long(void *ctx) { return bpf_strchr(long_str, 'b'); } in test_strchr_too_long() 11 SEC("syscall") int test_strchrnul_too_long(void *ctx) { return bpf_strchrnul(long_str, 'b'); } in test_strchrnul_too_long() 12 SEC("syscall") int test_strnchr_too_long(void *ctx) { return bpf_strnchr(long_str, sizeof(long_str)… in test_strnchr_too_long() 13 SEC("syscall") int test_strrchr_too_long(void *ctx) { return bpf_strrchr(long_str, 'b'); } in test_strrchr_too_long() 14 SEC("syscall") int test_strlen_too_long(void *ctx) { return bpf_strlen(long_str); } in test_strlen_too_long() 15 SEC("syscall") int test_strnlen_too_long(void *ctx) { return bpf_strnlen(long_str, sizeof(long_str)… in test_strnlen_too_long() 16 SEC("syscall") int test_strspn_str_too_long(void *ctx) { return bpf_strspn(long_str, "a"); } in test_strspn_str_too_long() 17 SEC("syscall") int test_strspn_accept_too_long(void *ctx) { return bpf_strspn("b", long_str); } in test_strspn_accept_too_long() 18 SEC("syscall") int test_strcspn_str_too_long(void *ctx) { return bpf_strcspn(long_str, "b"); } in test_strcspn_str_too_long() [all …]
|
H A D | sock_addr_kern.c | 7 SEC("syscall") 15 SEC("syscall") 23 SEC("syscall") 29 SEC("syscall") 35 SEC("syscall") 41 SEC("syscall") 47 SEC("syscall") 53 SEC("syscall") 59 SEC("syscall")
|
/linux/include/linux/ |
H A D | entry-common.h | 13 #include <asm/syscall.h> 51 * Invoked from architecture specific syscall entry code with interrupts 64 long syscall_trace_enter(struct pt_regs *regs, long syscall, 69 * a syscall 71 * @syscall: The syscall number 73 * Invoked from architecture specific syscall entry code with interrupts 77 * Returns: The original or a modified syscall number 79 * If the returned syscall number is -1 then the syscall should be 82 * is returned, then the syscall will fail with ENOSYS. 90 static __always_inline long syscall_enter_from_user_mode_work(struct pt_regs *regs, long syscall) in syscall_enter_from_user_mode_work() argument [all …]
|
/linux/arch/x86/um/shared/sysdep/ |
H A D | stub_64.h | 19 #define __syscall "syscall" 21 static __always_inline long stub_syscall0(long syscall) in stub_syscall0() argument 27 : "0" (syscall) : __syscall_clobber ); in stub_syscall0() 32 static __always_inline long stub_syscall1(long syscall, long arg1) in stub_syscall1() argument 38 : "0" (syscall), "D" (arg1) : __syscall_clobber ); in stub_syscall1() 43 static __always_inline long stub_syscall2(long syscall, long arg1, long arg2) in stub_syscall2() argument 49 : "0" (syscall), "D" (arg1), "S" (arg2) : __syscall_clobber ); in stub_syscall2() 54 static __always_inline long stub_syscall3(long syscall, long arg1, long arg2, in stub_syscall3() argument 61 : "0" (syscall), "D" (arg1), "S" (arg2), "d" (arg3) in stub_syscall3() 67 static __always_inline long stub_syscall4(long syscall, long arg1, long arg2, long arg3, in stub_syscall4() argument [all …]
|
H A D | stub_32.h | 16 static __always_inline long stub_syscall0(long syscall) in stub_syscall0() argument 20 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall) in stub_syscall0() 26 static __always_inline long stub_syscall1(long syscall, long arg1) in stub_syscall1() argument 30 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1) in stub_syscall1() 36 static __always_inline long stub_syscall2(long syscall, long arg1, long arg2) in stub_syscall2() argument 40 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1), in stub_syscall2() 47 static __always_inline long stub_syscall3(long syscall, long arg1, long arg2, in stub_syscall3() argument 52 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1), in stub_syscall3() 59 static __always_inline long stub_syscall4(long syscall, long arg1, long arg2, in stub_syscall4() argument 64 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1), in stub_syscall4() [all …]
|
/linux/arch/mips/kernel/ |
H A D | scall64-o32.S | 34 ld t1, PT_EPC(sp) # skip syscall on return 36 dsubu t0, v0, __NR_O32_Linux # check syscall number 55 sd a3, PT_R26(sp) # save a3 for syscall restarting 83 * absolute syscall number is in v0 unless we called syscall(__NR_###) 84 * where the real syscall number is in a0 85 * note: NR_syscall is the first O32 syscall but the macro is 92 LONG_S a0, TI_SYSCALL($28) # Save a0 as syscall number 95 LONG_S v0, TI_SYSCALL($28) # Save v0 as syscall number 99 LONG_L t0, TI_FLAGS($28) # syscall tracing enabled? 114 ld t1, PT_R2(sp) # syscall number [all …]
|
H A D | scall64-n32.S | 35 dsubu t0, v0, __NR_N32_Linux # check syscall number 39 ld t1, PT_EPC(sp) # skip syscall on return 45 sd a3, PT_R26(sp) # save a3 for syscall restarting 47 LONG_S v0, TI_SYSCALL($28) # Store syscall number 50 LONG_L t0, TI_FLAGS($28) # syscall tracing enabled? 65 ld t1, PT_R2(sp) # syscall number 67 sd t1, PT_R0(sp) # save it for syscall restarting 79 bltz v0, 1f # seccomp failed? Skip syscall 82 ld v0, PT_R2(sp) # Restore syscall (maybe modified) 90 dsubu t2, v0, __NR_N32_Linux # check (new) syscall number [all …]
|
H A D | scall32-o32.S | 32 lw t1, PT_EPC(sp) # skip syscall on return 37 sw a3, PT_R26(sp) # save a3 for syscall restarting 81 * syscall number is in v0 unless we called syscall(__NR_###) 82 * where the real syscall number is in a0 86 LONG_S a0, TI_SYSCALL($28) # Save a0 as syscall number 89 LONG_S v0, TI_SYSCALL($28) # Save v0 as syscall number 92 lw t0, TI_FLAGS($28) # syscall tracing enabled? 97 subu v0, v0, __NR_O32_Linux # check syscall number 104 lw t2, (t1) # syscall routine 115 lw t1, PT_R2(sp) # syscall number [all …]
|
H A D | scall64-n64.S | 42 ld t1, PT_EPC(sp) # skip syscall on return 47 sd a3, PT_R26(sp) # save a3 for syscall restarting 49 LONG_S v0, TI_SYSCALL($28) # Store syscall number 52 LONG_L t0, TI_FLAGS($28) # syscall tracing enabled? 64 ld t2, (t0) # syscall routine 74 ld t1, PT_R2(sp) # syscall number 76 sd t1, PT_R0(sp) # save it for syscall restarting 89 bltz v0, 1f # seccomp failed? Skip syscall 92 ld v0, PT_R2(sp) # Restore syscall (maybe modified) 104 /* This also isn't a 64-bit syscall, throw an error. */
|
/linux/kernel/entry/ |
H A D | syscall-common.c | 10 static inline void syscall_enter_audit(struct pt_regs *regs, long syscall) in syscall_enter_audit() argument 16 audit_syscall_entry(syscall, args[0], args[1], args[2], args[3]); in syscall_enter_audit() 20 long syscall_trace_enter(struct pt_regs *regs, long syscall, in syscall_trace_enter() argument 26 * Handle Syscall User Dispatch. This must comes first, since in syscall_trace_enter() 49 /* Either of the above might have changed the syscall number */ in syscall_trace_enter() 50 syscall = syscall_get_nr(current, regs); in syscall_trace_enter() 53 trace_sys_enter(regs, syscall); in syscall_trace_enter() 58 syscall = syscall_get_nr(current, regs); in syscall_trace_enter() 61 syscall_enter_audit(regs, syscall); in syscall_trace_enter() 63 return ret ? : syscall; in syscall_trace_enter() [all …]
|
/linux/Documentation/admin-guide/ |
H A D | syscall-user-dispatch.rst | 4 Syscall User Dispatch 18 Syscall User Dispatch brings the filtering of the syscall dispatcher 23 boundaries, to enable/disable the syscall redirection and execute 28 boundary crosses, which is achieved by not executing a syscall to change 41 ABI is completely unexpected to Linux. Syscall User Dispatch, therefore 42 doesn't rely on any of the syscall ABI to make the filtering. It uses 43 only the syscall dispatcher address and the userspace key. 46 syscalls are not instrumentable via ptrace or the syscall tracepoints. 63 C library, which includes the most common syscall dispatchers in the native 76 region, that provides a quick way to enable disable syscall redirection [all …]
|
/linux/arch/arm/kernel/ |
H A D | entry-common.S | 35 * This is the fast syscall return path. We do as little as possible here, 45 ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing 75 ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing 88 mov r2, why @ 'syscall' 99 * "slow" syscall return path. "why" tells us if this was a real syscall. 217 * Pure EABI user space always put syscall number into scno (r7). 235 adr tbl, sys_call_table @ load syscall table pointer 241 * If this is an old ABI call, get the syscall number into scno and 242 * get the old ABI syscall table address. 258 * the syscall assembly (by tracing or context tracking.) [all …]
|
/linux/tools/perf/tests/shell/ |
H A D | trace_btf_enum.sh | 7 syscall="landlock_add_rule" 27 echo "Tracing syscall ${syscall}" 32 echo "No landlock system call found, skipping to non-syscall tracing." 36 output="$(perf trace -e $syscall $TESTPROG 2>&1)" 41 printf "[syscall failure] Failed to trace syscall $syscall, output:\n$output\n" 47 echo "Tracing non-syscall tracepoint ${non_syscall}"
|
/linux/tools/perf/ |
H A D | check-headers.sh | 72 "scripts/syscall.tbl" 84 # tables that then gets included in .c files for things like id->string syscall 198 check_2 tools/perf/arch/powerpc/entry/syscalls/syscall.tbl arch/powerpc/kernel/syscalls/syscall.tbl 199 check_2 tools/perf/arch/s390/entry/syscalls/syscall.tbl arch/s390/kernel/syscalls/syscall.tbl 201 check_2 tools/perf/arch/arm/entry/syscalls/syscall.tbl arch/arm/tools/syscall.tbl 202 check_2 tools/perf/arch/sh/entry/syscalls/syscall.tbl arch/sh/kernel/syscalls/syscall.tbl 203 check_2 tools/perf/arch/sparc/entry/syscalls/syscall.tbl arch/sparc/kernel/syscalls/syscall.tbl 204 check_2 tools/perf/arch/xtensa/entry/syscalls/syscall.tbl arch/xtensa/kernel/syscalls/syscall.tbl 205 check_2 tools/perf/arch/alpha/entry/syscalls/syscall.tbl arch/alpha/entry/syscalls/syscall.tbl 206 check_2 tools/perf/arch/parisc/entry/syscalls/syscall.tbl arch/parisc/entry/syscalls/syscall.tbl
|
/linux/tools/testing/selftests/syscall_user_dispatch/ |
H A D | sud_benchmark.c | 5 * Benchmark and test syscall user dispatch 19 #include <sys/syscall.h> 30 # define MAGIC_SYSCALL_1 (__NR_syscalls + 1) /* Bad Linux syscall number */ 32 # define MAGIC_SYSCALL_1 (0xff00) /* Bad Linux syscall number */ 41 * out of the box, but don't enable them until they support syscall user 129 __asm__ volatile("syscall"); in handle_sigsys() 153 printf("Avg syscall time %.0lfns.\n", time1 * 1.0e9); in main() 161 fprintf(stderr, "Enabling syscall trapping.\n"); in main() 172 syscall(MAGIC_SYSCALL_1); in main() 184 fprintf(stderr, "syscall trapping does not work.\n"); in main() [all …]
|
H A D | sud_test.c | 5 * Test code for syscall user dispatch 11 #include <sys/syscall.h> 36 # define MAGIC_SYSCALL_1 (__NR_syscalls + 1) /* Bad Linux syscall number */ 38 # define MAGIC_SYSCALL_1 (0xff00) /* Bad Linux syscall number */ 47 * able to trigger SIGSYS on a syscall. 55 * - dispatch_and_return: Test that a syscall is selectively dispatched 61 * - direct_dispatch_range: Test that a syscall within the allowed range 183 * The tests for argument handling assume that `syscall(x) == x`. This in handle_sigsys() 184 * is a NOP on x86 because the syscall number is passed in %rax, which in handle_sigsys() 231 ret = syscall(MAGIC_SYSCALL_1); in TEST() [all …]
|
/linux/tools/testing/selftests/powerpc/ptrace/ |
H A D | ptrace-syscall.c | 16 #include <sys/syscall.h> 59 printf("[RUN]\tptrace-induced syscall restart\n"); in test_ptrace_syscall_restart() 77 pid_t pid = getpid(), tid = syscall(SYS_gettid); in test_ptrace_syscall_restart() 79 printf("\tChild will make one syscall\n"); in test_ptrace_syscall_restart() 80 syscall(SYS_tgkill, pid, tid, SIGSTOP); in test_ptrace_syscall_restart() 82 syscall(SYS_gettid, 10, 11, 12, 13, 14, 15); in test_ptrace_syscall_restart() 100 * Ptrace trapped prior to executing the syscall, thus r3 still has in test_ptrace_syscall_restart() 101 * the syscall number instead of the sys_gettid() result in test_ptrace_syscall_restart() 119 printf("[RUN]\tRestart the syscall (ip = 0x%lx)\n", in test_ptrace_syscall_restart() 123 * Rewind to retry the same syscall again. This will basically test in test_ptrace_syscall_restart() [all …]
|
/linux/Documentation/arch/powerpc/ |
H A D | syscall64-abi.rst | 5 syscall chapter 10 The syscall is made with the sc instruction, and returns with execution 17 syscall calling sequence\ [1]_ matches the Power Architecture 64-bit ELF ABI 28 There is a maximum of 6 integer parameters to a syscall, passed in r3-r8. 34 clear, the syscall succeeded and r3 is the return value. When cr0.SO is set, 35 the syscall failed and r3 is the error value (that normally corresponds to 87 Syscall behavior can change if the processor is in transactional or suspended 88 transaction state, and the syscall can affect the behavior of the transaction. 90 If the processor is in suspended state when a syscall is made, the syscall 91 will be performed as normal, and will return as normal. The syscall will be [all …]
|
/linux/arch/um/kernel/skas/ |
H A D | syscall.c | 13 #include <asm/syscall.h> 20 int syscall; in handle_syscall() local 22 /* Initialize the syscall number and default return value. */ in handle_syscall() 33 syscall = UPT_SYSCALL_NR(r); in handle_syscall() 42 syscall == __NR_sched_yield) in handle_syscall() 45 if (syscall >= 0 && syscall < __NR_syscalls) { in handle_syscall() 48 ret = (*sys_call_table[syscall])(UPT_SYSCALL_ARG1(®s->regs), in handle_syscall()
|
/linux/arch/mips/include/asm/ |
H A D | syscall.h | 8 * See asm-generic/syscall.h for descriptions of what we must do here. 32 /* O32 ABI syscall() - Either 64-bit with O32 or 32-bit */ in mips_syscall_is_indirect() 41 return task_thread_info(task)->syscall; in syscall_get_nr() 49 * New syscall number has to be assigned to regs[2] because in syscall_set_nr() 53 * Consequently, if the syscall was indirect and nr != __NR_syscall, in syscall_set_nr() 54 * then after this assignment the syscall will cease to be indirect. in syscall_set_nr() 56 task_thread_info(task)->syscall = regs->regs[2] = nr; in syscall_set_nr() 63 * v0 is the system call number, except for O32 ABI syscall(), where it in mips_syscall_update_nr() 67 task_thread_info(task)->syscall = regs->regs[4]; in mips_syscall_update_nr() 69 task_thread_info(task)->syscall = regs->regs[2]; in mips_syscall_update_nr() [all …]
|
/linux/samples/seccomp/ |
H A D | bpf-fancy.c | 38 SYSCALL(__NR_exit, ALLOW), in main() 39 SYSCALL(__NR_exit_group, ALLOW), in main() 40 SYSCALL(__NR_write, JUMP(&l, write_fd)), in main() 41 SYSCALL(__NR_read, JUMP(&l, read)), in main() 97 syscall(__NR_write, STDOUT_FILENO, msg1, strlen(msg1)); in main() 98 bytes = syscall(__NR_read, STDIN_FILENO, buf, sizeof(buf)-1); in main() 100 syscall(__NR_write, STDERR_FILENO, msg2, strlen(msg2)); in main() 101 syscall(__NR_write, STDERR_FILENO, buf, bytes); in main() 103 syscall(__NR_write, STDERR_FILENO, msg2, strlen(msg2)+2); in main()
|
/linux/tools/include/nolibc/ |
H A D | arch-loongarch.h | 15 * - syscall number is passed in a7 17 * - the system call is performed by calling "syscall 0" 18 * - syscall return comes in a0 33 "syscall 0\n" \ 47 "syscall 0\n" \ 62 "syscall 0\n" \ 79 "syscall 0\n" \ 97 "syscall 0\n" \ 116 "syscall 0\n" \ 136 "syscall 0\n" \
|
/linux/kernel/ |
H A D | audit.h | 26 a per-task filter. At syscall entry, the audit_state is augmented by 27 the syscall filter. */ 30 * No syscall-specific audit records can 33 * and fill it in at syscall 35 * syscall record available if some 39 * always fill it in at syscall entry 41 * record at syscall exit time. */ 92 * should be freed on syscall exit. 107 AUDIT_CTX_SYSCALL, /* in use by syscall */ 112 int major; /* syscall number */ [all …]
|
/linux/tools/testing/selftests/landlock/ |
H A D | wrappers.h | 3 * Syscall wrappers 12 #include <sys/syscall.h> 21 return syscall(__NR_landlock_create_ruleset, attr, size, flags); in landlock_create_ruleset() 31 return syscall(__NR_landlock_add_rule, ruleset_fd, rule_type, rule_attr, in landlock_add_rule() 40 return syscall(__NR_landlock_restrict_self, ruleset_fd, flags); in landlock_restrict_self() 46 return syscall(__NR_gettid); in sys_gettid()
|