signal32.c (5632a9fbcd451892332d45553ce8b831d5143691) | signal32.c (d11c2a0de2824395656cf8ed15811580c9dd38aa) |
---|---|
1/* arch/sparc64/kernel/signal32.c 2 * 3 * Copyright (C) 1991, 1992 Linus Torvalds 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 5 * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx) 6 * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) 7 * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) 8 */ --- 124 unchanged lines hidden (view full) --- 133 if (copy_from_user(to, from, 3*sizeof(int)) || 134 copy_from_user(to->_sifields._pad, from->_sifields._pad, 135 SI_PAD_SIZE)) 136 return -EFAULT; 137 138 return 0; 139} 140 | 1/* arch/sparc64/kernel/signal32.c 2 * 3 * Copyright (C) 1991, 1992 Linus Torvalds 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 5 * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx) 6 * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) 7 * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) 8 */ --- 124 unchanged lines hidden (view full) --- 133 if (copy_from_user(to, from, 3*sizeof(int)) || 134 copy_from_user(to->_sifields._pad, from->_sifields._pad, 135 SI_PAD_SIZE)) 136 return -EFAULT; 137 138 return 0; 139} 140 |
141/* Checks if the fp is valid. We always build signal frames which are 142 * 16-byte aligned, therefore we can always enforce that the restore 143 * frame has that property as well. 144 */ 145static bool invalid_frame_pointer(void __user *fp, int fplen) 146{ 147 if ((((unsigned long) fp) & 15) || 148 ((unsigned long)fp) > 0x100000000ULL - fplen) 149 return true; 150 return false; 151} 152 |
|
141void do_sigreturn32(struct pt_regs *regs) 142{ 143 struct signal_frame32 __user *sf; 144 compat_uptr_t fpu_save; 145 compat_uptr_t rwin_save; | 153void do_sigreturn32(struct pt_regs *regs) 154{ 155 struct signal_frame32 __user *sf; 156 compat_uptr_t fpu_save; 157 compat_uptr_t rwin_save; |
146 unsigned int psr; | 158 unsigned int psr, ufp; |
147 unsigned int pc, npc; 148 sigset_t set; 149 compat_sigset_t seta; 150 int err, i; 151 152 /* Always make any pending restarted system calls return -EINTR */ 153 current->restart_block.fn = do_no_restart_syscall; 154 155 synchronize_user_stack(); 156 157 regs->u_regs[UREG_FP] &= 0x00000000ffffffffUL; 158 sf = (struct signal_frame32 __user *) regs->u_regs[UREG_FP]; 159 160 /* 1. Make sure we are not getting garbage from the user */ | 159 unsigned int pc, npc; 160 sigset_t set; 161 compat_sigset_t seta; 162 int err, i; 163 164 /* Always make any pending restarted system calls return -EINTR */ 165 current->restart_block.fn = do_no_restart_syscall; 166 167 synchronize_user_stack(); 168 169 regs->u_regs[UREG_FP] &= 0x00000000ffffffffUL; 170 sf = (struct signal_frame32 __user *) regs->u_regs[UREG_FP]; 171 172 /* 1. Make sure we are not getting garbage from the user */ |
161 if (!access_ok(VERIFY_READ, sf, sizeof(*sf)) || 162 (((unsigned long) sf) & 3)) | 173 if (invalid_frame_pointer(sf, sizeof(*sf))) |
163 goto segv; 164 | 174 goto segv; 175 |
165 if (get_user(pc, &sf->info.si_regs.pc) || | 176 if (get_user(ufp, &sf->info.si_regs.u_regs[UREG_FP])) 177 goto segv; 178 179 if (ufp & 0x7) 180 goto segv; 181 182 if (__get_user(pc, &sf->info.si_regs.pc) || |
166 __get_user(npc, &sf->info.si_regs.npc)) 167 goto segv; 168 169 if ((pc | npc) & 3) 170 goto segv; 171 172 if (test_thread_flag(TIF_32BIT)) { 173 pc &= 0xffffffff; --- 48 unchanged lines hidden (view full) --- 222 223segv: 224 force_sig(SIGSEGV, current); 225} 226 227asmlinkage void do_rt_sigreturn32(struct pt_regs *regs) 228{ 229 struct rt_signal_frame32 __user *sf; | 183 __get_user(npc, &sf->info.si_regs.npc)) 184 goto segv; 185 186 if ((pc | npc) & 3) 187 goto segv; 188 189 if (test_thread_flag(TIF_32BIT)) { 190 pc &= 0xffffffff; --- 48 unchanged lines hidden (view full) --- 239 240segv: 241 force_sig(SIGSEGV, current); 242} 243 244asmlinkage void do_rt_sigreturn32(struct pt_regs *regs) 245{ 246 struct rt_signal_frame32 __user *sf; |
230 unsigned int psr, pc, npc; | 247 unsigned int psr, pc, npc, ufp; |
231 compat_uptr_t fpu_save; 232 compat_uptr_t rwin_save; 233 sigset_t set; 234 compat_sigset_t seta; 235 int err, i; 236 237 /* Always make any pending restarted system calls return -EINTR */ 238 current->restart_block.fn = do_no_restart_syscall; 239 240 synchronize_user_stack(); 241 regs->u_regs[UREG_FP] &= 0x00000000ffffffffUL; 242 sf = (struct rt_signal_frame32 __user *) regs->u_regs[UREG_FP]; 243 244 /* 1. Make sure we are not getting garbage from the user */ | 248 compat_uptr_t fpu_save; 249 compat_uptr_t rwin_save; 250 sigset_t set; 251 compat_sigset_t seta; 252 int err, i; 253 254 /* Always make any pending restarted system calls return -EINTR */ 255 current->restart_block.fn = do_no_restart_syscall; 256 257 synchronize_user_stack(); 258 regs->u_regs[UREG_FP] &= 0x00000000ffffffffUL; 259 sf = (struct rt_signal_frame32 __user *) regs->u_regs[UREG_FP]; 260 261 /* 1. Make sure we are not getting garbage from the user */ |
245 if (!access_ok(VERIFY_READ, sf, sizeof(*sf)) || 246 (((unsigned long) sf) & 3)) | 262 if (invalid_frame_pointer(sf, sizeof(*sf))) |
247 goto segv; 248 | 263 goto segv; 264 |
249 if (get_user(pc, &sf->regs.pc) || | 265 if (get_user(ufp, &sf->regs.u_regs[UREG_FP])) 266 goto segv; 267 268 if (ufp & 0x7) 269 goto segv; 270 271 if (__get_user(pc, &sf->regs.pc) || |
250 __get_user(npc, &sf->regs.npc)) 251 goto segv; 252 253 if ((pc | npc) & 3) 254 goto segv; 255 256 if (test_thread_flag(TIF_32BIT)) { 257 pc &= 0xffffffff; --- 44 unchanged lines hidden (view full) --- 302 303 set.sig[0] = seta.sig[0] + (((long)seta.sig[1]) << 32); 304 set_current_blocked(&set); 305 return; 306segv: 307 force_sig(SIGSEGV, current); 308} 309 | 272 __get_user(npc, &sf->regs.npc)) 273 goto segv; 274 275 if ((pc | npc) & 3) 276 goto segv; 277 278 if (test_thread_flag(TIF_32BIT)) { 279 pc &= 0xffffffff; --- 44 unchanged lines hidden (view full) --- 324 325 set.sig[0] = seta.sig[0] + (((long)seta.sig[1]) << 32); 326 set_current_blocked(&set); 327 return; 328segv: 329 force_sig(SIGSEGV, current); 330} 331 |
310/* Checks if the fp is valid */ 311static int invalid_frame_pointer(void __user *fp, int fplen) 312{ 313 if ((((unsigned long) fp) & 7) || ((unsigned long)fp) > 0x100000000ULL - fplen) 314 return 1; 315 return 0; 316} 317 | |
318static void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs, unsigned long framesize) 319{ 320 unsigned long sp; 321 322 regs->u_regs[UREG_FP] &= 0x00000000ffffffffUL; 323 sp = regs->u_regs[UREG_FP]; 324 325 /* --- 469 unchanged lines hidden --- | 332static void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs, unsigned long framesize) 333{ 334 unsigned long sp; 335 336 regs->u_regs[UREG_FP] &= 0x00000000ffffffffUL; 337 sp = regs->u_regs[UREG_FP]; 338 339 /* --- 469 unchanged lines hidden --- |