From: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>
To: Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: [PATCH v2 4/8] powerpc/signal64: Access function descriptor with scoped user access
Date: Tue, 2 Jun 2026 10:46:33 +0200 [thread overview]
Message-ID: <6492f5d9ace4ae9dd39ce45b509cd3790285b44a.1780389863.git.chleroy@kernel.org> (raw)
In-Reply-To: <cover.1780389863.git.chleroy@kernel.org>
Access the function descriptor of the handler within a scoped
user access block.
Signed-off-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
---
arch/powerpc/kernel/signal_64.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index 4ff8ad5d60d0..d23a980b32a8 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -932,8 +932,10 @@ int handle_rt_signal64(struct ksignal *ksig, sigset_t *set,
struct func_desc __user *ptr =
(struct func_desc __user *)ksig->ka.sa.sa_handler;
- err |= get_user(regs->ctr, &ptr->addr);
- err |= get_user(regs->gpr[2], &ptr->toc);
+ scoped_user_read_access(ptr, badfunc) {
+ unsafe_get_user(regs->ctr, &ptr->addr, badfunc);
+ unsafe_get_user(regs->gpr[2], &ptr->toc, badfunc);
+ }
}
/* enter the signal handler in native-endian mode */
@@ -956,5 +958,10 @@ int handle_rt_signal64(struct ksignal *ksig, sigset_t *set,
badframe:
signal_fault(current, regs, "handle_rt_signal64", frame);
+ return 1;
+
+badfunc:
+ signal_fault(current, regs, __func__, (void __user *)ksig->ka.sa.sa_handler);
+
return 1;
}
--
2.54.0
next prev parent reply other threads:[~2026-06-02 8:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-02 8:46 [PATCH v2 0/8] powerpc/signal: Convert to " Christophe Leroy (CS GROUP)
2026-06-02 8:46 ` [PATCH v2 1/8] powerpc/signal32: " Christophe Leroy (CS GROUP)
2026-06-02 8:46 ` [PATCH v2 2/8] powerpc/signal64: Untangle setup_tm_sigcontexts() and user_access_begin() Christophe Leroy (CS GROUP)
2026-06-02 8:46 ` [PATCH v2 3/8] powerpc/signal64: Convert to scoped user access Christophe Leroy (CS GROUP)
2026-06-02 8:46 ` Christophe Leroy (CS GROUP) [this message]
2026-06-02 8:46 ` [PATCH v2 5/8] powerpc/signal: Include the new stack frame inside the user access block Christophe Leroy (CS GROUP)
2026-06-02 8:46 ` [PATCH v2 6/8] signal: Add unsafe_copy_siginfo_to_user() Christophe Leroy (CS GROUP)
2026-06-02 8:46 ` [PATCH v2 7/8] powerpc/uaccess: Add unsafe_clear_user() Christophe Leroy (CS GROUP)
2026-06-02 8:46 ` [PATCH v2 8/8] powerpc/signal: Use unsafe_copy_siginfo_to_user() Christophe Leroy (CS GROUP)
2026-07-01 8:58 ` [PATCH v2 0/8] powerpc/signal: Convert to scoped user access Christophe Leroy (CS GROUP)
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=6492f5d9ace4ae9dd39ce45b509cd3790285b44a.1780389863.git.chleroy@kernel.org \
--to=chleroy@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
/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
all inboxes | Powered by JetHome®