From: Thomas Gleixner <tglx@linutronix.de>
To: "Celeste Liu" <coelacanthushex@gmail.com>,
"Björn Töpel" <bjorn@kernel.org>,
"Celeste Liu via B4 Relay"
<devnull+CoelacanthusHex.gmail.com@kernel.org>,
"Paul Walmsley" <paul.walmsley@sifive.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>,
"Björn Töpel" <bjorn@rivosinc.com>
Cc: Palmer Dabbelt <palmer@rivosinc.com>,
Alexandre Ghiti <alex@ghiti.fr>,
"Dmitry V. Levin" <ldv@strace.io>,
Andrea Bolognani <abologna@redhat.com>,
Felix Yan <felixonmars@archlinux.org>,
Ruizhe Pan <c141028@gmail.com>,
Shiqi Zhang <shiqi@isrc.iscas.ac.cn>, Guo Ren <guoren@kernel.org>,
Yao Zi <ziyao@disroot.org>, Han Gao <gaohan@iscas.ac.cn>,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] riscv/entry: get correct syscall number from syscall_get_nr()
Date: Sun, 27 Oct 2024 16:56:24 +0100 [thread overview]
Message-ID: <87a5ep4k0n.ffs@tglx> (raw)
In-Reply-To: <3dc10d89-6c0c-4654-95ed-dd6f19efbad4@gmail.com>
On Sun, Oct 27 2024 at 23:29, Celeste Liu wrote:
> On 2024-10-27 04:21, Thomas Gleixner wrote:
>> The real problem is that orig_a0 is not exposed in the user view of the
>> registers. Changing that struct breaks the existing applications
>> obviously.
>>
>> But you can expose it without changing the struct by exposing a regset
>> for orig_a0 which allows you to read and write it similar to what ARM64
>> does for the syscall number.
>
> If we add something like NT_SYSCALL_NR to UAPI, it cannot solve anything: We
> already have PTRACE_GET_SYSCALL_INFO to get syscall number, which was introduced
> in 5.3 kernel. The problem is only in the kernel before 5.3. So we can't fix
> this issue unless we also backport NT_SYSCALL_NR to 4.19 LTS. But if we can
> backport it, we can backport PTRACE_GET_SYSCALL_INFO directly instead.
PTRACE_GET_SYSCALL_INFO only solves half of the problem. It correctly
returns orig_a0, but there is no way to modify orig_a0, which is
required to change arg0.
On x86 AX contains the syscall number and is used for the return
value. So the tracer has do modify orig_AX when it wants to change the
syscall number.
Equivalently you need to be able to modify orig_a0 for changing arg0,
no?
Thanks,
tglx
next prev parent reply other threads:[~2024-10-27 15:56 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-16 17:49 [PATCH] riscv/entry: get correct syscall number from syscall_get_nr() Celeste Liu via B4 Relay
2024-10-16 17:51 ` kernel test robot
2024-10-21 14:00 ` Björn Töpel
2024-10-21 15:23 ` Celeste Liu
2024-10-21 16:46 ` Björn Töpel
2024-10-25 13:12 ` Thomas Gleixner
2024-10-25 14:30 ` Björn Töpel
2024-10-26 20:21 ` Thomas Gleixner
2024-10-27 15:29 ` Celeste Liu
2024-10-27 15:56 ` Thomas Gleixner [this message]
2024-10-27 17:01 ` Celeste Liu
2024-10-27 21:52 ` Thomas Gleixner
2024-10-28 0:17 ` Ron Economos
2024-10-28 16:25 ` Celeste Liu
2024-10-28 19:33 ` Björn Töpel
2024-11-30 22:39 ` Celeste Liu
2024-10-28 9:45 ` Björn Töpel
2024-11-15 21:49 ` Aurelien Jarno
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=87a5ep4k0n.ffs@tglx \
--to=tglx@linutronix.de \
--cc=abologna@redhat.com \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=bjorn@kernel.org \
--cc=bjorn@rivosinc.com \
--cc=c141028@gmail.com \
--cc=coelacanthushex@gmail.com \
--cc=devnull+CoelacanthusHex.gmail.com@kernel.org \
--cc=felixonmars@archlinux.org \
--cc=gaohan@iscas.ac.cn \
--cc=guoren@kernel.org \
--cc=ldv@strace.io \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=palmer@rivosinc.com \
--cc=paul.walmsley@sifive.com \
--cc=shiqi@isrc.iscas.ac.cn \
--cc=stable@vger.kernel.org \
--cc=ziyao@disroot.org \
/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