Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c49b6ecf authored by Phil Edworthy's avatar Phil Edworthy Committed by Paul Mundt
Browse files

sh: Fix ptrace fpu state initialisation



Commit 0ea820cf introduced the PTRACE_GETFPREGS/SETFPREGS cmds,
but gdb-server still accesses the FPU state using the
PTRACE_PEEKUSR/POKEUSR commands. In this case, xstate was not
initialised.

Signed-off-by: default avatarPhil Edworthy <phil.edworthy@renesas.com>
Cc: stable@kernel.org
Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent 3f4caa81
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -392,6 +392,9 @@ long arch_ptrace(struct task_struct *child, long request,
					tmp = 0;
			} else {
				unsigned long index;
				ret = init_fpu(child);
				if (ret)
					break;
				index = addr - offsetof(struct user, fpu);
				tmp = ((unsigned long *)child->thread.xstate)
					[index >> 2];
@@ -423,6 +426,9 @@ long arch_ptrace(struct task_struct *child, long request,
		else if (addr >= offsetof(struct user, fpu) &&
			 addr < offsetof(struct user, u_fpvalid)) {
			unsigned long index;
			ret = init_fpu(child);
			if (ret)
				break;
			index = addr - offsetof(struct user, fpu);
			set_stopped_child_used_math(child);
			((unsigned long *)child->thread.xstate)
+6 −0
Original line number Diff line number Diff line
@@ -403,6 +403,9 @@ long arch_ptrace(struct task_struct *child, long request,
		else if ((addr >= offsetof(struct user, fpu)) &&
			 (addr <  offsetof(struct user, u_fpvalid))) {
			unsigned long index;
			ret = init_fpu(child);
			if (ret)
				break;
			index = addr - offsetof(struct user, fpu);
			tmp = get_fpu_long(child, index);
		} else if (addr == offsetof(struct user, u_fpvalid)) {
@@ -442,6 +445,9 @@ long arch_ptrace(struct task_struct *child, long request,
		else if ((addr >= offsetof(struct user, fpu)) &&
			 (addr <  offsetof(struct user, u_fpvalid))) {
			unsigned long index;
			ret = init_fpu(child);
			if (ret)
				break;
			index = addr - offsetof(struct user, fpu);
			ret = put_fpu_long(child, index, data);
		}