ptrace_machdep.c (274817) | ptrace_machdep.c (278976) |
---|---|
1/*- 2 * Copyright (c) 2011 Konstantin Belousov <kib@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 */ 27 28#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2011 Konstantin Belousov <kib@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 */ 27 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/sys/amd64/amd64/ptrace_machdep.c 274817 2014-11-21 20:53:17Z jhb $"); | 29__FBSDID("$FreeBSD: head/sys/amd64/amd64/ptrace_machdep.c 278976 2015-02-18 23:34:03Z jhb $"); |
30 31#include "opt_compat.h" 32 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/malloc.h> 36#include <sys/proc.h> 37#include <sys/ptrace.h> --- 45 unchanged lines hidden (view full) --- 83 84 case PT_GETXSTATE: 85 fpugetregs(td); 86 savefpu = (char *)(get_pcb_user_save_td(td)); 87 error = copyout(savefpu, addr, cpu_max_ext_state_size); 88 break; 89 90 case PT_SETXSTATE: | 30 31#include "opt_compat.h" 32 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/malloc.h> 36#include <sys/proc.h> 37#include <sys/ptrace.h> --- 45 unchanged lines hidden (view full) --- 83 84 case PT_GETXSTATE: 85 fpugetregs(td); 86 savefpu = (char *)(get_pcb_user_save_td(td)); 87 error = copyout(savefpu, addr, cpu_max_ext_state_size); 88 break; 89 90 case PT_SETXSTATE: |
91 if (data > cpu_max_ext_state_size) { | 91 if (data < sizeof(struct savefpu) || 92 data > cpu_max_ext_state_size) { |
92 error = EINVAL; 93 break; 94 } 95 savefpu = malloc(data, M_TEMP, M_WAITOK); 96 error = copyin(addr, savefpu, data); 97 if (error == 0) 98 error = fpusetregs(td, (struct savefpu *)savefpu, 99 savefpu + sizeof(struct savefpu), data - --- 85 unchanged lines hidden --- | 93 error = EINVAL; 94 break; 95 } 96 savefpu = malloc(data, M_TEMP, M_WAITOK); 97 error = copyin(addr, savefpu, data); 98 if (error == 0) 99 error = fpusetregs(td, (struct savefpu *)savefpu, 100 savefpu + sizeof(struct savefpu), data - --- 85 unchanged lines hidden --- |