diff mbox

[2/2] asm-generic: add memfd_create system call to unistd.h

Message ID 1407764228-7904-2-git-send-email-will.deacon@arm.com
State Accepted
Commit 503e6636b6f96056210062be703356f4253b6db9
Headers show

Commit Message

Will Deacon Aug. 11, 2014, 1:37 p.m. UTC
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(-)

Comments

David Herrmann Aug. 11, 2014, 4:54 p.m. UTC | #1
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
>
--
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/
Will Deacon Aug. 11, 2014, 5:15 p.m. UTC | #2
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
> >
> 
--
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/
Arnd Bergmann Aug. 11, 2014, 6:57 p.m. UTC | #3
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
--
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/
Geert Uytterhoeven Aug. 11, 2014, 7:37 p.m. UTC | #4
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
--
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/
Will Deacon Aug. 12, 2014, 10:27 a.m. UTC | #5
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
--
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/
Will Deacon Aug. 12, 2014, 10:28 a.m. UTC | #6
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
--
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/
Will Deacon Aug. 12, 2014, 11:10 a.m. UTC | #7
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
--
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/
Vivek Goyal Aug. 12, 2014, 12:37 p.m. UTC | #8
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
--
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/
diff mbox

Patch

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,