SUPERH platform development
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: Yoshinori Sato <ysato@users.sourceforge.jp>,
	Rich Felker <dalias@libc.org>,
	John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: linux-sh@vger.kernel.org
Subject: [PATCH] sh: uaccess: Handle exception on second instruction of __put_user_u64
Date: Wed, 6 May 2026 20:32:46 +0200	[thread overview]
Message-ID: <afuJTi1IGCgrK_cc@decadent.org.uk> (raw)

[-- Attachment #1: Type: text/plain, Size: 1245 bytes --]

Each entry in the exception table only covers a single instruction,
but there are 2 instructions that could fault in __put_user_u64.

__get_user_u64 never had this bug.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
I noticed and meant to fix this bug in 2019, but then the patch
lingered in a git branch since then.  Today I found and rewrote it to
match the way Adrian did the exception table for __get_user_u64.  I
have not tested this version at all, though.

Ben.

 arch/sh/include/asm/uaccess_32.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/sh/include/asm/uaccess_32.h b/arch/sh/include/asm/uaccess_32.h
index 5d7ddc092afd..26096258e43b 100644
--- a/arch/sh/include/asm/uaccess_32.h
+++ b/arch/sh/include/asm/uaccess_32.h
@@ -194,6 +194,7 @@ __asm__ __volatile__( \
 	".previous\n" \
 	".section	__ex_table,\"a\"\n\t" \
 	".long	1b, 3b\n\t" \
+	".long	1b + 2, 3b\n\t" \
 	".previous" \
 	: "=r" (retval) \
 	: "r" (val), "m" (__m(addr)), "i" (-EFAULT), "0" (retval) \
@@ -216,6 +217,7 @@ __asm__ __volatile__( \
 	".previous\n" \
 	".section	__ex_table,\"a\"\n\t" \
 	".long	1b, 3b\n\t" \
+	".long	1b + 2, 3b\n\t" \
 	".previous" \
 	: "=r" (retval) \
 	: "r" (val), "m" (__m(addr)), "i" (-EFAULT), "0" (retval) \

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

                 reply	other threads:[~2026-05-06 18:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=afuJTi1IGCgrK_cc@decadent.org.uk \
    --to=ben@decadent.org.uk \
    --cc=dalias@libc.org \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=linux-sh@vger.kernel.org \
    --cc=ysato@users.sourceforge.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox