From: "Christophe Leroy (CS GROUP)" <chleroy@kernel•org>
To: David Laight <david.laight.linux@gmail•com>
Cc: Michael Ellerman <mpe@ellerman•id.au>,
Nicholas Piggin <npiggin@gmail•com>,
Madhavan Srinivasan <maddy@linux•ibm.com>,
linux-kernel@vger•kernel.org, linuxppc-dev@lists•ozlabs.org
Subject: Re: [PATCH v1 2/8] powerpc/signal64: Untangle setup_tm_sigcontexts() and user_access_begin()
Date: Fri, 22 May 2026 14:06:14 +0200 [thread overview]
Message-ID: <69bd69b1-97f7-41e2-934b-bed28dc2fef7@kernel.org> (raw)
In-Reply-To: <20260522121237.3089276f@pumpkin>
Le 22/05/2026 à 13:12, David Laight a écrit :
> On Fri, 22 May 2026 11:56:02 +0200
> "Christophe Leroy (CS GROUP)" <chleroy@kernel•org> wrote:
>
>> Call setup_tm_sigcontexts() before opening user access to avoid
>> having to close and open again.
>>
>> Signed-off-by: Christophe Leroy (CS GROUP) <chleroy@kernel•org>
>> ---
>> arch/powerpc/kernel/signal_64.c | 22 +++++++++-------------
>> 1 file changed, 9 insertions(+), 13 deletions(-)
>>
>> diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
>> index 86bb5bb4c143..3849af21e1d8 100644
>> --- a/arch/powerpc/kernel/signal_64.c
>> +++ b/arch/powerpc/kernel/signal_64.c
>> @@ -873,6 +873,15 @@ int handle_rt_signal64(struct ksignal *ksig, sigset_t *set,
>> if (!MSR_TM_ACTIVE(msr))
>> prepare_setup_sigcontext(tsk);
>>
>> +#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
>> + if (MSR_TM_ACTIVE(msr))
>
> Can't that be done without the ugly #ifdef?
> I assume MSR_TM_ACTIVE() will be zero - so it will all get optimised away.
Yes but struct rt_sigframe field uc_transact only exists when
CONFIG_PPC_TRANSACTIONAL_MEM is defined.
And that would also require a stub setup_tm_sigcontexts()
Chistophe
>
> -- David
>
>> + err |= setup_tm_sigcontexts(&frame->uc.uc_mcontext,
>> + &frame->uc_transact.uc_mcontext,
>> + tsk, ksig->sig, NULL,
>> + (unsigned long)ksig->ka.sa.sa_handler,
>> + msr);
>> +
>> +#endif
>> if (!user_write_access_begin(frame, sizeof(*frame)))
>> goto badframe;
>>
>> @@ -889,19 +898,6 @@ int handle_rt_signal64(struct ksignal *ksig, sigset_t *set,
>> * ucontext_t (for transactional state) with its uc_link ptr.
>> */
>> unsafe_put_user(&frame->uc_transact, &frame->uc.uc_link, badframe_block);
>> -
>> - user_write_access_end();
>> -
>> - err |= setup_tm_sigcontexts(&frame->uc.uc_mcontext,
>> - &frame->uc_transact.uc_mcontext,
>> - tsk, ksig->sig, NULL,
>> - (unsigned long)ksig->ka.sa.sa_handler,
>> - msr);
>> -
>> - if (!user_write_access_begin(&frame->uc.uc_sigmask,
>> - sizeof(frame->uc.uc_sigmask)))
>> - goto badframe;
>> -
>> #endif
>> } else {
>> unsafe_put_user(0, &frame->uc.uc_link, badframe_block);
>
next prev parent reply other threads:[~2026-05-22 12:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-22 9:56 [PATCH v1 0/8] powerpc/signal: Convert to scoped user access Christophe Leroy (CS GROUP)
2026-05-22 9:56 ` [PATCH v1 1/8] powerpc/signal32: " Christophe Leroy (CS GROUP)
2026-05-22 9:56 ` [PATCH v1 2/8] powerpc/signal64: Untangle setup_tm_sigcontexts() and user_access_begin() Christophe Leroy (CS GROUP)
2026-05-22 11:12 ` David Laight
2026-05-22 12:06 ` Christophe Leroy (CS GROUP) [this message]
2026-05-22 12:44 ` Christophe Leroy (CS GROUP)
2026-05-22 18:55 ` David Laight
2026-05-22 9:56 ` [PATCH v1 3/8] powerpc/signal64: Convert to scoped user access Christophe Leroy (CS GROUP)
2026-05-22 9:56 ` [PATCH v1 4/8] powerpc/signal64: Access function descriptor with " Christophe Leroy (CS GROUP)
2026-05-22 9:56 ` [PATCH v1 5/8] powerpc/signal: Include the new stack frame inside the user access block Christophe Leroy (CS GROUP)
2026-05-22 9:56 ` [PATCH v1 6/8] signal: Add unsafe_copy_siginfo_to_user() Christophe Leroy (CS GROUP)
2026-05-22 9:56 ` [PATCH v1 7/8] powerpc/uaccess: Add unsafe_clear_user() Christophe Leroy (CS GROUP)
2026-05-22 9:56 ` [PATCH v1 8/8] powerpc/signal: Use unsafe_copy_siginfo_to_user() 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=69bd69b1-97f7-41e2-934b-bed28dc2fef7@kernel.org \
--to=chleroy@kernel$(echo .)org \
--cc=david.laight.linux@gmail$(echo .)com \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linuxppc-dev@lists$(echo .)ozlabs.org \
--cc=maddy@linux$(echo .)ibm.com \
--cc=mpe@ellerman$(echo .)id.au \
--cc=npiggin@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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