Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[S390] add missing .set function for NT_S390_LAST_BREAK regset

The last breaking event address is a read-only value, the regset misses the
.set function. If a PTRACE_SETREGSET is done for NT_S390_LAST_BREAK we
get an oops due to a branch to zero:

Kernel BUG at 0000000000000002 verbose debug info unavailable
illegal operation: 0001 #1 SMP
...
Call Trace:
(<0000000000158294> ptrace_regset+0x184/0x188)
<00000000001595b6> ptrace_request+0x37a/0x4fc
<0000000000109a78> arch_ptrace+0x108/0x1fc
<00000000001590d6> SyS_ptrace+0xaa/0x12c
<00000000005c7a42> sysc_noemu+0x16/0x1c
<000003fffd5ec10c> 0x3fffd5ec10c
Last Breaking-Event-Address:
<0000000000158242> ptrace_regset+0x132/0x188

Add a nop .set function to prevent the branch to zero.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: stable@kernel.org

+18
+18
arch/s390/kernel/ptrace.c
··· 905 905 return 0; 906 906 } 907 907 908 + static int s390_last_break_set(struct task_struct *target, 909 + const struct user_regset *regset, 910 + unsigned int pos, unsigned int count, 911 + const void *kbuf, const void __user *ubuf) 912 + { 913 + return 0; 914 + } 915 + 908 916 #endif 909 917 910 918 static int s390_system_call_get(struct task_struct *target, ··· 959 951 .size = sizeof(long), 960 952 .align = sizeof(long), 961 953 .get = s390_last_break_get, 954 + .set = s390_last_break_set, 962 955 }, 963 956 #endif 964 957 [REGSET_SYSTEM_CALL] = { ··· 1125 1116 return 0; 1126 1117 } 1127 1118 1119 + static int s390_compat_last_break_set(struct task_struct *target, 1120 + const struct user_regset *regset, 1121 + unsigned int pos, unsigned int count, 1122 + const void *kbuf, const void __user *ubuf) 1123 + { 1124 + return 0; 1125 + } 1126 + 1128 1127 static const struct user_regset s390_compat_regsets[] = { 1129 1128 [REGSET_GENERAL] = { 1130 1129 .core_note_type = NT_PRSTATUS, ··· 1156 1139 .size = sizeof(long), 1157 1140 .align = sizeof(long), 1158 1141 .get = s390_compat_last_break_get, 1142 + .set = s390_compat_last_break_set, 1159 1143 }, 1160 1144 [REGSET_SYSTEM_CALL] = { 1161 1145 .core_note_type = NT_S390_SYSTEM_CALL,