Skip to contentSkip to conversation

Check that the syscall table matches the syscall

PATCH Milton Miller 2 participants 2 messages Jan 3, 2008

lore
Share & tools
lore
#0 lore raw

Hmmm, in-reply-to on the web archive is broken again, sfr alerted.

Quoted 5 lines · Stephen Rothwell

Hopefully this will catch any out of order additions to the table in the future.

#ifdef CONFIG_PPC64

Review

Quoted 9 lines
(quoted diff) +6 -3
-#define SYSCALL(func)          .llong  .sys_##func,.sys_##func
-#define COMPAT_SYS(func)       .llong  .sys_##func,.compat_sys_##func
-#define PPC_SYS(func)          .llong  .ppc_##func,.ppc_##func
+#define CHECK_SYS(n)           .org .sys_call_table + n * 16
+
+#define SYSCALL(func)          CHECK_SYS(__NR_##func); \
+                               .llong  .sys_##func,.sys_##func
+#define COMPAT_SYS(func)       CHECK_SYS(__NR_##func); \
+                               .llong  .sys_##func,.compat_sys_##func

While it may detect misordered additions, it does nothing to check for holes. Actually, it would hide holes: presently, if you leave a hole the entry you add at the end of the table will not work / crash the kernel. After this patch, the hole will crash the kernel but the new syscall will work.

I'm still thinking this through, but perhaps instead of checking the numbers by org in asm, we can define another way to include the systable.h, possibly as a build-only check target.

Something compareing the line number to __NR_##func perhaps cpp into a simple awk script ...

later,
milton

#1 lore raw

Test (Was: Re: [PATCH] [POWERPC] Check that the syscall table matches the syscall )

Quoted 2 lines · On Thu, 3 Jan 2008 01:32:21 -0600 Milton Miller <[email protected]> wrote:

Hmmm, in-reply-to on the web archive is broken again, sfr alerted.

Just a test ...

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/