linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] arm64: compat: wire up memfd_create and getrandom syscalls for aarch32
@ 2014-08-11 13:37 Will Deacon
  2014-08-11 13:37 ` [PATCH 2/2] asm-generic: add memfd_create system call to unistd.h Will Deacon
  2014-08-11 16:55 ` [PATCH 1/2] arm64: compat: wire up memfd_create and getrandom syscalls for aarch32 David Herrmann
  0 siblings, 2 replies; 15+ messages in thread
From: Will Deacon @ 2014-08-11 13:37 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-kernel, Will Deacon

arch/arm/ just grew support for the new memfd_create and getrandom
syscalls, so add them to our compat layer too.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm64/include/asm/unistd.h   | 2 +-
 arch/arm64/include/asm/unistd32.h | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h
index 4bc95d27e063..6d2bf419431d 100644
--- a/arch/arm64/include/asm/unistd.h
+++ b/arch/arm64/include/asm/unistd.h
@@ -41,7 +41,7 @@
 #define __ARM_NR_compat_cacheflush	(__ARM_NR_COMPAT_BASE+2)
 #define __ARM_NR_compat_set_tls		(__ARM_NR_COMPAT_BASE+5)
 
-#define __NR_compat_syscalls		383
+#define __NR_compat_syscalls		386
 #endif
 
 #define __ARCH_WANT_SYS_CLONE
diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h
index e242600c4046..da1f06b535e3 100644
--- a/arch/arm64/include/asm/unistd32.h
+++ b/arch/arm64/include/asm/unistd32.h
@@ -787,3 +787,8 @@ __SYSCALL(__NR_sched_setattr, sys_sched_setattr)
 __SYSCALL(__NR_sched_getattr, sys_sched_getattr)
 #define __NR_renameat2 382
 __SYSCALL(__NR_renameat2, sys_renameat2)
+			/* 383 for seccomp */
+#define __NR_getrandom 384
+__SYSCALL(__NR_getrandom, sys_getrandom)
+#define __NR_memfd_create 385
+__SYSCALL(__NR_memfd_create, sys_memfd_create)
-- 
2.0.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 2/2] asm-generic: add memfd_create system call to unistd.h
  2014-08-11 13:37 [PATCH 1/2] arm64: compat: wire up memfd_create and getrandom syscalls for aarch32 Will Deacon
@ 2014-08-11 13:37 ` Will Deacon
  2014-08-11 16:54   ` David Herrmann
  2014-08-11 16:55 ` [PATCH 1/2] arm64: compat: wire up memfd_create and getrandom syscalls for aarch32 David Herrmann
  1 sibling, 1 reply; 15+ messages in thread
From: Will Deacon @ 2014-08-11 13:37 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-kernel, Will Deacon, Arnd Bergmann, David Herrmann

Commit 9183df25fe7b ("shm: add memfd_create() syscall") added a new
system call (memfd_create) but didn't update the asm-generic unistd
header.

This patch adds the new system call to the asm-generic version of
unistd.h so that it can be used by architectures such as arm64.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 include/uapi/asm-generic/unistd.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
index f1afd607f043..11d11bc5c78f 100644
--- a/include/uapi/asm-generic/unistd.h
+++ b/include/uapi/asm-generic/unistd.h
@@ -703,9 +703,11 @@ __SYSCALL(__NR_renameat2, sys_renameat2)
 __SYSCALL(__NR_seccomp, sys_seccomp)
 #define __NR_getrandom 278
 __SYSCALL(__NR_getrandom, sys_getrandom)
+#define __NR_memfd_create 279
+__SYSCALL(__NR_memfd_create, sys_memfd_create)
 
 #undef __NR_syscalls
-#define __NR_syscalls 279
+#define __NR_syscalls 280
 
 /*
  * All syscalls below here should go away really,
-- 
2.0.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] asm-generic: add memfd_create system call to unistd.h
  2014-08-11 13:37 ` [PATCH 2/2] asm-generic: add memfd_create system call to unistd.h Will Deacon
@ 2014-08-11 16:54   ` David Herrmann
  2014-08-11 17:15     ` Will Deacon
  0 siblings, 1 reply; 15+ messages in thread
From: David Herrmann @ 2014-08-11 16:54 UTC (permalink / raw)
  To: Will Deacon; +Cc: linux-arm-kernel, linux-kernel, Arnd Bergmann

Hi

On Mon, Aug 11, 2014 at 3:37 PM, Will Deacon <will.deacon@arm.com> wrote:
> Commit 9183df25fe7b ("shm: add memfd_create() syscall") added a new
> system call (memfd_create) but didn't update the asm-generic unistd
> header.
>
> This patch adds the new system call to the asm-generic version of
> unistd.h so that it can be used by architectures such as arm64.
>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: David Herrmann <dh.herrmann@gmail.com>
> Signed-off-by: Will Deacon <will.deacon@arm.com>

Reviewed-by: David Herrmann <dh.herrmann@gmail.com>

Thanks
David

> ---
>  include/uapi/asm-generic/unistd.h | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
> index f1afd607f043..11d11bc5c78f 100644
> --- a/include/uapi/asm-generic/unistd.h
> +++ b/include/uapi/asm-generic/unistd.h
> @@ -703,9 +703,11 @@ __SYSCALL(__NR_renameat2, sys_renameat2)
>  __SYSCALL(__NR_seccomp, sys_seccomp)
>  #define __NR_getrandom 278
>  __SYSCALL(__NR_getrandom, sys_getrandom)
> +#define __NR_memfd_create 279
> +__SYSCALL(__NR_memfd_create, sys_memfd_create)
>
>  #undef __NR_syscalls
> -#define __NR_syscalls 279
> +#define __NR_syscalls 280
>
>  /*
>   * All syscalls below here should go away really,
> --
> 2.0.1
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/2] arm64: compat: wire up memfd_create and getrandom syscalls for aarch32
  2014-08-11 13:37 [PATCH 1/2] arm64: compat: wire up memfd_create and getrandom syscalls for aarch32 Will Deacon
  2014-08-11 13:37 ` [PATCH 2/2] asm-generic: add memfd_create system call to unistd.h Will Deacon
@ 2014-08-11 16:55 ` David Herrmann
  1 sibling, 0 replies; 15+ messages in thread
From: David Herrmann @ 2014-08-11 16:55 UTC (permalink / raw)
  To: Will Deacon; +Cc: linux-arm-kernel, linux-kernel

Hi

On Mon, Aug 11, 2014 at 3:37 PM, Will Deacon <will.deacon@arm.com> wrote:
> arch/arm/ just grew support for the new memfd_create and getrandom
> syscalls, so add them to our compat layer too.
>
> Signed-off-by: Will Deacon <will.deacon@arm.com>
> ---
>  arch/arm64/include/asm/unistd.h   | 2 +-
>  arch/arm64/include/asm/unistd32.h | 5 +++++
>  2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h
> index 4bc95d27e063..6d2bf419431d 100644
> --- a/arch/arm64/include/asm/unistd.h
> +++ b/arch/arm64/include/asm/unistd.h
> @@ -41,7 +41,7 @@
>  #define __ARM_NR_compat_cacheflush     (__ARM_NR_COMPAT_BASE+2)
>  #define __ARM_NR_compat_set_tls                (__ARM_NR_COMPAT_BASE+5)
>
> -#define __NR_compat_syscalls           383
> +#define __NR_compat_syscalls           386
>  #endif
>
>  #define __ARCH_WANT_SYS_CLONE
> diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h
> index e242600c4046..da1f06b535e3 100644
> --- a/arch/arm64/include/asm/unistd32.h
> +++ b/arch/arm64/include/asm/unistd32.h
> @@ -787,3 +787,8 @@ __SYSCALL(__NR_sched_setattr, sys_sched_setattr)
>  __SYSCALL(__NR_sched_getattr, sys_sched_getattr)
>  #define __NR_renameat2 382
>  __SYSCALL(__NR_renameat2, sys_renameat2)
> +                       /* 383 for seccomp */

No idea what happens if you increase __NR_compat_syscalls without
adding __SYSCALL(). Apart from that, it's the same I have in my
private memfd-branch, so fine with me (I will then drop my
arm64-compat patch for memfd).

Thanks
David

> +#define __NR_getrandom 384
> +__SYSCALL(__NR_getrandom, sys_getrandom)
> +#define __NR_memfd_create 385
> +__SYSCALL(__NR_memfd_create, sys_memfd_create)
> --
> 2.0.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] asm-generic: add memfd_create system call to unistd.h
  2014-08-11 16:54   ` David Herrmann
@ 2014-08-11 17:15     ` Will Deacon
  2014-08-11 18:57       ` Arnd Bergmann
  0 siblings, 1 reply; 15+ messages in thread
From: Will Deacon @ 2014-08-11 17:15 UTC (permalink / raw)
  To: David Herrmann; +Cc: linux-arm-kernel, linux-kernel, Arnd Bergmann

On Mon, Aug 11, 2014 at 05:54:08PM +0100, David Herrmann wrote:
> On Mon, Aug 11, 2014 at 3:37 PM, Will Deacon <will.deacon@arm.com> wrote:
> > Commit 9183df25fe7b ("shm: add memfd_create() syscall") added a new
> > system call (memfd_create) but didn't update the asm-generic unistd
> > header.
> >
> > This patch adds the new system call to the asm-generic version of
> > unistd.h so that it can be used by architectures such as arm64.
> >
> > Cc: Arnd Bergmann <arnd@arndb.de>
> > Cc: David Herrmann <dh.herrmann@gmail.com>
> > Signed-off-by: Will Deacon <will.deacon@arm.com>
> 
> Reviewed-by: David Herrmann <dh.herrmann@gmail.com>

Thanks, David.

Arnd: shall I take this via the arm64 tree, or do you already have some
asm-generic patches queued?

Will

> > ---
> >  include/uapi/asm-generic/unistd.h | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
> > index f1afd607f043..11d11bc5c78f 100644
> > --- a/include/uapi/asm-generic/unistd.h
> > +++ b/include/uapi/asm-generic/unistd.h
> > @@ -703,9 +703,11 @@ __SYSCALL(__NR_renameat2, sys_renameat2)
> >  __SYSCALL(__NR_seccomp, sys_seccomp)
> >  #define __NR_getrandom 278
> >  __SYSCALL(__NR_getrandom, sys_getrandom)
> > +#define __NR_memfd_create 279
> > +__SYSCALL(__NR_memfd_create, sys_memfd_create)
> >
> >  #undef __NR_syscalls
> > -#define __NR_syscalls 279
> > +#define __NR_syscalls 280
> >
> >  /*
> >   * All syscalls below here should go away really,
> > --
> > 2.0.1
> >
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] asm-generic: add memfd_create system call to unistd.h
  2014-08-11 17:15     ` Will Deacon
@ 2014-08-11 18:57       ` Arnd Bergmann
  2014-08-11 19:37         ` Geert Uytterhoeven
  2014-08-12 10:28         ` Will Deacon
  0 siblings, 2 replies; 15+ messages in thread
From: Arnd Bergmann @ 2014-08-11 18:57 UTC (permalink / raw)
  To: Will Deacon; +Cc: David Herrmann, linux-arm-kernel, linux-kernel

On Monday 11 August 2014, Will Deacon wrote:
> On Mon, Aug 11, 2014 at 05:54:08PM +0100, David Herrmann wrote:
> > On Mon, Aug 11, 2014 at 3:37 PM, Will Deacon <will.deacon@arm.com> wrote:
> > > Commit 9183df25fe7b ("shm: add memfd_create() syscall") added a new
> > > system call (memfd_create) but didn't update the asm-generic unistd
> > > header.
> > >
> > > This patch adds the new system call to the asm-generic version of
> > > unistd.h so that it can be used by architectures such as arm64.
> > >
> > > Cc: Arnd Bergmann <arnd@arndb.de>
> > > Cc: David Herrmann <dh.herrmann@gmail.com>
> > > Signed-off-by: Will Deacon <will.deacon@arm.com>
> > 
> > Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
> 
> Thanks, David.
> 
> Arnd: shall I take this via the arm64 tree, or do you already have some
> asm-generic patches queued?

Please take it for arm64, I don't have any other patches queued at the moment
and am currently on vacation.

	Arnd

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] asm-generic: add memfd_create system call to unistd.h
  2014-08-11 18:57       ` Arnd Bergmann
@ 2014-08-11 19:37         ` Geert Uytterhoeven
  2014-08-12 10:27           ` Will Deacon
  2014-08-12 10:28         ` Will Deacon
  1 sibling, 1 reply; 15+ messages in thread
From: Geert Uytterhoeven @ 2014-08-11 19:37 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Will Deacon, David Herrmann, linux-arm-kernel, linux-kernel, Vivek Goyal

On Mon, Aug 11, 2014 at 8:57 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Monday 11 August 2014, Will Deacon wrote:
>> On Mon, Aug 11, 2014 at 05:54:08PM +0100, David Herrmann wrote:
>> > On Mon, Aug 11, 2014 at 3:37 PM, Will Deacon <will.deacon@arm.com> wrote:
>> > > Commit 9183df25fe7b ("shm: add memfd_create() syscall") added a new
>> > > system call (memfd_create) but didn't update the asm-generic unistd
>> > > header.
>> > >
>> > > This patch adds the new system call to the asm-generic version of
>> > > unistd.h so that it can be used by architectures such as arm64.
>> > >
>> > > Cc: Arnd Bergmann <arnd@arndb.de>
>> > > Cc: David Herrmann <dh.herrmann@gmail.com>
>> > > Signed-off-by: Will Deacon <will.deacon@arm.com>
>> >
>> > Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
>>
>> Thanks, David.
>>
>> Arnd: shall I take this via the arm64 tree, or do you already have some
>> asm-generic patches queued?
>
> Please take it for arm64, I don't have any other patches queued at the moment
> and am currently on vacation.

Thanks, I was just going to look into adding it...

BTW, another one sneaked in: kexec_file_load. I say "sneaked", as
scripts/checksyscalls.sh doesn't catch it, due to it being wired up on
amd64 only.

Will, you can please add that one, too, while you're at it?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] asm-generic: add memfd_create system call to unistd.h
  2014-08-11 19:37         ` Geert Uytterhoeven
@ 2014-08-12 10:27           ` Will Deacon
  2014-08-12 11:10             ` Will Deacon
  0 siblings, 1 reply; 15+ messages in thread
From: Will Deacon @ 2014-08-12 10:27 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Arnd Bergmann, David Herrmann, linux-arm-kernel, linux-kernel,
	Vivek Goyal

On Mon, Aug 11, 2014 at 08:37:41PM +0100, Geert Uytterhoeven wrote:
> On Mon, Aug 11, 2014 at 8:57 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> > On Monday 11 August 2014, Will Deacon wrote:
> >> On Mon, Aug 11, 2014 at 05:54:08PM +0100, David Herrmann wrote:
> >> > On Mon, Aug 11, 2014 at 3:37 PM, Will Deacon <will.deacon@arm.com> wrote:
> >> > > Commit 9183df25fe7b ("shm: add memfd_create() syscall") added a new
> >> > > system call (memfd_create) but didn't update the asm-generic unistd
> >> > > header.
> >> > >
> >> > > This patch adds the new system call to the asm-generic version of
> >> > > unistd.h so that it can be used by architectures such as arm64.
> >> > >
> >> > > Cc: Arnd Bergmann <arnd@arndb.de>
> >> > > Cc: David Herrmann <dh.herrmann@gmail.com>
> >> > > Signed-off-by: Will Deacon <will.deacon@arm.com>
> >> >
> >> > Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
> >>
> >> Thanks, David.
> >>
> >> Arnd: shall I take this via the arm64 tree, or do you already have some
> >> asm-generic patches queued?
> >
> > Please take it for arm64, I don't have any other patches queued at the moment
> > and am currently on vacation.
> 
> Thanks, I was just going to look into adding it...
> 
> BTW, another one sneaked in: kexec_file_load. I say "sneaked", as
> scripts/checksyscalls.sh doesn't catch it, due to it being wired up on
> amd64 only.

Oh, well spotted!

> Will, you can please add that one, too, while you're at it?

Sure, I'll add an extra patch and repost.

Will

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] asm-generic: add memfd_create system call to unistd.h
  2014-08-11 18:57       ` Arnd Bergmann
  2014-08-11 19:37         ` Geert Uytterhoeven
@ 2014-08-12 10:28         ` Will Deacon
  1 sibling, 0 replies; 15+ messages in thread
From: Will Deacon @ 2014-08-12 10:28 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: David Herrmann, linux-arm-kernel, linux-kernel

On Mon, Aug 11, 2014 at 07:57:00PM +0100, Arnd Bergmann wrote:
> On Monday 11 August 2014, Will Deacon wrote:
> > On Mon, Aug 11, 2014 at 05:54:08PM +0100, David Herrmann wrote:
> > > On Mon, Aug 11, 2014 at 3:37 PM, Will Deacon <will.deacon@arm.com> wrote:
> > > > Commit 9183df25fe7b ("shm: add memfd_create() syscall") added a new
> > > > system call (memfd_create) but didn't update the asm-generic unistd
> > > > header.
> > > >
> > > > This patch adds the new system call to the asm-generic version of
> > > > unistd.h so that it can be used by architectures such as arm64.
> > > >
> > > > Cc: Arnd Bergmann <arnd@arndb.de>
> > > > Cc: David Herrmann <dh.herrmann@gmail.com>
> > > > Signed-off-by: Will Deacon <will.deacon@arm.com>
> > > 
> > > Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
> > 
> > Thanks, David.
> > 
> > Arnd: shall I take this via the arm64 tree, or do you already have some
> > asm-generic patches queued?
> 
> Please take it for arm64, I don't have any other patches queued at the moment
> and am currently on vacation.

Thanks, Arnd. I'll include it with the arm64 pull req at -rc1.

Have a good holiday,

Will

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] asm-generic: add memfd_create system call to unistd.h
  2014-08-12 10:27           ` Will Deacon
@ 2014-08-12 11:10             ` Will Deacon
  2014-08-12 12:37               ` Vivek Goyal
  0 siblings, 1 reply; 15+ messages in thread
From: Will Deacon @ 2014-08-12 11:10 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Arnd Bergmann, David Herrmann, linux-arm-kernel, linux-kernel,
	Vivek Goyal

On Tue, Aug 12, 2014 at 11:27:34AM +0100, Will Deacon wrote:
> On Mon, Aug 11, 2014 at 08:37:41PM +0100, Geert Uytterhoeven wrote:
> > On Mon, Aug 11, 2014 at 8:57 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> > > On Monday 11 August 2014, Will Deacon wrote:
> > >> On Mon, Aug 11, 2014 at 05:54:08PM +0100, David Herrmann wrote:
> > >> > On Mon, Aug 11, 2014 at 3:37 PM, Will Deacon <will.deacon@arm.com> wrote:
> > >> > > Commit 9183df25fe7b ("shm: add memfd_create() syscall") added a new
> > >> > > system call (memfd_create) but didn't update the asm-generic unistd
> > >> > > header.
> > >> > >
> > >> > > This patch adds the new system call to the asm-generic version of
> > >> > > unistd.h so that it can be used by architectures such as arm64.
> > >> > >
> > >> > > Cc: Arnd Bergmann <arnd@arndb.de>
> > >> > > Cc: David Herrmann <dh.herrmann@gmail.com>
> > >> > > Signed-off-by: Will Deacon <will.deacon@arm.com>
> > >> >
> > >> > Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
> > >>
> > >> Thanks, David.
> > >>
> > >> Arnd: shall I take this via the arm64 tree, or do you already have some
> > >> asm-generic patches queued?
> > >
> > > Please take it for arm64, I don't have any other patches queued at the moment
> > > and am currently on vacation.
> > 
> > Thanks, I was just going to look into adding it...
> > 
> > BTW, another one sneaked in: kexec_file_load. I say "sneaked", as
> > scripts/checksyscalls.sh doesn't catch it, due to it being wired up on
> > amd64 only.
> 
> Oh, well spotted!
> 
> > Will, you can please add that one, too, while you're at it?
> 
> Sure, I'll add an extra patch and repost.

Hmm, so whilst I can easily wire-up the new syscall, it's pretty useless for
anybody other than x86 at the moment. There are a bunch of arch helpers:

 arch_kexec_kernel_image_probe
 arch_kexec_kernel_verify_sig
 arch_kexec_kernel_image_load
 arch_kimage_file_post_load_cleanup

which are only implemented for x86 (arch/x86/kernel/machine_kexec_64.c),
even though I don't really see what makes them arch-specific as opposed to
file format specific.

So this syscall will always fail with -ENOEXEC at the moment. Is it still
worth wiring it up?

Will

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] asm-generic: add memfd_create system call to unistd.h
  2014-08-12 11:10             ` Will Deacon
@ 2014-08-12 12:37               ` Vivek Goyal
  2014-08-15 13:55                 ` Will Deacon
  0 siblings, 1 reply; 15+ messages in thread
From: Vivek Goyal @ 2014-08-12 12:37 UTC (permalink / raw)
  To: Will Deacon
  Cc: Geert Uytterhoeven, Arnd Bergmann, David Herrmann,
	linux-arm-kernel, linux-kernel

On Tue, Aug 12, 2014 at 12:10:30PM +0100, Will Deacon wrote:
> On Tue, Aug 12, 2014 at 11:27:34AM +0100, Will Deacon wrote:
> > On Mon, Aug 11, 2014 at 08:37:41PM +0100, Geert Uytterhoeven wrote:
> > > On Mon, Aug 11, 2014 at 8:57 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> > > > On Monday 11 August 2014, Will Deacon wrote:
> > > >> On Mon, Aug 11, 2014 at 05:54:08PM +0100, David Herrmann wrote:
> > > >> > On Mon, Aug 11, 2014 at 3:37 PM, Will Deacon <will.deacon@arm.com> wrote:
> > > >> > > Commit 9183df25fe7b ("shm: add memfd_create() syscall") added a new
> > > >> > > system call (memfd_create) but didn't update the asm-generic unistd
> > > >> > > header.
> > > >> > >
> > > >> > > This patch adds the new system call to the asm-generic version of
> > > >> > > unistd.h so that it can be used by architectures such as arm64.
> > > >> > >
> > > >> > > Cc: Arnd Bergmann <arnd@arndb.de>
> > > >> > > Cc: David Herrmann <dh.herrmann@gmail.com>
> > > >> > > Signed-off-by: Will Deacon <will.deacon@arm.com>
> > > >> >
> > > >> > Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
> > > >>
> > > >> Thanks, David.
> > > >>
> > > >> Arnd: shall I take this via the arm64 tree, or do you already have some
> > > >> asm-generic patches queued?
> > > >
> > > > Please take it for arm64, I don't have any other patches queued at the moment
> > > > and am currently on vacation.
> > > 
> > > Thanks, I was just going to look into adding it...
> > > 
> > > BTW, another one sneaked in: kexec_file_load. I say "sneaked", as
> > > scripts/checksyscalls.sh doesn't catch it, due to it being wired up on
> > > amd64 only.
> > 
> > Oh, well spotted!
> > 
> > > Will, you can please add that one, too, while you're at it?
> > 
> > Sure, I'll add an extra patch and repost.
> 
> Hmm, so whilst I can easily wire-up the new syscall, it's pretty useless for
> anybody other than x86 at the moment. There are a bunch of arch helpers:
> 
>  arch_kexec_kernel_image_probe
>  arch_kexec_kernel_verify_sig
>  arch_kexec_kernel_image_load
>  arch_kimage_file_post_load_cleanup
> 
> which are only implemented for x86 (arch/x86/kernel/machine_kexec_64.c),
> even though I don't really see what makes them arch-specific as opposed to
> file format specific.

Yes, at this point of time, this system call will work only on x86. Agreed
that primarily it is file format details which are primarily in arch
specific section.

I think that some of the code will become arch independent as other
arches start implementing this syscall. 

> 
> So this syscall will always fail with -ENOEXEC at the moment. Is it still
> worth wiring it up?

I thought that for other arches I have not even defined the syscall. So
it probably will fail with -ENOSYS.

Thanks
Vivek

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] asm-generic: add memfd_create system call to unistd.h
  2014-08-12 12:37               ` Vivek Goyal
@ 2014-08-15 13:55                 ` Will Deacon
  2014-08-18 17:15                   ` Vivek Goyal
  0 siblings, 1 reply; 15+ messages in thread
From: Will Deacon @ 2014-08-15 13:55 UTC (permalink / raw)
  To: Vivek Goyal
  Cc: linux-kernel, Geert Uytterhoeven, linux-arm-kernel,
	Arnd Bergmann, David Herrmann

On Tue, Aug 12, 2014 at 01:37:36PM +0100, Vivek Goyal wrote:
> On Tue, Aug 12, 2014 at 12:10:30PM +0100, Will Deacon wrote:
> > Hmm, so whilst I can easily wire-up the new syscall, it's pretty useless for
> > anybody other than x86 at the moment. There are a bunch of arch helpers:
> > 
> >  arch_kexec_kernel_image_probe
> >  arch_kexec_kernel_verify_sig
> >  arch_kexec_kernel_image_load
> >  arch_kimage_file_post_load_cleanup
> > 
> > which are only implemented for x86 (arch/x86/kernel/machine_kexec_64.c),
> > even though I don't really see what makes them arch-specific as opposed to
> > file format specific.
> 
> Yes, at this point of time, this system call will work only on x86. Agreed
> that primarily it is file format details which are primarily in arch
> specific section.
> 
> I think that some of the code will become arch independent as other
> arches start implementing this syscall. 
> 
> > 
> > So this syscall will always fail with -ENOEXEC at the moment. Is it still
> > worth wiring it up?
> 
> I thought that for other arches I have not even defined the syscall. So
> it probably will fail with -ENOSYS.

What I meant was, if I wire it into asm-generic/unistd.h then it will return
-ENOEXEC for architectures using that file (e.g. arm64).

Patch below, but I don't think it's very useful.

Will

--->8

commit a20104072c8faeeacb2857ce24cdb2818f51ff1a
Author: Will Deacon <will.deacon@arm.com>
Date:   Mon Aug 11 14:24:47 2014 +0100

    asm-generic: add kexec_file_load system call to unistd.h
    
    Commit cb1052581e2b ("kexec: implementation of new syscall
    kexec_file_load") added a new system call (kexec_file_load) but didn't
    update the asm-generic unistd header.
    
    This patch adds the new system call to the asm-generic version of
    unistd.h so that it can be used by architectures such as arm64. Note
    that without the arch_kexec hooks, all file formats will result in
    -ENOEXEC.
    
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: Vivek Goyal <vgoyal@redhat.com>
    Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
    Signed-off-by: Will Deacon <will.deacon@arm.com>

diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
index 11d11bc5c78f..92ae121fa055 100644
--- a/include/uapi/asm-generic/unistd.h
+++ b/include/uapi/asm-generic/unistd.h
@@ -705,9 +705,11 @@ __SYSCALL(__NR_seccomp, sys_seccomp)
 __SYSCALL(__NR_getrandom, sys_getrandom)
 #define __NR_memfd_create 279
 __SYSCALL(__NR_memfd_create, sys_memfd_create)
+#define __NR_kexec_file_load 280
+__SYSCALL(__NR_kexec_file_load, sys_kexec_file_load)
 
 #undef __NR_syscalls
-#define __NR_syscalls 280
+#define __NR_syscalls 281
 
 /*
  * All syscalls below here should go away really,

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] asm-generic: add memfd_create system call to unistd.h
  2014-08-15 13:55                 ` Will Deacon
@ 2014-08-18 17:15                   ` Vivek Goyal
  2014-08-18 17:40                     ` Russell King - ARM Linux
  0 siblings, 1 reply; 15+ messages in thread
From: Vivek Goyal @ 2014-08-18 17:15 UTC (permalink / raw)
  To: Will Deacon
  Cc: linux-kernel, Geert Uytterhoeven, linux-arm-kernel,
	Arnd Bergmann, David Herrmann

On Fri, Aug 15, 2014 at 02:55:20PM +0100, Will Deacon wrote:
> On Tue, Aug 12, 2014 at 01:37:36PM +0100, Vivek Goyal wrote:
> > On Tue, Aug 12, 2014 at 12:10:30PM +0100, Will Deacon wrote:
> > > Hmm, so whilst I can easily wire-up the new syscall, it's pretty useless for
> > > anybody other than x86 at the moment. There are a bunch of arch helpers:
> > > 
> > >  arch_kexec_kernel_image_probe
> > >  arch_kexec_kernel_verify_sig
> > >  arch_kexec_kernel_image_load
> > >  arch_kimage_file_post_load_cleanup
> > > 
> > > which are only implemented for x86 (arch/x86/kernel/machine_kexec_64.c),
> > > even though I don't really see what makes them arch-specific as opposed to
> > > file format specific.
> > 
> > Yes, at this point of time, this system call will work only on x86. Agreed
> > that primarily it is file format details which are primarily in arch
> > specific section.
> > 
> > I think that some of the code will become arch independent as other
> > arches start implementing this syscall. 
> > 
> > > 
> > > So this syscall will always fail with -ENOEXEC at the moment. Is it still
> > > worth wiring it up?
> > 
> > I thought that for other arches I have not even defined the syscall. So
> > it probably will fail with -ENOSYS.
> 
> What I meant was, if I wire it into asm-generic/unistd.h then it will return
> -ENOEXEC for architectures using that file (e.g. arm64).
> 
> Patch below, but I don't think it's very useful.
> 

Hi Will,

I have not even defined a syscall number for other arches. IIUC, this
patch will forcibly introduce a syscall number for the new syscall for
arches which use asm-generic/unistd.h.

So question I have is that why should we do it now. One can do it once
somebody enables kexec_file_load() on arm64.

Right now I see that kexec_file_load() gets compiled if CONFIG_KEXEC=y. So
even on arm64 it must be getting compiled in. But it is not being hooked
up using system call table. So there should not be any way to invoke
syscalll definition. So my understand is that in current form, one can
not invoke kexec_file_load() on arm64. Is that right.

Now I have put one more patch to make compilation of kexec_file_load()
conditional on config option CONFIG_KEXEC_FILE. And this option can
be enabled only on x86_64. That means kexec_file_load() will not even
be compiled in on arm64 (once the patch gets merged). Right now patch
is sitting in andrew's tree.

http://ozlabs.org/~akpm/mmotm/broken-out/kexec-create-a-new-config-option-config_kexec_file-for-new-syscall.patch

Can you please help me understand that why do we need this patch if at
this point of time we are not even fixing a system call number for
kexec_file_load() for arches except x86_64.

Thanks
Vivek

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] asm-generic: add memfd_create system call to unistd.h
  2014-08-18 17:15                   ` Vivek Goyal
@ 2014-08-18 17:40                     ` Russell King - ARM Linux
  2014-08-18 21:04                       ` Vivek Goyal
  0 siblings, 1 reply; 15+ messages in thread
From: Russell King - ARM Linux @ 2014-08-18 17:40 UTC (permalink / raw)
  To: Vivek Goyal
  Cc: Will Deacon, Arnd Bergmann, Geert Uytterhoeven, linux-kernel,
	linux-arm-kernel, David Herrmann

On Mon, Aug 18, 2014 at 01:15:40PM -0400, Vivek Goyal wrote:
> On Fri, Aug 15, 2014 at 02:55:20PM +0100, Will Deacon wrote:
> > What I meant was, if I wire it into asm-generic/unistd.h then it will return
> > -ENOEXEC for architectures using that file (e.g. arm64).
> > 
> > Patch below, but I don't think it's very useful.
> > 
> 
> Hi Will,
> 
> I have not even defined a syscall number for other arches. IIUC, this
> patch will forcibly introduce a syscall number for the new syscall for
> arches which use asm-generic/unistd.h.
> 
> So question I have is that why should we do it now. One can do it once
> somebody enables kexec_file_load() on arm64.
> 
> Right now I see that kexec_file_load() gets compiled if CONFIG_KEXEC=y. So
> even on arm64 it must be getting compiled in. But it is not being hooked
> up using system call table. So there should not be any way to invoke
> syscalll definition. So my understand is that in current form, one can
> not invoke kexec_file_load() on arm64. Is that right.
> 
> Now I have put one more patch to make compilation of kexec_file_load()
> conditional on config option CONFIG_KEXEC_FILE. And this option can
> be enabled only on x86_64. That means kexec_file_load() will not even
> be compiled in on arm64 (once the patch gets merged). Right now patch
> is sitting in andrew's tree.
> 
> http://ozlabs.org/~akpm/mmotm/broken-out/kexec-create-a-new-config-option-config_kexec_file-for-new-syscall.patch
> 
> Can you please help me understand that why do we need this patch if at
> this point of time we are not even fixing a system call number for
> kexec_file_load() for arches except x86_64.

>From what I read, the only arch which supports this call is x86_64, and
it requires arch code make work.  So simply wiring up the syscall is not
enough.

What is probably worth doing is reserving the syscall number _if_ it's
going to be useful on architectures - by that, I mean inserting the
syscall number with a comment in the unistd.h file, rather than
defining a constant.

-- 
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] asm-generic: add memfd_create system call to unistd.h
  2014-08-18 17:40                     ` Russell King - ARM Linux
@ 2014-08-18 21:04                       ` Vivek Goyal
  0 siblings, 0 replies; 15+ messages in thread
From: Vivek Goyal @ 2014-08-18 21:04 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Will Deacon, Arnd Bergmann, Geert Uytterhoeven, linux-kernel,
	linux-arm-kernel, David Herrmann

On Mon, Aug 18, 2014 at 06:40:10PM +0100, Russell King - ARM Linux wrote:
> On Mon, Aug 18, 2014 at 01:15:40PM -0400, Vivek Goyal wrote:
> > On Fri, Aug 15, 2014 at 02:55:20PM +0100, Will Deacon wrote:
> > > What I meant was, if I wire it into asm-generic/unistd.h then it will return
> > > -ENOEXEC for architectures using that file (e.g. arm64).
> > > 
> > > Patch below, but I don't think it's very useful.
> > > 
> > 
> > Hi Will,
> > 
> > I have not even defined a syscall number for other arches. IIUC, this
> > patch will forcibly introduce a syscall number for the new syscall for
> > arches which use asm-generic/unistd.h.
> > 
> > So question I have is that why should we do it now. One can do it once
> > somebody enables kexec_file_load() on arm64.
> > 
> > Right now I see that kexec_file_load() gets compiled if CONFIG_KEXEC=y. So
> > even on arm64 it must be getting compiled in. But it is not being hooked
> > up using system call table. So there should not be any way to invoke
> > syscalll definition. So my understand is that in current form, one can
> > not invoke kexec_file_load() on arm64. Is that right.
> > 
> > Now I have put one more patch to make compilation of kexec_file_load()
> > conditional on config option CONFIG_KEXEC_FILE. And this option can
> > be enabled only on x86_64. That means kexec_file_load() will not even
> > be compiled in on arm64 (once the patch gets merged). Right now patch
> > is sitting in andrew's tree.
> > 
> > http://ozlabs.org/~akpm/mmotm/broken-out/kexec-create-a-new-config-option-config_kexec_file-for-new-syscall.patch
> > 
> > Can you please help me understand that why do we need this patch if at
> > this point of time we are not even fixing a system call number for
> > kexec_file_load() for arches except x86_64.
> 
> >From what I read, the only arch which supports this call is x86_64, and
> it requires arch code make work.  So simply wiring up the syscall is not
> enough.
> 

Yes, it will require some arch work (more arch specific kernel image
format related work) to make syscall work on other arches. Generic
portion of the syscall should work without any significant change.

> What is probably worth doing is reserving the syscall number _if_ it's
> going to be useful on architectures - by that, I mean inserting the
> syscall number with a comment in the unistd.h file, rather than
> defining a constant.

I think this syscall is going to be useful on other arches also. I
think specially on arm64 where UEFI is there and I am hoping at
some point of time secureboot on arm64 machines will show up (if it
is not already there).

Do we have to reserve a syscall number now. Does it break anything. Or
it can be reserved later once somebody decides to enable this syscall
on arm64 or any other arch which uses generic/unistd.h.

Right now it sounds more like nice to have item.

Thanks
Vivek

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2014-08-18 21:05 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-11 13:37 [PATCH 1/2] arm64: compat: wire up memfd_create and getrandom syscalls for aarch32 Will Deacon
2014-08-11 13:37 ` [PATCH 2/2] asm-generic: add memfd_create system call to unistd.h Will Deacon
2014-08-11 16:54   ` David Herrmann
2014-08-11 17:15     ` Will Deacon
2014-08-11 18:57       ` Arnd Bergmann
2014-08-11 19:37         ` Geert Uytterhoeven
2014-08-12 10:27           ` Will Deacon
2014-08-12 11:10             ` Will Deacon
2014-08-12 12:37               ` Vivek Goyal
2014-08-15 13:55                 ` Will Deacon
2014-08-18 17:15                   ` Vivek Goyal
2014-08-18 17:40                     ` Russell King - ARM Linux
2014-08-18 21:04                       ` Vivek Goyal
2014-08-12 10:28         ` Will Deacon
2014-08-11 16:55 ` [PATCH 1/2] arm64: compat: wire up memfd_create and getrandom syscalls for aarch32 David Herrmann

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).