MIPS: Fix sigreturn via VDSO on microMIPS kernel

This change “MIPS: Fix sigreturn via VDSO on microMIPS kernel” in Linux kernel is authored by James Hogan <james.hogan [at] imgtec.com> on Tue May 24 09:35:10 2016 +0100.

MIPS: Fix sigreturn via VDSO on microMIPS kernel

In microMIPS kernels, handle_signal() sets the isa16 mode bit in the
vdso address so that the sigreturn trampolines (which are offset from
the VDSO) get executed as microMIPS.

However commit ebb5e78cc634 ("MIPS: Initial implementation of a VDSO")
changed the offsets to come from the VDSO image, which already have the
isa16 mode bit set correctly since they're extracted from the VDSO
shared library symbol table.

Drop the isa16 mode bit handling from handle_signal() to fix sigreturn
for cores which support both microMIPS and normal MIPS. This doesn't fix
microMIPS only cores, since the VDSO is still built for normal MIPS, but
thats a separate problem.

Fixes: ebb5e78cc634 ("MIPS: Initial implementation of a VDSO")
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: <stable@vger.kernel.org> # 4.4.x-
Patchwork: https://patchwork.linux-mips.org/patch/13348/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

This Linux change may have been applied to various maintained Linux releases and you can find Linux releases including commit 13eb192.

There are 8 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 arch/mips/kernel/signal.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index ab04229..ae42314 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -770,15 +770,7 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs)
 	sigset_t *oldset = sigmask_to_save();
 	int ret;
 	struct mips_abi *abi = current->thread.abi;
-	void *vdso;
-	unsigned long tmp = (unsigned long)current->mm->context.vdso;
-	set_isa16_mode(tmp);
-	vdso = (void *)tmp;
 	void *vdso = current->mm->context.vdso;
 	if (regs->regs[0]) {
 		switch(regs->regs[2]) {

The commit for this change in Linux stable tree is 13eb192 (patch).

Leave a Reply

Your email address will not be published. Required fields are marked *