public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH RT] Fix NR_syscalls in ARM
@ 2007-06-01 23:10 Deepak Saxena
  2007-06-01 23:18 ` Russell King
  0 siblings, 1 reply; 3+ messages in thread
From: Deepak Saxena @ 2007-06-01 23:10 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Thomas Gleixner, linux-kernel, rmk


The -rt patch adds a NR_syscalls symbol to the arm/unistd.h but
it is not the correct value as there are 348 syscalls on ARM
and the existing change sets the symbol to 322.

Signed-off-by: Deepak Saxena <dsaxena@mvista.com>

---

Russell: Why isn't this in mainline? Other arches all seem to have 
this symbol already defined.

Index: linux-2.6.21/include/asm-arm/unistd.h
===================================================================
--- linux-2.6.21.orig/include/asm-arm/unistd.h
+++ linux-2.6.21/include/asm-arm/unistd.h
@@ -375,7 +375,7 @@
 #define __NR_kexec_load			(__NR_SYSCALL_BASE+347)
 
 #ifndef __ASSEMBLY__
-#define NR_syscalls			(__NR_set_mempolicy + 1 - __NR_SYSCALL_BASE)
+#define NR_syscalls			(__NR_kexec_load + 1 - __NR_SYSCALL_BASE)
 #endif
 
 /*

-- 
Deepak Saxena - dsaxena@plexity.net - http://www.plexity.net 

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

* Re: [PATCH RT] Fix NR_syscalls in ARM
  2007-06-01 23:10 [PATCH RT] Fix NR_syscalls in ARM Deepak Saxena
@ 2007-06-01 23:18 ` Russell King
  2007-06-01 23:27   ` Russell King
  0 siblings, 1 reply; 3+ messages in thread
From: Russell King @ 2007-06-01 23:18 UTC (permalink / raw)
  To: Deepak Saxena; +Cc: Ingo Molnar, Thomas Gleixner, linux-kernel

On Fri, Jun 01, 2007 at 04:10:53PM -0700, Deepak Saxena wrote:
> The -rt patch adds a NR_syscalls symbol to the arm/unistd.h but
> it is not the correct value as there are 348 syscalls on ARM
> and the existing change sets the symbol to 322.
> 
> Russell: Why isn't this in mainline? Other arches all seem to have 
> this symbol already defined.

The hint is that it isn't in mainline; it's just plainly not required.
It's also the wrong place to define it; it's not a property that
unistd.h should concern itself with - it's a property of the kernel's
branch table for calling the syscalls, and on ARM we calculate that
number directly from the size of the kernel's branch table.

It's also not just last_syscall_number+1 since the table is sized to
make the assembly easy - iow, a number divisible by 4.

So all in all, NR_syscalls in unistd.h is just utterly wrong.

-- 
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 RT] Fix NR_syscalls in ARM
  2007-06-01 23:18 ` Russell King
@ 2007-06-01 23:27   ` Russell King
  0 siblings, 0 replies; 3+ messages in thread
From: Russell King @ 2007-06-01 23:27 UTC (permalink / raw)
  To: Deepak Saxena, Ingo Molnar, Thomas Gleixner, linux-kernel

On Sat, Jun 02, 2007 at 12:18:40AM +0100, Russell King wrote:
> On Fri, Jun 01, 2007 at 04:10:53PM -0700, Deepak Saxena wrote:
> > The -rt patch adds a NR_syscalls symbol to the arm/unistd.h but
> > it is not the correct value as there are 348 syscalls on ARM
> > and the existing change sets the symbol to 322.
> > 
> > Russell: Why isn't this in mainline? Other arches all seem to have 
> > this symbol already defined.
> 
> The hint is that it isn't in mainline; it's just plainly not required.
> It's also the wrong place to define it; it's not a property that
> unistd.h should concern itself with - it's a property of the kernel's
> branch table for calling the syscalls, and on ARM we calculate that
> number directly from the size of the kernel's branch table.
> 
> It's also not just last_syscall_number+1 since the table is sized to
> make the assembly easy - iow, a number divisible by 4.
> 
> So all in all, NR_syscalls in unistd.h is just utterly wrong.

BTW, it should be pointed out that you've found the exact reason why
putting it in unistd.h is _wrong_.  It's all to easy for it to get
out of sync with updates to the place where it really matters - the
code which bounds-checks the syscall number (that being the assembly
code which indexes the branch table.)

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

end of thread, other threads:[~2007-06-01 23:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-01 23:10 [PATCH RT] Fix NR_syscalls in ARM Deepak Saxena
2007-06-01 23:18 ` Russell King
2007-06-01 23:27   ` Russell King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox