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

powerpc: Reset MSR_LE on signal entry

We always take signals in big endian which is wrong. Signals
should be taken in native endian.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

authored by

Anton Blanchard and committed by
Benjamin Herrenschmidt
e871c6bb ef1967ff

+4 -2
+2 -1
arch/powerpc/kernel/signal_32.c
··· 1045 1045 regs->gpr[5] = (unsigned long) &rt_sf->uc; 1046 1046 regs->gpr[6] = (unsigned long) rt_sf; 1047 1047 regs->nip = (unsigned long) ka->sa.sa_handler; 1048 - /* enter the signal handler in big-endian mode */ 1048 + /* enter the signal handler in native-endian mode */ 1049 1049 regs->msr &= ~MSR_LE; 1050 + regs->msr |= (MSR_KERNEL & MSR_LE); 1050 1051 #ifdef CONFIG_PPC_TRANSACTIONAL_MEM 1051 1052 /* Remove TM bits from thread's MSR. The MSR in the sigcontext 1052 1053 * just indicates to userland that we were doing a transaction, but we
+2 -1
arch/powerpc/kernel/signal_64.c
··· 773 773 774 774 /* Set up "regs" so we "return" to the signal handler. */ 775 775 err |= get_user(regs->nip, &funct_desc_ptr->entry); 776 - /* enter the signal handler in big-endian mode */ 776 + /* enter the signal handler in native-endian mode */ 777 777 regs->msr &= ~MSR_LE; 778 + regs->msr |= (MSR_KERNEL & MSR_LE); 778 779 regs->gpr[1] = newsp; 779 780 err |= get_user(regs->gpr[2], &funct_desc_ptr->toc); 780 781 regs->gpr[3] = signr;