From: 虞陆铭 <luming.yu@shingroup.cn>
To: "Christophe Leroy" <christophe.leroy@csgroup.eu>,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
mpe <mpe@ellerman.id.au>, npiggin <npiggin@gmail.com>,
"jialong.yang" <jialong.yang@shingroup.cn>,
"luming.yu" <luming.yu@gmail.com>
Subject: Re: [PATCH 1/7] powerpc/entry: convert to common and generic entry
Date: Tue, 22 Oct 2024 12:50:47 +0800 [thread overview]
Message-ID: <tencent_381ACB160B890CC46678170E@qq.com> (raw)
In-Reply-To: <e9595d8b-d1e2-4c6a-b097-6f4f08d29866@csgroup.eu>
>Le 12/10/2024 à 05:56, Luming Yu a écrit :
>> convert powerpc entry code in syscall and fault to use syscall_work
>> and irqentry_state as well as common calls implemented in generic
>> entry infrastructure.
>>
>> Signed-off-by: Luming Yu <luming.yu@shingroup.cn>
>> ---
>> arch/powerpc/Kconfig | 1 +
>> arch/powerpc/include/asm/hw_irq.h | 5 +++++
>> arch/powerpc/include/asm/processor.h | 6 ++++++
>> arch/powerpc/include/asm/syscall.h | 5 +++++
>> arch/powerpc/include/asm/thread_info.h | 1 +
>> arch/powerpc/kernel/syscall.c | 5 ++++-
>> arch/powerpc/mm/fault.c | 3 +++
>> 7 files changed, 25 insertions(+), 1 deletion(-)
>>
>
>...
>
>> diff --git a/arch/powerpc/kernel/syscall.c b/arch/powerpc/kernel/syscall.c
>> index 77fedb190c93..e0338bd8d383 100644
>> --- a/arch/powerpc/kernel/syscall.c
>> +++ b/arch/powerpc/kernel/syscall.c
>> @@ -3,6 +3,7 @@
>> #include <linux/compat.h>
>> #include <linux/context_tracking.h>
>> #include <linux/randomize_kstack.h>
>> +#include <linux/entry-common.h>
>>
>> #include <asm/interrupt.h>
>> #include <asm/kup.h>
>> @@ -131,7 +132,7 @@ notrace long system_call_exception(struct pt_regs *regs, unsigned long r0)
>> * and the test against NR_syscalls will fail and the return
>> * value to be used is in regs->gpr[3].
>> */
>> - r0 = do_syscall_trace_enter(regs);
>> + r0 = syscall_enter_from_user_mode(regs, r0);
>
>Can you provide details on how this works ?
I assume the common entry would take over th details.
So I just made the switch from the high level call.
As you said as the subtle ABI requirement about regs->r3 needs to
be restored, I'm wondering which test can capture the lost
ABI feature. As simple Boot test is insufficient, what is the test set
that can capture it?
I will look into the details late this week.
>
>For instance, do_syscall_trace_enter() was calling do_seccomp().
>do_seccomp() sets regs->r3 to -ENOSYS then calls __secure_computing().
>
>Now you call syscall_enter_from_user_mode() instead which calls
>syscall_enter_from_user_mode_work() which calls syscall_trace_enter()
>which calls __secure_computing() but without seting regs->r3 to -ENOSYS.
>
>So what will be returned by the below return when
>syscall_enter_from_user_mode returns -1 ?
>
>> if (unlikely(r0 >= NR_syscalls))
>> return regs->gpr[3];
>>
>> @@ -184,6 +185,8 @@ notrace long system_call_exception(struct pt_regs *regs, unsigned long r0)
>> * So the resulting 6 or 7 bits of entropy is seen in SP[9:4] or SP[9:3].
>> */
>> choose_random_kstack_offset(mftb());
>> + /*common entry*/
>> + syscall_exit_to_user_mode(regs);
>>
>> return ret;
>> }
next prev parent reply other threads:[~2024-10-22 4:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-12 3:56 [PATCH 1/7] powerpc/entry: convert to common and generic entry Luming Yu
2024-10-15 17:43 ` Christophe Leroy
2024-10-22 4:50 ` 虞陆铭 [this message]
2024-10-23 1:53 ` Michael Ellerman
2024-10-24 8:43 ` Luming Yu
2024-10-25 2:50 ` Luming Yu
2024-11-05 4:47 ` Luming Yu
2024-11-07 3:40 ` Luming Yu
2024-11-10 6:30 ` Luming Yu
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=tencent_381ACB160B890CC46678170E@qq.com \
--to=luming.yu@shingroup.cn \
--cc=christophe.leroy@csgroup.eu \
--cc=jialong.yang@shingroup.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=luming.yu@gmail.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;
as well as URLs for NNTP newsgroup(s).