ptrace.c (12c3dca25d2fa17a101de0d80bf3f238b1cecbae) | ptrace.c (4e57a4ddf6b0d9cce1cf2ffd153df1ad3c2c9cc2) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * linux/arch/arm/kernel/ptrace.c 4 * 5 * By Ross Biro 1/23/92 6 * edited by Linus Torvalds 7 * ARM modifications Copyright (C) 2000 Russell King 8 */ --- 11 unchanged lines hidden (view full) --- 20#include <linux/uaccess.h> 21#include <linux/perf_event.h> 22#include <linux/hw_breakpoint.h> 23#include <linux/regset.h> 24#include <linux/audit.h> 25#include <linux/tracehook.h> 26#include <linux/unistd.h> 27 | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * linux/arch/arm/kernel/ptrace.c 4 * 5 * By Ross Biro 1/23/92 6 * edited by Linus Torvalds 7 * ARM modifications Copyright (C) 2000 Russell King 8 */ --- 11 unchanged lines hidden (view full) --- 20#include <linux/uaccess.h> 21#include <linux/perf_event.h> 22#include <linux/hw_breakpoint.h> 23#include <linux/regset.h> 24#include <linux/audit.h> 25#include <linux/tracehook.h> 26#include <linux/unistd.h> 27 |
28#include <asm/syscall.h> |
|
28#include <asm/traps.h> 29 30#define CREATE_TRACE_POINTS 31#include <trace/events/syscalls.h> 32 33#define REG_PC 15 34#define REG_PSR 16 35/* --- 277 unchanged lines hidden (view full) --- 313 return -EACCES; 314 iwmmxt_task_release(thread); /* force a reload */ 315 return copy_from_user(&thread->fpstate.iwmmxt, ufp, IWMMXT_SIZE) 316 ? -EFAULT : 0; 317} 318 319#endif 320 | 29#include <asm/traps.h> 30 31#define CREATE_TRACE_POINTS 32#include <trace/events/syscalls.h> 33 34#define REG_PC 15 35#define REG_PSR 16 36/* --- 277 unchanged lines hidden (view full) --- 314 return -EACCES; 315 iwmmxt_task_release(thread); /* force a reload */ 316 return copy_from_user(&thread->fpstate.iwmmxt, ufp, IWMMXT_SIZE) 317 ? -EFAULT : 0; 318} 319 320#endif 321 |
322#ifdef CONFIG_CRUNCH 323/* 324 * Get the child Crunch state. 325 */ 326static int ptrace_getcrunchregs(struct task_struct *tsk, void __user *ufp) 327{ 328 struct thread_info *thread = task_thread_info(tsk); 329 330 crunch_task_disable(thread); /* force it to ram */ 331 return copy_to_user(ufp, &thread->crunchstate, CRUNCH_SIZE) 332 ? -EFAULT : 0; 333} 334 335/* 336 * Set the child Crunch state. 337 */ 338static int ptrace_setcrunchregs(struct task_struct *tsk, void __user *ufp) 339{ 340 struct thread_info *thread = task_thread_info(tsk); 341 342 crunch_task_release(thread); /* force a reload */ 343 return copy_from_user(&thread->crunchstate, ufp, CRUNCH_SIZE) 344 ? -EFAULT : 0; 345} 346#endif 347 |
|
321#ifdef CONFIG_HAVE_HW_BREAKPOINT 322/* 323 * Convert a virtual register number into an index for a thread_info 324 * breakpoint array. Breakpoints are identified using positive numbers 325 * whilst watchpoints are negative. The registers are laid out as pairs 326 * of (address, control), each pair mapping to a unique hw_breakpoint struct. 327 * Register 0 is reserved for describing resource information. 328 */ --- 451 unchanged lines hidden (view full) --- 780#endif 781 782 case PTRACE_GET_THREAD_AREA: 783 ret = put_user(task_thread_info(child)->tp_value[0], 784 datap); 785 break; 786 787 case PTRACE_SET_SYSCALL: | 348#ifdef CONFIG_HAVE_HW_BREAKPOINT 349/* 350 * Convert a virtual register number into an index for a thread_info 351 * breakpoint array. Breakpoints are identified using positive numbers 352 * whilst watchpoints are negative. The registers are laid out as pairs 353 * of (address, control), each pair mapping to a unique hw_breakpoint struct. 354 * Register 0 is reserved for describing resource information. 355 */ --- 451 unchanged lines hidden (view full) --- 807#endif 808 809 case PTRACE_GET_THREAD_AREA: 810 ret = put_user(task_thread_info(child)->tp_value[0], 811 datap); 812 break; 813 814 case PTRACE_SET_SYSCALL: |
788 task_thread_info(child)->syscall = data; | 815 task_thread_info(child)->abi_syscall = data & 816 __NR_SYSCALL_MASK; |
789 ret = 0; 790 break; 791 | 817 ret = 0; 818 break; 819 |
820#ifdef CONFIG_CRUNCH 821 case PTRACE_GETCRUNCHREGS: 822 ret = ptrace_getcrunchregs(child, datap); 823 break; 824 825 case PTRACE_SETCRUNCHREGS: 826 ret = ptrace_setcrunchregs(child, datap); 827 break; 828#endif 829 |
|
792#ifdef CONFIG_VFP 793 case PTRACE_GETVFPREGS: 794 ret = copy_regset_to_user(child, 795 &user_arm_view, REGSET_VFP, 796 0, ARM_VFPREGS_SIZE, 797 datap); 798 break; 799 --- 39 unchanged lines hidden (view full) --- 839 * IP = 0 -> entry, =1 -> exit 840 */ 841 ip = regs->ARM_ip; 842 regs->ARM_ip = dir; 843 844 if (dir == PTRACE_SYSCALL_EXIT) 845 tracehook_report_syscall_exit(regs, 0); 846 else if (tracehook_report_syscall_entry(regs)) | 830#ifdef CONFIG_VFP 831 case PTRACE_GETVFPREGS: 832 ret = copy_regset_to_user(child, 833 &user_arm_view, REGSET_VFP, 834 0, ARM_VFPREGS_SIZE, 835 datap); 836 break; 837 --- 39 unchanged lines hidden (view full) --- 877 * IP = 0 -> entry, =1 -> exit 878 */ 879 ip = regs->ARM_ip; 880 regs->ARM_ip = dir; 881 882 if (dir == PTRACE_SYSCALL_EXIT) 883 tracehook_report_syscall_exit(regs, 0); 884 else if (tracehook_report_syscall_entry(regs)) |
847 current_thread_info()->syscall = -1; | 885 current_thread_info()->abi_syscall = -1; |
848 849 regs->ARM_ip = ip; 850} 851 | 886 887 regs->ARM_ip = ip; 888} 889 |
852asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno) | 890asmlinkage int syscall_trace_enter(struct pt_regs *regs) |
853{ | 891{ |
854 current_thread_info()->syscall = scno; | 892 int scno; |
855 856 if (test_thread_flag(TIF_SYSCALL_TRACE)) 857 tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER); 858 859 /* Do seccomp after ptrace; syscall may have changed. */ 860#ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER 861 if (secure_computing() == -1) 862 return -1; 863#else 864 /* XXX: remove this once OABI gets fixed */ | 893 894 if (test_thread_flag(TIF_SYSCALL_TRACE)) 895 tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER); 896 897 /* Do seccomp after ptrace; syscall may have changed. */ 898#ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER 899 if (secure_computing() == -1) 900 return -1; 901#else 902 /* XXX: remove this once OABI gets fixed */ |
865 secure_computing_strict(current_thread_info()->syscall); | 903 secure_computing_strict(syscall_get_nr(current, regs)); |
866#endif 867 868 /* Tracer or seccomp may have changed syscall. */ | 904#endif 905 906 /* Tracer or seccomp may have changed syscall. */ |
869 scno = current_thread_info()->syscall; | 907 scno = syscall_get_nr(current, regs); |
870 871 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) 872 trace_sys_enter(regs, scno); 873 874 audit_syscall_entry(scno, regs->ARM_r0, regs->ARM_r1, regs->ARM_r2, 875 regs->ARM_r3); 876 877 return scno; --- 22 unchanged lines hidden --- | 908 909 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) 910 trace_sys_enter(regs, scno); 911 912 audit_syscall_entry(scno, regs->ARM_r0, regs->ARM_r1, regs->ARM_r2, 913 regs->ARM_r3); 914 915 return scno; --- 22 unchanged lines hidden --- |