]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
parisc/unaligned: Fix fldd and fstd unaligned handlers on 32-bit kernel
authorHelge Deller <deller@gmx.de>
Fri, 18 Feb 2022 08:25:20 +0000 (09:25 +0100)
committerPaolo Pisati <paolo.pisati@canonical.com>
Mon, 7 Mar 2022 10:45:52 +0000 (11:45 +0100)
commitaacb54e8a31afca557393274e4bf4687f4faa62c
tree8369a9bda8dcecb88b277818e5b3cd677cd78b0f
parentff0c7b54f634f4cc0ba5b1cb7faa8dd7e3fc60ca
parisc/unaligned: Fix fldd and fstd unaligned handlers on 32-bit kernel

BugLink: https://bugs.launchpad.net/bugs/1963891
commit dd2288f4a020d693360e3e8d72f8b9d9c25f5ef6 upstream.

Usually the kernel provides fixup routines to emulate the fldd and fstd
floating-point instructions if they load or store 8-byte from/to a not
natuarally aligned memory location.

On a 32-bit kernel I noticed that those unaligned handlers didn't worked and
instead the application got a SEGV.
While checking the code I found two problems:

First, the OPCODE_FLDD_L and OPCODE_FSTD_L cases were ifdef'ed out by the
CONFIG_PA20 option, and as such those weren't built on a pure 32-bit kernel.
This is now fixed by moving the CONFIG_PA20 #ifdef to prevent the compilation
of OPCODE_LDD_L and OPCODE_FSTD_L only, and handling the fldd and fstd
instructions.

The second problem are two bugs in the 32-bit inline assembly code, where the
wrong registers where used. The calculation of the natural alignment used %2
(vall) instead of %3 (ior), and the first word was stored back to address %1
(valh) instead of %3 (ior).

Signed-off-by: Helge Deller <deller@gmx.de>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
arch/parisc/kernel/unaligned.c