linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
To: "Mehta, Sohil" <sohil.mehta@intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
	"linux-api@vger.kernel.org" <linux-api@vger.kernel.org>
Cc: "svens@linux.ibm.com" <svens@linux.ibm.com>,
	"catalin.marinas@arm.com" <catalin.marinas@arm.com>,
	"schwab@linux-m68k.org" <schwab@linux-m68k.org>,
	"brgerst@gmail.com" <brgerst@gmail.com>,
	"alexander.shishkin@linux.intel.com" 
	<alexander.shishkin@linux.intel.com>,
	"linux-perf-users@vger.kernel.org"
	<linux-perf-users@vger.kernel.org>,
	"x86@kernel.org" <x86@kernel.org>,
	"dalias@libc.org" <dalias@libc.org>,
	"monstr@monstr.eu" <monstr@monstr.eu>,
	"borntraeger@linux.ibm.com" <borntraeger@linux.ibm.com>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
	"christophe.leroy@csgroup.eu" <christophe.leroy@csgroup.eu>,
	"mark.rutland@arm.com" <mark.rutland@arm.com>,
	"glaubitz@physik.fu-berlin.de" <glaubitz@physik.fu-berlin.de>,
	"lukas.bulwahn@gmail.com" <lukas.bulwahn@gmail.com>,
	"rdunlap@infradead.org" <rdunlap@infradead.org>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"hca@linux.ibm.com" <hca@linux.ibm.com>,
	"linux@armlinux.org.uk" <linux@armlinux.org.uk>,
	"sparclinux@vger.kernel.org" <sparclinux@vger.kernel.org>,
	"jolsa@kernel.org" <jolsa@kernel.org>,
	"arnd@arndb.de" <arnd@arndb.de>,
	"ebiederm@xmission.com" <ebiederm@xmission.com>,
	"Lutomirski, Andy" <luto@kernel.org>,
	"linux-ia64@vger.kernel.org" <linux-ia64@vger.kernel.org>,
	"linux-parisc@vger.kernel.org" <linux-parisc@vger.kernel.org>,
	"linux-sh@vger.kernel.org" <linux-sh@vger.kernel.org>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	"mpe@ellerman.id.au" <mpe@ellerman.id.au>,
	"geert@linux-m68k.org" <geert@linux-m68k.org>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"James.Bottomley@HansenPartnership.com" 
	<James.Bottomley@HansenPartnership.com>,
	"peterz@infradead.org" <peterz@infradead.org>,
	"ink@jurassic.park.msu.ru" <ink@jurassic.park.msu.ru>,
	"linux-m68k@lists.linux-m68k.org"
	<linux-m68k@lists.linux-m68k.org>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"tsbogend@alpha.franken.de" <tsbogend@alpha.franken.de>,
	"Hunter, Adrian" <adrian.hunter@intel.com>,
	"acme@kernel.org" <acme@kernel.org>,
	"ysato@users.sourceforge.jp" <ysato@users.sourceforge.jp>,
	"deller@gmx.de" <deller@gmx.de>,
	"debug@rivosinc.com" <debug@rivosinc.com>,
	"rmclure@linux.ibm.com" <rmclure@linux.ibm.com>,
	"gor@linux.ibm.com" <gor@linux.ibm.com>,
	"slyich@gmail.com" <slyich@gmail.com>,
	"npiggin@gmail.com" <npiggin@gmail.com>,
	"agordeev@linux.ibm.com" <agordeev@linux.ibm.com>,
	"chris@zankel.net" <chris@zankel.net>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"linux-mips@vger.kernel.org" <linux-mips@vger.kernel.org>,
	"linux-alpha@vger.kernel.org" <linux-alpha@vger.kernel.org>,
	"mattst88@gmail.com" <mattst88@gmail.com>,
	"linux-s390@vger.kernel.org" <linux-s390@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"bp@alien8.de" <bp@alien8.de>,
	"jcmvbkbc@gmail.com" <jcmvbkbc@gmail.com>,
	"richard.henderson@linaro.org" <richard.henderson@linaro.org>,
	"irogers@google.com" <irogers@google.com>,
	"namhyung@kernel.org" <namhyung@kernel.org>,
	"will@kernel.org" <will@kernel.org>,
	"davem@davemloft.net" <davem@davemloft.net>
Subject: Re: [PATCH 2/2] arch: Reserve map_shadow_stack() syscall number for all architectures
Date: Wed, 13 Sep 2023 22:05:27 +0000	[thread overview]
Message-ID: <a7238521c6f2caee4d76b58fafa60f133cf08041.camel@intel.com> (raw)
In-Reply-To: <29da2af0-5c88-f937-a9b6-db2d5f481321@intel.com>

On Wed, 2023-09-13 at 12:18 -0700, Sohil Mehta wrote:
> On 9/11/2023 2:10 PM, Edgecombe, Rick P wrote:
> > On Mon, 2023-09-11 at 18:02 +0000, Sohil Mehta wrote:
> > > diff --git a/arch/powerpc/kernel/syscalls/syscall.tbl
> > > b/arch/powerpc/kernel/syscalls/syscall.tbl
> > > index 20e50586e8a2..2767b8a42636 100644
> > > --- a/arch/powerpc/kernel/syscalls/syscall.tbl
> > > +++ b/arch/powerpc/kernel/syscalls/syscall.tbl
> > > @@ -539,3 +539,4 @@
> > >  450    nospu   set_mempolicy_home_node         sys_set_mempolicy
> > > _hom
> > > e_node
> > >  451    common  cachestat                       sys_cachestat
> > >  452    common  fchmodat2                       sys_fchmodat2
> > > +453    common  map_shadow_stack                sys_map_shadow_st
> > > ack
> > 
> > I noticed in powerpc, the not implemented syscalls are manually
> > mapped
> > to sys_ni_syscall. It also has some special extra sys_ni_syscall()
> > implementation bits to handle both ARCH_HAS_SYSCALL_WRAPPER and
> > !ARCH_HAS_SYSCALL_WRAPPER. So wondering if it might need special
> > treatment. Did you see those parts?
> > 
> 
> Thanks for pointing this out. Powerpc seems to be unique in their
> handling of not implemented syscalls. Maybe it's because of their
> special casing of the ARCH_HAS_SYSCALL_WRAPPER.
> 
> The code below in arch/powerpc/include/asm/syscalls.h suggests to me
> that it should be safe to map map_shadow_stack() to sys_ni_syscall()
> and
> the special handling will be taken care of.
> 
> #ifndef CONFIG_ARCH_HAS_SYSCALL_WRAPPER
> long sys_ni_syscall(void);
> #else
> long sys_ni_syscall(const struct pt_regs *regs);
> #endif
> 
> I don't quite understand the underlying reasoning for it though. Do
> you
> have any additional insight into how we should handle this?
> 
> I am thinking of doing the following in the next iteration unless
> someone chimes in and says otherwise.
> 
> --- a/arch/powerpc/kernel/syscalls/syscall.tbl
> +++ b/arch/powerpc/kernel/syscalls/syscall.tbl
> @@ -539,4 +539,4 @@
>  450    nospu   set_mempolicy_home_node        
> sys_set_mempolicy_home_node
>  451    common  cachestat                       sys_cachestat
>  452    common  fchmodat2                       sys_fchmodat2
> -453    common  map_shadow_stack                sys_map_shadow_stack
> +453    common  map_shadow_stack                sys_ni_syscall

It might have something to do with that powerpc's COND_SYSCALL()
implementation only defines the struct pt_regs variety, but TBH I get a
bit lost when I get to the inline assembly symbol definitions parts and
how it all ties together.

Doing powerpc's version as sys_ni_syscall seems to be consistent at
least, and makes sense with respect to the code you quoted.

  reply	other threads:[~2023-09-13 22:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-11 18:02 [PATCH 0/2] arch: Sync all syscall tables with 2 newly added system calls Sohil Mehta
2023-09-11 18:02 ` [PATCH 1/2] tools headers UAPI: Sync fchmodat2() syscall table entries Sohil Mehta
2023-09-11 18:02 ` [PATCH 2/2] arch: Reserve map_shadow_stack() syscall number for all architectures Sohil Mehta
2023-09-11 21:10   ` Edgecombe, Rick P
2023-09-13 19:18     ` Sohil Mehta
2023-09-13 22:05       ` Edgecombe, Rick P [this message]
2023-09-14 12:26     ` Michael Ellerman
2023-09-13 19:32 ` [PATCH 0/2] arch: Sync all syscall tables with 2 newly added system calls Sohil Mehta

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=a7238521c6f2caee4d76b58fafa60f133cf08041.camel@intel.com \
    --to=rick.p.edgecombe@intel.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=agordeev@linux.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=borntraeger@linux.ibm.com \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=chris@zankel.net \
    --cc=christophe.leroy@csgroup.eu \
    --cc=dalias@libc.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=debug@rivosinc.com \
    --cc=deller@gmx.de \
    --cc=ebiederm@xmission.com \
    --cc=geert@linux-m68k.org \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=hpa@zytor.com \
    --cc=ink@jurassic.park.msu.ru \
    --cc=irogers@google.com \
    --cc=jcmvbkbc@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=lukas.bulwahn@gmail.com \
    --cc=luto@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mattst88@gmail.com \
    --cc=mingo@redhat.com \
    --cc=monstr@monstr.eu \
    --cc=mpe@ellerman.id.au \
    --cc=namhyung@kernel.org \
    --cc=npiggin@gmail.com \
    --cc=peterz@infradead.org \
    --cc=rdunlap@infradead.org \
    --cc=richard.henderson@linaro.org \
    --cc=rmclure@linux.ibm.com \
    --cc=schwab@linux-m68k.org \
    --cc=slyich@gmail.com \
    --cc=sohil.mehta@intel.com \
    --cc=sparclinux@vger.kernel.org \
    --cc=svens@linux.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=tsbogend@alpha.franken.de \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    --cc=ysato@users.sourceforge.jp \
    /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).