[PATCH] Add key management syscalls to non-i386 archs

David Howells
2004-10-20T15:01:42Z

Hi Linus, Andrew,

The attached patch adds syscalls for almost all archs (everything barring
m68knommu which is in a real mess, and i386 which already has it).

It also adds 32->64 compatibility where appropriate.

David

Signed-Off-By: David Howells <dhowells@redhat.com>
---

warthog>diffstat keys-269bk4.diff
arch/alpha/kernel/systbls.S | 3 +++
arch/arm/kernel/calls.S | 3 +++
arch/cris/arch-v10/kernel/entry.S | 3 +++
arch/h8300/kernel/syscalls.S | 3 +++
arch/ia64/ia32/ia32_entry.S | 4 ++++
arch/ia64/ia32/sys_ia32.c | 20 ++++++++++++++++++++
arch/ia64/kernel/entry.S | 6 +++---
arch/ia64/kernel/fsys.S | 6 +++---
arch/m32r/kernel/entry.S | 3 +++
arch/m68k/kernel/entry.S | 3 +++
arch/mips/kernel/scall32-o32.S | 3 +++
arch/mips/kernel/scall64-64.S | 3 +++
arch/mips/kernel/scall64-n32.S | 3 +++
arch/mips/kernel/scall64-o32.S | 3 +++
arch/parisc/kernel/syscall_table.S | 4 +++-
arch/ppc/kernel/misc.S | 3 +++
arch/ppc64/kernel/misc.S | 6 ++++++
arch/ppc64/kernel/sys_ppc32.c | 33 +++++++++++++++++++++++++++++++++
arch/s390/kernel/compat_wrapper.S | 26 ++++++++++++++++++++++++++
arch/s390/kernel/syscalls.S | 3 +++
arch/sh/kernel/entry.S | 4 ++++
arch/sh64/kernel/syscalls.S | 4 +++-
arch/sparc/kernel/systbls.S | 2 +-
arch/sparc64/kernel/sys32.S | 3 +++
arch/sparc64/kernel/systbls.S | 4 ++--
arch/um/kernel/sys_call_table.c | 3 +++
arch/v850/kernel/entry.S | 3 +++
arch/x86_64/ia32/ia32entry.S | 4 ++++
include/asm-alpha/unistd.h | 5 ++++-
include/asm-arm/unistd.h | 3 +++
include/asm-arm26/unistd.h | 3 +++
include/asm-cris/unistd.h | 5 ++++-
include/asm-h8300/unistd.h | 5 ++++-
include/asm-ia64/unistd.h | 3 +++
include/asm-m32r/unistd.h | 5 ++++-
include/asm-m68k/unistd.h | 5 ++++-
include/asm-mips/unistd.h | 17 +++++++++++++----
include/asm-parisc/unistd.h | 5 ++++-
include/asm-ppc/unistd.h | 5 ++++-
include/asm-ppc64/unistd.h | 5 ++++-
include/asm-s390/unistd.h | 5 ++++-
include/asm-sh/unistd.h | 5 ++++-
include/asm-sh64/unistd.h | 5 ++++-
include/asm-sparc/unistd.h | 3 +++
include/asm-sparc64/unistd.h | 3 +++
include/asm-v850/unistd.h | 3 +++
include/asm-x86_64/unistd.h | 8 +++++++-
47 files changed, 239 insertions(+), 27 deletions(-)

diff -uNrp linux-2.6.9-bk4/arch/alpha/kernel/systbls.S linux-2.6.9-bk4-keys/arch/alpha/kernel/systbls.S
--- linux-2.6.9-bk4/arch/alpha/kernel/systbls.S 2004-10-19 10:41:41.000000000 +0100
+++ linux-2.6.9-bk4-keys/arch/alpha/kernel/systbls.S 2004-10-20 14:47:43.275151615 +0100
@@ -458,6 +458,9 @@ sys_call_table:
.quad sys_mq_notify
.quad sys_mq_getsetattr
.quad sys_waitid
+ .quad sys_add_key
+ .quad sys_request_key
+ .quad sys_keyctl

.size sys_call_table, . - sys_call_table
.type sys_call_table, @object
diff -uNrp linux-2.6.9-bk4/arch/arm/kernel/calls.S linux-2.6.9-bk4-keys/arch/arm/kernel/calls.S
--- linux-2.6.9-bk4/arch/arm/kernel/calls.S 2004-10-19 10:41:42.000000000 +0100
+++ linux-2.6.9-bk4-keys/arch/arm/kernel/calls.S 2004-10-20 14:57:39.641915157 +0100
@@ -295,6 +295,9 @@ __syscall_start:
.long sys_mq_notify
.long sys_mq_getsetattr
/* 280 */ .long sys_waitid
+ .long sys_add_key
+ .long sys_request_key
+ .long sys_keyctl
__syscall_end:

.rept NR_syscalls - (__syscall_end - __syscall_start) / 4
diff -uNrp linux-2.6.9-bk4/arch/cris/arch-v10/kernel/entry.S linux-2.6.9-bk4-keys/arch/cris/arch-v10/kernel/entry.S
--- linux-2.6.9-bk4/arch/cris/arch-v10/kernel/entry.S 2004-06-18 13:43:42.000000000 +0100
+++ linux-2.6.9-bk4-keys/arch/cris/arch-v10/kernel/entry.S 2004-10-20 14:44:52.215209105 +0100
@@ -1079,6 +1079,9 @@ sys_call_table:
.long sys_mq_timedreceive /* 280 */
.long sys_mq_notify
.long sys_mq_getsetattr
+ .long sys_add_key
+ .long sys_request_key /* 285 */
+ .long sys_keyctl

/*
* NOTE!! This doesn't have to be exact - we just have
diff -uNrp linux-2.6.9-bk4/arch/h8300/kernel/syscalls.S linux-2.6.9-bk4-keys/arch/h8300/kernel/syscalls.S
--- linux-2.6.9-bk4/arch/h8300/kernel/syscalls.S 2004-06-18 13:43:42.000000000 +0100
+++ linux-2.6.9-bk4-keys/arch/h8300/kernel/syscalls.S 2004-10-20 15:00:36.035535939 +0100
@@ -289,6 +289,9 @@ SYMBOL_NAME_LABEL(sys_call_table)
.long SYMBOL_NAME(sys_utimes)
.long SYMBOL_NAME(sys_fadvise64_64)
.long SYMBOL_NAME(sys_ni_syscall) /* sys_vserver */
+ .long SYMBOL_NAME(sys_add_key)
+ .long SYMBOL_NAME(sys_request_key) /* 275 */
+ .long SYMBOL_NAME(sys_keyctl)

.rept NR_syscalls-(.-SYMBOL_NAME(sys_call_table))/4
.long SYMBOL_NAME(sys_ni_syscall)
diff -uNrp linux-2.6.9-bk4/arch/ia64/ia32/ia32_entry.S linux-2.6.9-bk4-keys/arch/ia64/ia32/ia32_entry.S
--- linux-2.6.9-bk4/arch/ia64/ia32/ia32_entry.S 2004-10-19 10:41:43.000000000 +0100
+++ linux-2.6.9-bk4-keys/arch/ia64/ia32/ia32_entry.S 2004-10-20 15:25:01.365546264 +0100
@@ -495,6 +495,10 @@ ia32_syscall_table:
data8 compat_sys_mq_getsetattr
data8 sys_ni_syscall /* reserved for kexec */
data8 sys32_waitid
+ data8 sys_ni_syscall /* reserved for setaltroot */
+ data8 sys32_add_key
+ data8 sys32_request_key
+ data8 sys_keyctl

// guard against failures to increase IA32_NR_syscalls
.org ia32_syscall_table + 8*IA32_NR_syscalls
diff -uNrp linux-2.6.9-bk4/arch/ia64/ia32/sys_ia32.c linux-2.6.9-bk4-keys/arch/ia64/ia32/sys_ia32.c
--- linux-2.6.9-bk4/arch/ia64/ia32/sys_ia32.c 2004-10-19 10:41:43.000000000 +0100
+++ linux-2.6.9-bk4-keys/arch/ia64/ia32/sys_ia32.c 2004-10-20 15:28:48.663376741 +0100
@@ -2687,6 +2687,26 @@ asmlinkage long sys32_waitid(int which,
return copy_siginfo_to_user32(uinfo, &info);
}

+
+asmlinkage long sys32_add_key(const char __user *_type,
+ const char __user *_description,
+ const void __user *_payload,
+ __u32 plen,
+ __u32 ringid)
+{
+ sys_add_key(_type, _description, _payload, (size_t) plen,
+ (key_serial_t) ringid);
+}
+
+asmlinkage long sys32_request_key(const char __user *_type,
+ const char __user *_description,
+ const char __user *_callout_info,
+ __u32 destringid)
+{
+ sys_request_key(_type, _description, _callout_info,
+ (key_serial_t) destringid);
+}
+
#ifdef NOTYET /* UNTESTED FOR IA64 FROM HERE DOWN */

asmlinkage long sys32_setreuid(compat_uid_t ruid, compat_uid_t euid)
diff -uNrp linux-2.6.9-bk4/arch/ia64/kernel/entry.S linux-2.6.9-bk4-keys/arch/ia64/kernel/entry.S
--- linux-2.6.9-bk4/arch/ia64/kernel/entry.S 2004-10-20 14:02:54.138626787 +0100
+++ linux-2.6.9-bk4-keys/arch/ia64/kernel/entry.S 2004-10-20 14:45:48.309267588 +0100
@@ -1528,9 +1528,9 @@ sys_call_table:
data8 sys_ni_syscall // reserved for kexec_load
data8 sys_ni_syscall
data8 sys_setaltroot // 1270
- data8 sys_ni_syscall
- data8 sys_ni_syscall
- data8 sys_ni_syscall
+ data8 sys_add_key
+ data8 sys_request_key
+ data8 sys_keyctl
data8 sys_ni_syscall
data8 sys_ni_syscall // 1275
data8 sys_ni_syscall
diff -uNrp linux-2.6.9-bk4/arch/ia64/kernel/fsys.S linux-2.6.9-bk4-keys/arch/ia64/kernel/fsys.S
--- linux-2.6.9-bk4/arch/ia64/kernel/fsys.S 2004-10-19 10:41:43.000000000 +0100
+++ linux-2.6.9-bk4-keys/arch/ia64/kernel/fsys.S 2004-10-20 14:46:27.814789684 +0100
@@ -868,9 +868,9 @@ fsyscall_table:
data8 0 // kexec_load
data8 0
data8 0 // 1270
- data8 0
- data8 0
- data8 0
+ data8 0 // add_key
+ data8 0 // request_key
+ data8 0 // keyctl
data8 0
data8 0 // 1275
data8 0
diff -uNrp linux-2.6.9-bk4/arch/m32r/kernel/entry.S linux-2.6.9-bk4-keys/arch/m32r/kernel/entry.S
--- linux-2.6.9-bk4/arch/m32r/kernel/entry.S 2004-10-19 10:41:44.000000000 +0100
+++ linux-2.6.9-bk4-keys/arch/m32r/kernel/entry.S 2004-10-20 15:09:17.798751465 +0100
@@ -994,6 +994,9 @@ ENTRY(sys_call_table)
.long sys_mq_getsetattr
.long sys_ni_syscall /* reserved for kexec */
.long sys_waitid
+ .long sys_add_key /* 285 */
+ .long sys_request_key
+ .long sys_keyctl

syscall_table_size=(.-sys_call_table)

diff -uNrp linux-2.6.9-bk4/arch/m68k/kernel/entry.S linux-2.6.9-bk4-keys/arch/m68k/kernel/entry.S
--- linux-2.6.9-bk4/arch/m68k/kernel/entry.S 2004-06-18 13:43:44.000000000 +0100
+++ linux-2.6.9-bk4-keys/arch/m68k/kernel/entry.S 2004-10-20 14:45:20.678701183 +0100
@@ -663,3 +663,6 @@ sys_call_table:
.long sys_lremovexattr
.long sys_fremovexattr
.long sys_futex /* 235 */
+ .long sys_add_key
+ .long sys_request_key
+ .long sys_keyctl
diff -uNrp linux-2.6.9-bk4/arch/mips/kernel/scall32-o32.S linux-2.6.9-bk4-keys/arch/mips/kernel/scall32-o32.S
--- linux-2.6.9-bk4/arch/mips/kernel/scall32-o32.S 2004-09-16 12:05:47.000000000 +0100
+++ linux-2.6.9-bk4-keys/arch/mips/kernel/scall32-o32.S 2004-10-20 14:30:46.698878816 +0100
@@ -628,6 +628,9 @@ out: jr ra
sys sys_mq_notify 2 /* 4275 */
sys sys_mq_getsetattr 3
sys sys_ni_syscall 0 /* sys_vserver */
+ sys sys_add_key 5
+ sys sys_request_key 4
+ sys sys_keyctl 5

.endm

diff -uNrp linux-2.6.9-bk4/arch/mips/kernel/scall64-64.S linux-2.6.9-bk4-keys/arch/mips/kernel/scall64-64.S
--- linux-2.6.9-bk4/arch/mips/kernel/scall64-64.S 2004-09-16 12:05:47.000000000 +0100
+++ linux-2.6.9-bk4-keys/arch/mips/kernel/scall64-64.S 2004-10-20 14:32:42.206470034 +0100
@@ -448,3 +448,6 @@ sys_call_table:
PTR sys_mq_notify
PTR sys_mq_getsetattr /* 5235 */
PTR sys_ni_syscall /* sys_vserver */
+ PTR sys_add_key
+ PTR sys_request_key
+ PTR sys_keyctl
diff -uNrp linux-2.6.9-bk4/arch/mips/kernel/scall64-n32.S linux-2.6.9-bk4-keys/arch/mips/kernel/scall64-n32.S
--- linux-2.6.9-bk4/arch/mips/kernel/scall64-n32.S 2004-09-16 12:05:47.000000000 +0100
+++ linux-2.6.9-bk4-keys/arch/mips/kernel/scall64-n32.S 2004-10-20 15:12:10.687967430 +0100
@@ -358,3 +358,6 @@ EXPORT(sysn32_call_table)
PTR compat_sys_mq_notify
PTR compat_sys_mq_getsetattr /* 6239 */
PTR sys_ni_syscall /* sys_vserver */
+ PTR sys_add_key
+ PTR sys_request_key
+ PTR sys_keyctl
diff -uNrp linux-2.6.9-bk4/arch/mips/kernel/scall64-o32.S linux-2.6.9-bk4-keys/arch/mips/kernel/scall64-o32.S
--- linux-2.6.9-bk4/arch/mips/kernel/scall64-o32.S 2004-09-16 12:05:47.000000000 +0100
+++ linux-2.6.9-bk4-keys/arch/mips/kernel/scall64-o32.S 2004-10-20 15:11:26.761722025 +0100
@@ -536,6 +536,9 @@ out: jr ra
sys compat_sys_mq_notify 2 /* 4275 */
sys compat_sys_mq_getsetattr 3
sys sys_ni_syscall 0 /* sys_vserver */
+ sys sys_add_key 5
+ sys sys_request_key 4
+ sys sys_keyctl 5

.endm

diff -uNrp linux-2.6.9-bk4/arch/parisc/kernel/syscall_table.S linux-2.6.9-bk4-keys/arch/parisc/kernel/syscall_table.S
--- linux-2.6.9-bk4/arch/parisc/kernel/syscall_table.S 2004-06-18 13:43:47.000000000 +0100
+++ linux-2.6.9-bk4-keys/arch/parisc/kernel/syscall_table.S 2004-10-20 14:58:51.533643420 +0100
@@ -341,5 +341,7 @@
ENTRY_SAME(mq_timedreceive)
ENTRY_SAME(mq_notify)
ENTRY_SAME(mq_getsetattr)
- /* Nothing yet */ /* 235 */
+ ENTRY_SAME(add_key) /* 235 */
+ ENTRY_SAME(request_key)
+ ENTRY_SAME(keyctl)

diff -uNrp linux-2.6.9-bk4/arch/ppc/kernel/misc.S linux-2.6.9-bk4-keys/arch/ppc/kernel/misc.S
--- linux-2.6.9-bk4/arch/ppc/kernel/misc.S 2004-10-19 10:41:46.000000000 +0100
+++ linux-2.6.9-bk4-keys/arch/ppc/kernel/misc.S 2004-10-20 14:43:37.665815385 +0100
@@ -1447,3 +1447,6 @@ _GLOBAL(sys_call_table)
.long sys_mq_notify
.long sys_mq_getsetattr
.long sys_ni_syscall /* 268 reserved for sys_kexec_load */
+ .long sys_add_key
+ .long sys_request_key /* 270 */
+ .long sys_keyctl
diff -uNrp linux-2.6.9-bk4/arch/ppc64/kernel/misc.S linux-2.6.9-bk4-keys/arch/ppc64/kernel/misc.S
--- linux-2.6.9-bk4/arch/ppc64/kernel/misc.S 2004-10-20 14:02:55.974474037 +0100
+++ linux-2.6.9-bk4-keys/arch/ppc64/kernel/misc.S 2004-10-20 14:57:18.470763092 +0100
@@ -963,6 +963,9 @@ _GLOBAL(sys_call_table32)
.llong .compat_sys_mq_notify
.llong .compat_sys_mq_getsetattr
.llong .sys_ni_syscall /* 268 reserved for sys_kexec_load */
+ .llong .sys32_add_key
+ .llong .sys32_request_key
+ .llong .sys32_keyctl

.balign 8
_GLOBAL(sys_call_table)
@@ -1235,3 +1238,6 @@ _GLOBAL(sys_call_table)
.llong .sys_mq_notify
.llong .sys_mq_getsetattr
.llong .sys_ni_syscall /* 268 reserved for sys_kexec_load */
+ .llong .sys_add_key
+ .llong .sys_request_key /* 270 */
+ .llong .sys_keyctl
diff -uNrp linux-2.6.9-bk4/arch/ppc64/kernel/sys_ppc32.c linux-2.6.9-bk4-keys/arch/ppc64/kernel/sys_ppc32.c
--- linux-2.6.9-bk4/arch/ppc64/kernel/sys_ppc32.c 2004-10-20 14:02:56.046468047 +0100
+++ linux-2.6.9-bk4-keys/arch/ppc64/kernel/sys_ppc32.c 2004-10-20 15:29:22.936487493 +0100
@@ -1328,3 +1328,36 @@ long ppc32_timer_create(clockid_t clock,

return err;
}
+
+asmlinkage long sys32_add_key(const char __user *_type,
+ const char __user *_description,
+ const void __user *_payload,
+ u32 plen,
+ u32 ringid)
+{
+ sys_add_key(_type, _description, _payload, (size_t) plen,
+ (key_serial_t) ringid);
+}
+
+asmlinkage long sys32_request_key(const char __user *_type,
+ const char __user *_description,
+ const char __user *_callout_info,
+ u32 destringid)
+{
+ sys_request_key(_type, _description, _callout_info,
+ (key_serial_t) destringid);
+}
+
+/* Note: it is necessary to treat option as an unsigned int,
+ * with the corresponding cast to a signed int to insure that the
+ * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
+ * and the register representation of a signed int (msr in 64-bit mode) is performed.
+ */
+asmlinkage long sys32_keyctl(u32 option, u32 arg2, u32 arg3, u32 arg4, u32 arg5)
+{
+ return sys_keyctl((int)option,
+ (unsigned long) arg2,
+ (unsigned long) arg3,
+ (unsigned long) arg4,
+ (unsigned long) arg5);
+}
diff -uNrp linux-2.6.9-bk4/arch/s390/kernel/compat_wrapper.S linux-2.6.9-bk4-keys/arch/s390/kernel/compat_wrapper.S
--- linux-2.6.9-bk4/arch/s390/kernel/compat_wrapper.S 2004-06-18 13:43:49.000000000 +0100
+++ linux-2.6.9-bk4-keys/arch/s390/kernel/compat_wrapper.S 2004-10-20 15:08:00.071403677 +0100
@@ -1406,3 +1406,29 @@ compat_sys_mq_getsetattr_wrapper:
llgtr %r3,%r3 # struct compat_mq_attr *
llgtr %r4,%r4 # struct compat_mq_attr *
jg compat_sys_mq_getsetattr
+
+ .globl sys32_add_key_wrapper
+sys32_add_key_wrapper:
+ lgfr %r2,%r2 # const char *
+ llgfr %r3,%r3 # const char *
+ llgfr %r4,%r4 # const void *
+ llgfr %r5,%r5 # size_t
+ llgfr %r6,%r6 # key_serial_t
+ jg sys_add_key # branch to system call
+
+ .globl sys32_request_key_wrapper
+sys32_request_key_wrapper:
+ lgfr %r2,%r2 # const char *
+ llgfr %r3,%r3 # const char *
+ llgfr %r4,%r4 # const char *
+ llgfr %r5,%r5 # key_serial_t
+ jg sys_request_key # branch to system call
+
+ .globl sys32_keyctl_wrapper
+sys32_keyctl_wrapper:
+ lgfr %r2,%r2 # int
+ llgfr %r3,%r3 # unsigned long
+ llgfr %r4,%r4 # unsigned long
+ llgfr %r5,%r5 # unsigned long
+ llgfr %r6,%r6 # unsigned long
+ jg sys_keyctl # branch to system call
diff -uNrp linux-2.6.9-bk4/arch/s390/kernel/syscalls.S linux-2.6.9-bk4-keys/arch/s390/kernel/syscalls.S
--- linux-2.6.9-bk4/arch/s390/kernel/syscalls.S 2004-06-18 13:43:49.000000000 +0100
+++ linux-2.6.9-bk4-keys/arch/s390/kernel/syscalls.S 2004-10-20 15:05:49.863555437 +0100
@@ -285,3 +285,6 @@ SYSCALL(sys_mq_timedsend,sys_mq_timedsen
SYSCALL(sys_mq_timedreceive,sys_mq_timedreceive,compat_sys_mq_timedreceive_wrapper)
SYSCALL(sys_mq_notify,sys_mq_notify,compat_sys_mq_notify_wrapper)
SYSCALL(sys_mq_getsetattr,sys_mq_getsetattr,compat_sys_mq_getsetattr_wrapper)
+SYSCALL(sys_add_key,sys_add_key,sys32_add_key_wrapper)
+SYSCALL(sys_request_key,sys_request_key,sys32_request_key_wrapper)
+SYSCALL(sys_keyctl,sys_keyctl,sys32_keyctl_wrapper)
diff -uNrp linux-2.6.9-bk4/arch/sh/kernel/entry.S linux-2.6.9-bk4-keys/arch/sh/kernel/entry.S
--- linux-2.6.9-bk4/arch/sh/kernel/entry.S 2004-10-20 14:02:56.666416464 +0100
+++ linux-2.6.9-bk4-keys/arch/sh/kernel/entry.S 2004-10-20 14:26:32.677689027 +0100
@@ -1140,5 +1140,9 @@ ENTRY(sys_call_table)
.long sys_mq_timedreceive /* 280 */
.long sys_mq_notify
.long sys_mq_getsetattr
+ .long sys_add_key
+ .long sys_request_key
+ .long sys_keyctl /* 285 */
+

/* End of entry.S */
diff -uNrp linux-2.6.9-bk4/arch/sh64/kernel/syscalls.S linux-2.6.9-bk4-keys/arch/sh64/kernel/syscalls.S
--- linux-2.6.9-bk4/arch/sh64/kernel/syscalls.S 2004-09-16 12:05:50.000000000 +0100
+++ linux-2.6.9-bk4-keys/arch/sh64/kernel/syscalls.S 2004-10-20 15:08:45.682499668 +0100
@@ -337,4 +337,6 @@ sys_call_table:
.long sys_mq_timedreceive
.long sys_mq_notify
.long sys_mq_getsetattr /* 310 */
-
+ .long sys_add_key
+ .long sys_request_key
+ .long sys_keyctl
diff -uNrp linux-2.6.9-bk4/arch/sparc/kernel/systbls.S linux-2.6.9-bk4-keys/arch/sparc/kernel/systbls.S
--- linux-2.6.9-bk4/arch/sparc/kernel/systbls.S 2004-10-19 10:41:48.000000000 +0100
+++ linux-2.6.9-bk4-keys/arch/sparc/kernel/systbls.S 2004-10-20 14:25:23.775664787 +0100
@@ -75,7 +75,7 @@ sys_call_table:
/*265*/ .long sys_timer_delete, sys_timer_create, sys_nis_syscall, sys_io_setup, sys_io_destroy
/*270*/ .long sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink
/*275*/ .long sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid
-/*280*/ .long sys_ni_syscall, sys_ni_syscall, sys_ni_syscall
+/*280*/ .long sys_add_key, sys_request_key, sys_keyctl

#ifdef CONFIG_SUNOS_EMUL
/* Now the SunOS syscall table. */
diff -uNrp linux-2.6.9-bk4/arch/sparc64/kernel/sys32.S linux-2.6.9-bk4-keys/arch/sparc64/kernel/sys32.S
--- linux-2.6.9-bk4/arch/sparc64/kernel/sys32.S 2004-10-19 10:41:48.000000000 +0100
+++ linux-2.6.9-bk4-keys/arch/sparc64/kernel/sys32.S 2004-10-20 15:22:48.095792589 +0100
@@ -135,6 +135,9 @@ SIGN2(sys32_shutdown, sys_shutdown, %o0,
SIGN3(sys32_socketpair, sys_socketpair, %o0, %o1, %o2)
SIGN1(sys32_getpeername, sys_getpeername, %o0)
SIGN1(sys32_getsockname, sys_getsockname, %o0)
+SIGN2(sys32_add_key, sys_add_key, %o3, %o4)
+SIGN1(sys32_request_key, sys_request_key, %o3)
+SIGN1(sys32_keyctl, sys_keyctl, %o0)

.globl sys32_mmap2
sys32_mmap2:
diff -uNrp linux-2.6.9-bk4/arch/sparc64/kernel/systbls.S linux-2.6.9-bk4-keys/arch/sparc64/kernel/systbls.S
--- linux-2.6.9-bk4/arch/sparc64/kernel/systbls.S 2004-10-19 10:41:48.000000000 +0100
+++ linux-2.6.9-bk4-keys/arch/sparc64/kernel/systbls.S 2004-10-20 14:42:28.934934888 +0100
@@ -76,7 +76,7 @@ sys_call_table32:
.word sys_timer_delete, sys32_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy
/*270*/ .word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink
.word sys_mq_timedsend, sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid
-/*280*/ .word sys_ni_syscall, sys_ni_syscall, sys_ni_syscall
+/*280*/ .word sys32_add_key, sys32_request_key, sys32_keyctl

#endif /* CONFIG_COMPAT */

@@ -142,7 +142,7 @@ sys_call_table:
.word sys_timer_delete, sys_timer_create, sys_ni_syscall, sys_io_setup, sys_io_destroy
/*270*/ .word sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink
.word sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid
-/*280*/ .word sys_ni_syscall, sys_ni_syscall, sys_ni_syscall
+/*280*/ .word sys_add_key, sys_request_key, sys_keyctl

#if defined(CONFIG_SUNOS_EMUL) || defined(CONFIG_SOLARIS_EMUL) || \
defined(CONFIG_SOLARIS_EMUL_MODULE)
diff -uNrp linux-2.6.9-bk4/arch/um/kernel/sys_call_table.c linux-2.6.9-bk4-keys/arch/um/kernel/sys_call_table.c
--- linux-2.6.9-bk4/arch/um/kernel/sys_call_table.c 2004-10-19 10:41:49.000000000 +0100
+++ linux-2.6.9-bk4-keys/arch/um/kernel/sys_call_table.c 2004-10-20 14:44:10.557889241 +0100
@@ -306,6 +306,9 @@ syscall_handler_t *sys_call_table[] = {
[ __NR_utimes ] (syscall_handler_t *) sys_utimes,
[ __NR_fadvise64_64 ] (syscall_handler_t *) sys_fadvise64_64,
[ __NR_vserver ] (syscall_handler_t *) sys_ni_syscall,
+ [ __NR_add_key ] (syscall_handler_t *) sys_add_key,
+ [ __NR_request_key ] (syscall_handler_t *) sys_request_key,
+ [ __NR_keyctl ] (syscall_handler_t *) sys_keyctl,

ARCH_SYSCALLS
[ LAST_SYSCALL + 1 ... NR_syscalls ] =
diff -uNrp linux-2.6.9-bk4/arch/v850/kernel/entry.S linux-2.6.9-bk4-keys/arch/v850/kernel/entry.S
--- linux-2.6.9-bk4/arch/v850/kernel/entry.S 2004-06-18 13:41:13.000000000 +0100
+++ linux-2.6.9-bk4-keys/arch/v850/kernel/entry.S 2004-10-20 15:02:06.154739578 +0100
@@ -1117,5 +1117,8 @@ C_DATA(sys_call_table):
.long CSYM(sys_pivot_root) // 200
.long CSYM(sys_gettid)
.long CSYM(sys_tkill)
+ .long CSYM(sys_add_key)
+ .long CSYM(sys_request_key)
+ .long CSYM(sys_keyctl) // 205
sys_call_table_end:
C_END(sys_call_table)
diff -uNrp linux-2.6.9-bk4/arch/x86_64/ia32/ia32entry.S linux-2.6.9-bk4-keys/arch/x86_64/ia32/ia32entry.S
--- linux-2.6.9-bk4/arch/x86_64/ia32/ia32entry.S 2004-10-19 10:41:49.000000000 +0100
+++ linux-2.6.9-bk4-keys/arch/x86_64/ia32/ia32entry.S 2004-10-20 15:04:46.183013167 +0100
@@ -587,6 +587,10 @@ ia32_sys_call_table:
.quad compat_sys_mq_getsetattr
.quad quiet_ni_syscall /* reserved for kexec */
.quad sys32_waitid
+ .quad quiet_ni_syscall /* 285 reserved for setaltroot */
+ .quad sys_add_key
+ .quad sys_request_key
+ .quad sys_keyctl
/* don't forget to change IA32_NR_syscalls */
ia32_syscall_end:
.rept IA32_NR_syscalls-(ia32_syscall_end-ia32_sys_call_table)/8
diff -uNrp linux-2.6.9-bk4/include/asm-alpha/unistd.h linux-2.6.9-bk4-keys/include/asm-alpha/unistd.h
--- linux-2.6.9-bk4/include/asm-alpha/unistd.h 2004-10-19 10:42:11.000000000 +0100
+++ linux-2.6.9-bk4-keys/include/asm-alpha/unistd.h 2004-10-20 14:18:36.681064345 +0100
@@ -374,8 +374,11 @@
#define __NR_mq_notify 436
#define __NR_mq_getsetattr 437
#define __NR_waitid 438
+#define __NR_add_key 439
+#define __NR_request_key 440
+#define __NR_keyctl 441

-#define NR_SYSCALLS 439
+#define NR_SYSCALLS 442

#if defined(__GNUC__)

diff -uNrp linux-2.6.9-bk4/include/asm-arm/unistd.h linux-2.6.9-bk4-keys/include/asm-arm/unistd.h
--- linux-2.6.9-bk4/include/asm-arm/unistd.h 2004-10-19 10:42:12.000000000 +0100
+++ linux-2.6.9-bk4-keys/include/asm-arm/unistd.h 2004-10-20 14:17:35.183426405 +0100
@@ -306,6 +306,9 @@
#define __NR_mq_notify (__NR_SYSCALL_BASE+278)
#define __NR_mq_getsetattr (__NR_SYSCALL_BASE+279)
#define __NR_waitid (__NR_SYSCALL_BASE+280)
+#define __NR_add_key (__NR_SYSCALL_BASE+281)
+#define __NR_request_key (__NR_SYSCALL_BASE+282)
+#define __NR_keyctl (__NR_SYSCALL_BASE+283)

/*
* The following SWIs are ARM private.
diff -uNrp linux-2.6.9-bk4/include/asm-arm26/unistd.h linux-2.6.9-bk4-keys/include/asm-arm26/unistd.h
--- linux-2.6.9-bk4/include/asm-arm26/unistd.h 2004-06-18 13:44:05.000000000 +0100
+++ linux-2.6.9-bk4-keys/include/asm-arm26/unistd.h 2004-10-20 14:16:45.004804472 +0100
@@ -260,6 +260,9 @@
#define __NR_lremovexattr (__NR_SYSCALL_BASE+236)
#define __NR_fremovexattr (__NR_SYSCALL_BASE+237)
#define __NR_tkill (__NR_SYSCALL_BASE+238)
+#define __NR_add_key (__NR_SYSCALL_BASE+239)
+#define __NR_request_key (__NR_SYSCALL_BASE+240)
+#define __NR_keyctl (__NR_SYSCALL_BASE+241)

/*
* The following SWIs are ARM private.
diff -uNrp linux-2.6.9-bk4/include/asm-cris/unistd.h linux-2.6.9-bk4-keys/include/asm-cris/unistd.h
--- linux-2.6.9-bk4/include/asm-cris/unistd.h 2004-06-18 13:44:05.000000000 +0100
+++ linux-2.6.9-bk4-keys/include/asm-cris/unistd.h 2004-10-20 14:16:21.025897563 +0100
@@ -288,8 +288,11 @@
#define __NR_mq_timedreceive (__NR_mq_open+3)
#define __NR_mq_notify (__NR_mq_open+4)
#define __NR_mq_getsetattr (__NR_mq_open+5)
+#define __NR_add_key 283
+#define __NR_request_key 284
+#define __NR_keyctl 285

-#define NR_syscalls 283
+#define NR_syscalls 286

#ifdef __KERNEL__
diff -uNrp linux-2.6.9-bk4/include/asm-h8300/unistd.h linux-2.6.9-bk4-keys/include/asm-h8300/unistd.h
--- linux-2.6.9-bk4/include/asm-h8300/unistd.h 2004-06-18 13:44:05.000000000 +0100
+++ linux-2.6.9-bk4-keys/include/asm-h8300/unistd.h 2004-10-20 15:01:16.446016959 +0100
@@ -269,8 +269,11 @@
#define __NR_clock_gettime (__NR_timer_create+6)
#define __NR_clock_getres (__NR_timer_create+7)
#define __NR_clock_nanosleep (__NR_timer_create+8)
+#define __NR_add_key 274
+#define __NR_request_key 275
+#define __NR_keyctl 276

-#define NR_syscalls 268
+#define NR_syscalls 277

/* user-visible error numbers are in the range -1 - -122: see
diff -uNrp linux-2.6.9-bk4/include/asm-ia64/unistd.h linux-2.6.9-bk4-keys/include/asm-ia64/unistd.h
--- linux-2.6.9-bk4/include/asm-ia64/unistd.h 2004-10-20 14:03:14.832904952 +0100
+++ linux-2.6.9-bk4-keys/include/asm-ia64/unistd.h 2004-10-20 14:14:59.746996878 +0100
@@ -260,6 +260,9 @@
#define __NR_kexec_load 1268
#define __NR_vserver 1269
#define __NR_setaltroot 1270
+#define __NR_add_key 1271
+#define __NR_request_key 1272
+#define __NR_keyctl 1273

#ifdef __KERNEL__

diff -uNrp linux-2.6.9-bk4/include/asm-m32r/unistd.h linux-2.6.9-bk4-keys/include/asm-m32r/unistd.h
--- linux-2.6.9-bk4/include/asm-m32r/unistd.h 2004-10-19 10:42:13.000000000 +0100
+++ linux-2.6.9-bk4-keys/include/asm-m32r/unistd.h 2004-10-20 14:14:34.284222397 +0100
@@ -294,8 +294,11 @@
#define __NR_mq_getsetattr (__NR_mq_open+5)
#define __NR_sys_kexec_load 283
#define __NR_waitid 284
+#define __NR_add_key 285
+#define __NR_request_key 286
+#define __NR_keyctl 287

-#define NR_syscalls 285
+#define NR_syscalls 288

/* user-visible error numbers are in the range -1 - -124: see
* <asm-m32r/errno.h>
diff -uNrp linux-2.6.9-bk4/include/asm-m68k/unistd.h linux-2.6.9-bk4-keys/include/asm-m68k/unistd.h
--- linux-2.6.9-bk4/include/asm-m68k/unistd.h 2004-06-18 13:44:05.000000000 +0100
+++ linux-2.6.9-bk4-keys/include/asm-m68k/unistd.h 2004-10-20 14:14:06.358663984 +0100
@@ -238,8 +238,11 @@
#define __NR_lremovexattr 233
#define __NR_fremovexattr 234
#define __NR_futex 235
+#define __NR_add_key 236
+#define __NR_request_key 237
+#define __NR_keyctl 238

-#define NR_syscalls 236
+#define NR_syscalls 239

/* user-visible error numbers are in the range -1 - -124: see
<asm-m68k/errno.h> */
diff -uNrp linux-2.6.9-bk4/include/asm-mips/unistd.h linux-2.6.9-bk4-keys/include/asm-mips/unistd.h
--- linux-2.6.9-bk4/include/asm-mips/unistd.h 2004-09-16 12:06:18.000000000 +0100
+++ linux-2.6.9-bk4-keys/include/asm-mips/unistd.h 2004-10-20 14:12:31.321979696 +0100
@@ -298,16 +298,19 @@
#define __NR_mq_notify (__NR_Linux + 275)
#define __NR_mq_getsetattr (__NR_Linux + 276)
#define __NR_vserver (__NR_Linux + 277)
+#define __NR_add_key (__NR_Linux + 278)
+#define __NR_request_key (__NR_Linux + 279)
+#define __NR_keyctl (__NR_Linux + 280)

/*
* Offset of the last Linux o32 flavoured syscall
*/
-#define __NR_Linux_syscalls 277
+#define __NR_Linux_syscalls 280

#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */

#define __NR_O32_Linux 4000
-#define __NR_O32_Linux_syscalls 277
+#define __NR_O32_Linux_syscalls 280

#if _MIPS_SIM == _MIPS_SIM_ABI64

@@ -552,11 +555,14 @@
#define __NR_mq_notify (__NR_Linux + 234)
#define __NR_mq_getsetattr (__NR_Linux + 235)
#define __NR_vserver (__NR_Linux + 236)
+#define __NR_add_key (__NR_Linux + 237)
+#define __NR_request_key (__NR_Linux + 238)
+#define __NR_keyctl (__NR_Linux + 239)

/*
* Offset of the last Linux flavoured syscall
*/
-#define __NR_Linux_syscalls 236
+#define __NR_Linux_syscalls 239

#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */

@@ -810,11 +816,14 @@
#define __NR_mq_notify (__NR_Linux + 238)
#define __NR_mq_getsetattr (__NR_Linux + 239)
#define __NR_vserver (__NR_Linux + 240)
+#define __NR_add_key (__NR_Linux + 241)
+#define __NR_request_key (__NR_Linux + 242)
+#define __NR_keyctl (__NR_Linux + 243)

/*
* Offset of the last N32 flavoured syscall
*/
-#define __NR_Linux_syscalls 240
+#define __NR_Linux_syscalls 243

#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */

diff -uNrp linux-2.6.9-bk4/include/asm-parisc/unistd.h linux-2.6.9-bk4-keys/include/asm-parisc/unistd.h
--- linux-2.6.9-bk4/include/asm-parisc/unistd.h 2004-09-16 12:06:18.000000000 +0100
+++ linux-2.6.9-bk4-keys/include/asm-parisc/unistd.h 2004-10-20 14:11:00.896901332 +0100
@@ -727,8 +727,11 @@
#define __NR_mq_timedreceive (__NR_Linux + 232)
#define __NR_mq_notify (__NR_Linux + 233)
#define __NR_mq_getsetattr (__NR_Linux + 234)
+#define __NR_add_key (__NR_Linux + 235)
+#define __NR_request_key (__NR_Linux + 236)
+#define __NR_keyctl (__NR_Linux + 237)

-#define __NR_Linux_syscalls 235
+#define __NR_Linux_syscalls 238

#define HPUX_GATEWAY_ADDR 0xC0000004
#define LINUX_GATEWAY_ADDR 0x100
diff -uNrp linux-2.6.9-bk4/include/asm-ppc/unistd.h linux-2.6.9-bk4-keys/include/asm-ppc/unistd.h
--- linux-2.6.9-bk4/include/asm-ppc/unistd.h 2004-06-18 13:44:05.000000000 +0100
+++ linux-2.6.9-bk4-keys/include/asm-ppc/unistd.h 2004-10-20 14:10:32.629379614 +0100
@@ -273,8 +273,11 @@
#define __NR_mq_notify 266
#define __NR_mq_getsetattr 267
#define __NR_kexec_load 268
+#define __NR_add_key 269
+#define __NR_request_key 270
+#define __NR_keyctl 271

-#define __NR_syscalls 269
+#define __NR_syscalls 272

#define __NR(n) #n

diff -uNrp linux-2.6.9-bk4/include/asm-ppc64/unistd.h linux-2.6.9-bk4-keys/include/asm-ppc64/unistd.h
--- linux-2.6.9-bk4/include/asm-ppc64/unistd.h 2004-10-19 10:42:14.000000000 +0100
+++ linux-2.6.9-bk4-keys/include/asm-ppc64/unistd.h 2004-10-20 14:10:19.868498694 +0100
@@ -279,8 +279,11 @@
#define __NR_mq_notify 266
#define __NR_mq_getsetattr 267
#define __NR_kexec_load 268
+#define __NR_add_key 269
+#define __NR_request_key 270
+#define __NR_keyctl 271

-#define __NR_syscalls 269
+#define __NR_syscalls 272
#ifdef __KERNEL__
#define NR_syscalls __NR_syscalls
#endif
diff -uNrp linux-2.6.9-bk4/include/asm-s390/unistd.h linux-2.6.9-bk4-keys/include/asm-s390/unistd.h
--- linux-2.6.9-bk4/include/asm-s390/unistd.h 2004-06-18 13:44:05.000000000 +0100
+++ linux-2.6.9-bk4-keys/include/asm-s390/unistd.h 2004-10-20 14:09:39.572899460 +0100
@@ -269,8 +269,11 @@
#define __NR_mq_timedreceive 274
#define __NR_mq_notify 275
#define __NR_mq_getsetattr 276
+#define __NR_add_key 277
+#define __NR_request_key 278
+#define __NR_keyctl 279

-#define NR_syscalls 277
+#define NR_syscalls 280

/*
* There are some system calls that are not present on 64 bit, some
diff -uNrp linux-2.6.9-bk4/include/asm-sh/unistd.h linux-2.6.9-bk4-keys/include/asm-sh/unistd.h
--- linux-2.6.9-bk4/include/asm-sh/unistd.h 2004-10-20 14:03:16.058802954 +0100
+++ linux-2.6.9-bk4-keys/include/asm-sh/unistd.h 2004-10-20 14:09:16.465821351 +0100
@@ -290,8 +290,11 @@
#define __NR_mq_timedreceive (__NR_mq_open+3)
#define __NR_mq_notify (__NR_mq_open+4)
#define __NR_mq_getsetattr (__NR_mq_open+5)
+#define __NR_add_key 283
+#define __NR_request_key 284
+#define __NR_keyctl 285

-#define NR_syscalls 283
+#define NR_syscalls 286

/* user-visible error numbers are in the range -1 - -124: see <asm-sh/errno.h> */

diff -uNrp linux-2.6.9-bk4/include/asm-sh64/unistd.h linux-2.6.9-bk4-keys/include/asm-sh64/unistd.h
--- linux-2.6.9-bk4/include/asm-sh64/unistd.h 2004-09-16 12:06:19.000000000 +0100
+++ linux-2.6.9-bk4-keys/include/asm-sh64/unistd.h 2004-10-20 14:08:45.352409218 +0100
@@ -333,8 +333,11 @@
#define __NR_mq_timedreceive (__NR_mq_open+3)
#define __NR_mq_notify (__NR_mq_open+4)
#define __NR_mq_getsetattr (__NR_mq_open+5)
+#define __NR_add_key 311
+#define __NR_request_key 312
+#define __NR_keyctl 313

-#define NR_syscalls 311
+#define NR_syscalls 314

/* user-visible error numbers are in the range -1 - -125: see <asm-sh64/errno.h> */

diff -uNrp linux-2.6.9-bk4/include/asm-sparc/unistd.h linux-2.6.9-bk4-keys/include/asm-sparc/unistd.h
--- linux-2.6.9-bk4/include/asm-sparc/unistd.h 2004-10-19 10:42:14.000000000 +0100
+++ linux-2.6.9-bk4-keys/include/asm-sparc/unistd.h 2004-10-20 14:08:05.303740383 +0100
@@ -296,6 +296,9 @@
#define __NR_mq_notify 277
#define __NR_mq_getsetattr 278
#define __NR_waitid 279
+#define __NR_add_key 280
+#define __NR_request_key 281
+#define __NR_keyctl 282

/* WARNING: You MAY NOT add syscall numbers larger than 282, since
* all of the syscall tables in the Sparc kernel are
diff -uNrp linux-2.6.9-bk4/include/asm-sparc64/unistd.h linux-2.6.9-bk4-keys/include/asm-sparc64/unistd.h
--- linux-2.6.9-bk4/include/asm-sparc64/unistd.h 2004-10-19 10:42:15.000000000 +0100
+++ linux-2.6.9-bk4-keys/include/asm-sparc64/unistd.h 2004-10-20 14:07:45.586380476 +0100
@@ -298,6 +298,9 @@
#define __NR_mq_notify 277
#define __NR_mq_getsetattr 278
#define __NR_waitid 279
+#define __NR_add_key 280
+#define __NR_request_key 281
+#define __NR_keyctl 282

/* WARNING: You MAY NOT add syscall numbers larger than 282, since
* all of the syscall tables in the Sparc kernel are
diff -uNrp linux-2.6.9-bk4/include/asm-v850/unistd.h linux-2.6.9-bk4-keys/include/asm-v850/unistd.h
--- linux-2.6.9-bk4/include/asm-v850/unistd.h 2004-09-16 12:06:20.000000000 +0100
+++ linux-2.6.9-bk4-keys/include/asm-v850/unistd.h 2004-10-20 14:06:45.477380562 +0100
@@ -205,6 +205,9 @@
#define __NR_pivot_root 200
#define __NR_gettid 201
#define __NR_tkill 202
+#define __NR_add_key 203
+#define __NR_request_key 204
+#define __NR_keyctl 205

/* Syscall protocol:
diff -uNrp linux-2.6.9-bk4/include/asm-x86_64/unistd.h linux-2.6.9-bk4-keys/include/asm-x86_64/unistd.h
--- linux-2.6.9-bk4/include/asm-x86_64/unistd.h 2004-10-19 10:42:16.000000000 +0100
+++ linux-2.6.9-bk4-keys/include/asm-x86_64/unistd.h 2004-10-20 14:06:01.645026869 +0100
@@ -556,8 +556,14 @@ __SYSCALL(__NR_mq_getsetattr, sys_mq_get
__SYSCALL(__NR_kexec_load, sys_ni_syscall)
#define __NR_waitid 247
__SYSCALL(__NR_waitid, sys_waitid)
+#define __NR_add_key 248
+__SYSCALL(__NR_add_key, sys_add_key)
+#define __NR_request_key 249
+__SYSCALL(__NR_request_key, sys_request_key)
+#define __NR_keyctl 250
+__SYSCALL(__NR_keyctl, sys_keyctl)

-#define __NR_syscall_max __NR_waitid
+#define __NR_syscall_max __NR_keyctl
#ifndef __NO_STUBS

/* user-visible error numbers are in the range -1 - -4095 */