linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ARM: add finit_module syscall to ARM
@ 2012-09-21 15:58 Kees Cook
  2012-09-21 16:51 ` Russell King
  0 siblings, 1 reply; 3+ messages in thread
From: Kees Cook @ 2012-09-21 15:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: Kees Cook, Russell King

Add finit_module syscall to the ARM syscall list.

Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Russell King <rmk@arm.linux.org.uk>
---
 arch/arm/include/asm/unistd.h |    1 +
 arch/arm/kernel/calls.S       |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h
index 0cab47d..904b579 100644
--- a/arch/arm/include/asm/unistd.h
+++ b/arch/arm/include/asm/unistd.h
@@ -404,6 +404,7 @@
 #define __NR_setns			(__NR_SYSCALL_BASE+375)
 #define __NR_process_vm_readv		(__NR_SYSCALL_BASE+376)
 #define __NR_process_vm_writev		(__NR_SYSCALL_BASE+377)
+#define __NR_finit_module		(__NR_SYSCALL_BASE+378)
 
 /*
  * The following SWIs are ARM private.
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S
index 463ff4a..54161ac 100644
--- a/arch/arm/kernel/calls.S
+++ b/arch/arm/kernel/calls.S
@@ -387,6 +387,7 @@
 /* 375 */	CALL(sys_setns)
 		CALL(sys_process_vm_readv)
 		CALL(sys_process_vm_writev)
+		CALL(sys_finit_module)
 #ifndef syscalls_counted
 .equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls
 #define syscalls_counted
-- 
1.7.0.4


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

* Re: [PATCH 1/2] ARM: add finit_module syscall to ARM
  2012-09-21 15:58 [PATCH 1/2] ARM: add finit_module syscall to ARM Kees Cook
@ 2012-09-21 16:51 ` Russell King
  2012-09-21 17:26   ` Kees Cook
  0 siblings, 1 reply; 3+ messages in thread
From: Russell King @ 2012-09-21 16:51 UTC (permalink / raw)
  To: Kees Cook; +Cc: linux-kernel

On Fri, Sep 21, 2012 at 08:58:00AM -0700, Kees Cook wrote:
> Add finit_module syscall to the ARM syscall list.
> 
> Signed-off-by: Kees Cook <keescook@chromium.org>
> Cc: Russell King <rmk@arm.linux.org.uk>
> ---
>  arch/arm/include/asm/unistd.h |    1 +
>  arch/arm/kernel/calls.S       |    1 +
>  2 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h
> index 0cab47d..904b579 100644
> --- a/arch/arm/include/asm/unistd.h
> +++ b/arch/arm/include/asm/unistd.h
> @@ -404,6 +404,7 @@
>  #define __NR_setns			(__NR_SYSCALL_BASE+375)
>  #define __NR_process_vm_readv		(__NR_SYSCALL_BASE+376)
>  #define __NR_process_vm_writev		(__NR_SYSCALL_BASE+377)
> +#define __NR_finit_module		(__NR_SYSCALL_BASE+378)

This gives us a different syscall ordering if we add the kcmp syscall.

That brings up another question though - when was kcmp added to x86, and
why aren't we getting notifications from checksyscalls.sh that ARM hasn't
been updated?

It seems to be that the script was broken, and no one has noticed.

commit 29dc54c673ea2531d589400badb4ada5f5f60dae
Author: H. Peter Anvin <hpa@linux.intel.com>
Date:   Fri Nov 11 15:57:53 2011 -0800

    checksyscalls: Use arch/x86/syscalls/syscall_32.tbl as source

    Use the new arch/x86/syscalls/syscall_32.tbl file as source instead of
    arch/x86/include/asm/unistd_32.h.

    Cc: Michal Marek <mmarek@suse.cz>
    Cc: Geert Uytterhoeven <geert@linux-m68k.org>
    Cc: Sam Ravnborg <sam@ravnborg.org>
    Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>

is the culpret, more specifically this fragment:

+           echo <<EOF
+#if !defined(__NR_${name}) && !defined(__IGNORE_${name})
+#warning syscall ${name} not implemented
+#endif
+EOF

"echo <<EOF" doesn't read from its stdin and output to stdout, so the
above just generates a blank line for each entry in x86's syscalls_32.tbl,
resulting in the compiler doing no checking for us.

That "echo <<EOF" should be "cat <<EOF"... and with that fixed we get:

<stdin>:1220:2: warning: #warning syscall kcmp not implemented

So, actually, I want to add this kcmp syscall _now_ into -rc which I'm
afraid will break your patch, and bump your syscall number on ARM to 379.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:

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

* Re: [PATCH 1/2] ARM: add finit_module syscall to ARM
  2012-09-21 16:51 ` Russell King
@ 2012-09-21 17:26   ` Kees Cook
  0 siblings, 0 replies; 3+ messages in thread
From: Kees Cook @ 2012-09-21 17:26 UTC (permalink / raw)
  To: Russell King; +Cc: linux-kernel

On Fri, Sep 21, 2012 at 9:51 AM, Russell King <rmk@arm.linux.org.uk> wrote:
> On Fri, Sep 21, 2012 at 08:58:00AM -0700, Kees Cook wrote:
>> Add finit_module syscall to the ARM syscall list.
>>
>> Signed-off-by: Kees Cook <keescook@chromium.org>
>> Cc: Russell King <rmk@arm.linux.org.uk>
>> ---
>>  arch/arm/include/asm/unistd.h |    1 +
>>  arch/arm/kernel/calls.S       |    1 +
>>  2 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h
>> index 0cab47d..904b579 100644
>> --- a/arch/arm/include/asm/unistd.h
>> +++ b/arch/arm/include/asm/unistd.h
>> @@ -404,6 +404,7 @@
>>  #define __NR_setns                   (__NR_SYSCALL_BASE+375)
>>  #define __NR_process_vm_readv                (__NR_SYSCALL_BASE+376)
>>  #define __NR_process_vm_writev               (__NR_SYSCALL_BASE+377)
>> +#define __NR_finit_module            (__NR_SYSCALL_BASE+378)
>
> This gives us a different syscall ordering if we add the kcmp syscall.
>
> That brings up another question though - when was kcmp added to x86, and
> why aren't we getting notifications from checksyscalls.sh that ARM hasn't
> been updated?
>
> It seems to be that the script was broken, and no one has noticed.
>
> commit 29dc54c673ea2531d589400badb4ada5f5f60dae
> Author: H. Peter Anvin <hpa@linux.intel.com>
> Date:   Fri Nov 11 15:57:53 2011 -0800
>
>     checksyscalls: Use arch/x86/syscalls/syscall_32.tbl as source
>
>     Use the new arch/x86/syscalls/syscall_32.tbl file as source instead of
>     arch/x86/include/asm/unistd_32.h.
>
>     Cc: Michal Marek <mmarek@suse.cz>
>     Cc: Geert Uytterhoeven <geert@linux-m68k.org>
>     Cc: Sam Ravnborg <sam@ravnborg.org>
>     Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
>
> is the culpret, more specifically this fragment:
>
> +           echo <<EOF
> +#if !defined(__NR_${name}) && !defined(__IGNORE_${name})
> +#warning syscall ${name} not implemented
> +#endif
> +EOF
>
> "echo <<EOF" doesn't read from its stdin and output to stdout, so the
> above just generates a blank line for each entry in x86's syscalls_32.tbl,
> resulting in the compiler doing no checking for us.
>
> That "echo <<EOF" should be "cat <<EOF"... and with that fixed we get:
>
> <stdin>:1220:2: warning: #warning syscall kcmp not implemented
>
> So, actually, I want to add this kcmp syscall _now_ into -rc which I'm
> afraid will break your patch, and bump your syscall number on ARM to 379.

That's fine by me. I'll adjust my patch series.

Thanks!

-Kees

-- 
Kees Cook
Chrome OS Security

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

end of thread, other threads:[~2012-09-21 17:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-21 15:58 [PATCH 1/2] ARM: add finit_module syscall to ARM Kees Cook
2012-09-21 16:51 ` Russell King
2012-09-21 17:26   ` Kees Cook

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