diff options
| author | Michael Karcher <kernel@mkarcher.dialup.fu-berlin.de> | 2025-09-05 00:03:34 +0200 |
|---|---|---|
| committer | Andreas Larsson <andreas@gaisler.com> | 2025-09-19 20:56:36 +0200 |
| commit | 936fb512752af349fc30ccbe0afe14a2ae6d7159 (patch) | |
| tree | 3b529d86abe5bc5798095e1b6a7fb02d9a4f1425 /arch/sparc/lib/Memcpy_utils.S | |
| parent | sparc: fix accurate exception reporting in copy_to_user for Niagara 4 (diff) | |
| download | linux-936fb512752af349fc30ccbe0afe14a2ae6d7159.tar.gz linux-936fb512752af349fc30ccbe0afe14a2ae6d7159.zip | |
sparc: fix accurate exception reporting in copy_{from,to}_user for M7
The referenced commit introduced exception handlers on user-space memory
references in copy_from_user and copy_to_user. These handlers return from
the respective function and calculate the remaining bytes left to copy
using the current register contents. This commit fixes a couple of bad
calculations. This will fix the return value of copy_from_user and
copy_to_user in the faulting case. The behaviour of memcpy stays unchanged.
Fixes: 34060b8fffa7 ("arch/sparc: Add accurate exception reporting in M7memcpy")
Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> # on Oracle SPARC S7
Tested-by: Tony Rodriguez <unixpro1970@gmail.com> # S7, see https://lore.kernel.org/r/98564e2e68df2dda0e00c67a75c7f7dfedb33c7e.camel@physik.fu-berlin.de
Signed-off-by: Michael Karcher <kernel@mkarcher.dialup.fu-berlin.de>
Reviewed-by: Andreas Larsson <andreas@gaisler.com>
Link: https://lore.kernel.org/r/20250905-memcpy_series-v4-5-1ca72dda195b@mkarcher.dialup.fu-berlin.de
Signed-off-by: Andreas Larsson <andreas@gaisler.com>
Diffstat (limited to 'arch/sparc/lib/Memcpy_utils.S')
| -rw-r--r-- | arch/sparc/lib/Memcpy_utils.S | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/sparc/lib/Memcpy_utils.S b/arch/sparc/lib/Memcpy_utils.S index 64fbac28b3db..207343367bb2 100644 --- a/arch/sparc/lib/Memcpy_utils.S +++ b/arch/sparc/lib/Memcpy_utils.S @@ -137,6 +137,15 @@ ENTRY(memcpy_retl_o2_plus_63_8) ba,pt %xcc, __restore_asi add %o2, 8, %o0 ENDPROC(memcpy_retl_o2_plus_63_8) +ENTRY(memcpy_retl_o2_plus_o3) + ba,pt %xcc, __restore_asi + add %o2, %o3, %o0 +ENDPROC(memcpy_retl_o2_plus_o3) +ENTRY(memcpy_retl_o2_plus_o3_plus_1) + add %o3, 1, %o3 + ba,pt %xcc, __restore_asi + add %o2, %o3, %o0 +ENDPROC(memcpy_retl_o2_plus_o3_plus_1) ENTRY(memcpy_retl_o2_plus_o5) ba,pt %xcc, __restore_asi add %o2, %o5, %o0 |
