[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2b1a96b1-dbc5-40ed-b1b6-2c82d3df9eb2@gmail.com>
Date: Mon, 28 Oct 2024 01:01:47 +0800
From: Celeste Liu <coelacanthushex@...il.com>
To: Thomas Gleixner <tglx@...utronix.de>, Björn Töpel
<bjorn@...nel.org>,
Celeste Liu via B4 Relay <devnull+CoelacanthusHex.gmail.com@...nel.org>,
Paul Walmsley <paul.walmsley@...ive.com>, Palmer Dabbelt
<palmer@...belt.com>, Albert Ou <aou@...s.berkeley.edu>,
Björn Töpel <bjorn@...osinc.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Palmer Dabbelt <palmer@...osinc.com>, Alexandre Ghiti <alex@...ti.fr>,
"Dmitry V. Levin" <ldv@...ace.io>, Andrea Bolognani <abologna@...hat.com>,
Felix Yan <felixonmars@...hlinux.org>, Ruizhe Pan <c141028@...il.com>,
Shiqi Zhang <shiqi@...c.iscas.ac.cn>, Guo Ren <guoren@...nel.org>,
Yao Zi <ziyao@...root.org>, Han Gao <gaohan@...as.ac.cn>,
linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Subject: Re: [PATCH] riscv/entry: get correct syscall number from
syscall_get_nr()
On 2024-10-27 23:56, Thomas Gleixner wrote:
> 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?
Ok.
Greg, could you accept a backport a new API parameter for
PTRACE_GETREGSET/PTRACE_SETREGSET to 4.19 LTS branch?
>
> Thanks,
>
> tglx
>
>
Powered by blists - more mailing lists