public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Eugene Syromiatnikov <esyr@redhat.com>
To: Celeste Liu <coelacanthushex@gmail.com>
Cc: linux-riscv@lists.infradead.org,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Oleg Nesterov <oleg@redhat.com>,
	"Dmitry V. Levin" <ldv@strace.io>,
	Andrea Bolognani <abologna@redhat.com>,
	WANG Xuerui <git@xen0n.name>,
	Jiaxun Yang <jiaxun.yang@flygoat.com>,
	Huacai Chen <chenhuacai@kernel.org>,
	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>, Yangyu Chen <cyy@cyyself.name>,
	Han Gao <gaohan@iscas.ac.cn>,
	linux-kernel@vger.kernel.org, rsworktech@outlook.com
Subject: Re: [RFC] riscv/entry: issue about a0/orig_a0 register and ENOSYS
Date: Tue, 17 Sep 2024 14:51:41 +0200	[thread overview]
Message-ID: <20240917125141.GA14463@asgard.redhat.com> (raw)
In-Reply-To: <84ae492a-1995-4fa1-9d3c-78c5bbf9ff71@gmail.com>

On Tue, Sep 17, 2024 at 01:59:23PM +0800, Celeste Liu wrote:
> On 2024-09-17 12:09, Celeste Liu wrote:
> [...]
> > Unfortunately, struct user_regs_struct is defined as below:
> > 
> >         struct user_regs_struct {
> >                 unsigned long pc;
> >         ...
> >                 unsigned long t6;
> >         };
> > 
> > It doesn't contain something like reserved[] as padding to leave the
> > space to add more registers from struct pt_regs!
> > The loongarch do the right thing as below:
> > 
> >         struct user_pt_regs {
> >                 /* Main processor registers. */
> >                 unsigned long regs[32];
> >         ...
> >                 unsigned long reserved[10];
> >         } __attribute__((aligned(8)));
> > 
> > RISC-V can't include orig_a0 in user_regs_struct without breaking UABI.
> > 
> > Need a discussion to decide to use which solution, or is there any
> > other better solution?

As another data point, AArch64 has NT_ARM_SYSTEM_CALL (introduced
in v3.19-rc1~59^2~16[3]) for the purposes of syscall number tampering.

> > [1]: https://github.com/strace/strace/issues/315
> > [2]: https://lore.kernel.org/linux-riscv/20240627071422.GA2626@altlinux.org/

[3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=766a85d7bc5d7f1ddd6de28bdb844eae45ec63b0


  reply	other threads:[~2024-09-17 12:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-17  4:09 [RFC] riscv/entry: issue about a0/orig_a0 register and ENOSYS Celeste Liu
2024-09-17  5:59 ` Celeste Liu
2024-09-17 12:51   ` Eugene Syromiatnikov [this message]
2024-10-16 12:00 ` Alexandre Ghiti
2024-10-16 12:23   ` Celeste Liu
2024-10-16 12:56     ` Alexandre Ghiti
2024-10-16 13:07       ` Celeste Liu
2024-10-16 17:56         ` Celeste Liu

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=20240917125141.GA14463@asgard.redhat.com \
    --to=esyr@redhat.com \
    --cc=abologna@redhat.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=c141028@gmail.com \
    --cc=chenhuacai@kernel.org \
    --cc=coelacanthushex@gmail.com \
    --cc=cyy@cyyself.name \
    --cc=felixonmars@archlinux.org \
    --cc=gaohan@iscas.ac.cn \
    --cc=git@xen0n.name \
    --cc=guoren@kernel.org \
    --cc=jiaxun.yang@flygoat.com \
    --cc=ldv@strace.io \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=oleg@redhat.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=rsworktech@outlook.com \
    --cc=shiqi@isrc.iscas.ac.cn \
    --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