2004-10-20 15:01:42

by David Howells

[permalink] [raw]
Subject: [PATCH] Add key management syscalls to non-i386 archs

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 <[email protected]>
---

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


2004-10-20 15:36:02

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH] Add key management syscalls to non-i386 archs

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

Umm, that patch added the damn multiplexer that had been vetoed multiple
times. Why did this happen?

2004-10-20 16:29:23

by David Howells

[permalink] [raw]
Subject: Re: [parisc-linux] [PATCH] Add key management syscalls to non-i386 archs


> Um, no. Should be ENTRY_COMP() if there's compat syscalls.

Not all archs (of which PA-Risc is an example) seem to require the same fixups
on the same syscalls. In some instances, the upper half of the register is
implicitly zero on 32-bit syscall entry to a 64-bit kernel. In such cases,
none of my syscalls require fixing up, assuming the pointers are automatically
correct.

> And those particular syscall numbers have already been assigned (blame Linus
> for dropping the PA-RISC patch on the floor instead of including it in
> 2.6.9).

There's not a lot I can do about that, except wave a patch under Linus's nose
and see who complains. Can you allocate three syscall numbers for me for
parisc?

David

2004-10-20 16:46:10

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH] Add key management syscalls to non-i386 archs

On Wed, 20 Oct 2004, David Howells wrote:
> The attached patch adds syscalls for almost all archs (everything barring
> m68knommu which is in a real mess, and i386 which already has it).

m68nommu mirrors m68k now, but that patch doesn't seem to be in Linus' tree
yet.

Anyway, I'll reserve 3 syscalls for m68k, together with the other pending
syscall numbers.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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

2004-10-20 18:01:25

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] Add key management syscalls to non-i386 archs

Christoph Hellwig <[email protected]> wrote:
>
> > 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.
>
> Umm, that patch added the damn multiplexer that had been vetoed multiple
> times. Why did this happen?

Fifteen new syscalls was judged excessive and the keyfs interface was
judged slow and bloaty.

2004-10-20 19:40:02

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH] Add key management syscalls to non-i386 archs

David Howells <[email protected]> writes:
> /* 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)

Hey, I already allocated 248 for setaltroot. And no, you cannot
allocate system calls on your own without going through the
architecture maintainer. The normal workflow is that you add
them to i386 and the other follow on their own.

Andrew, please don't apply the x86-64 parts of this.

-Andi

2004-10-20 20:24:53

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] Add key management syscalls to non-i386 archs

David Howells <[email protected]> wrote:
>
> > Hey, I already allocated 248 for setaltroot.

I wouldn't be in a rush to wire up sys_altroot() actually.
Unless some security issues are resolved it's going away again.

2004-10-20 23:15:17

by Andi Kleen

[permalink] [raw]
Subject: Re: [discuss] Re: [PATCH] Add key management syscalls to non-i386 archs

On Wed, Oct 20, 2004 at 03:01:49PM -0700, David S. Miller wrote:
>
> David, I applaud your effort to take care of this.
> However, this patch will conflict with what I've
> sent into Linus already for Sparc. I also had to
> add the sys_altroot syscall entry as well.
>
> I've mentioned several times that perhaps the best
> way to deal with this problem is to purposefully
> break the build of platforms when new system calls
> are added.
>
> Simply adding a:
>
> #error new syscall entries for X and Y needed
>
> to include/asm-*/unistd.h would handle this just
> fine I think.

I don't think that's a good idea. Normally new system calls
are relatively obscure and the system works fine without them,
so urgent action is not needed.

And I think we can trust architecture maintainers to regularly
sync the system calls with i386.

-Andi

2004-10-20 23:33:55

by David Miller

[permalink] [raw]
Subject: Re: [discuss] Re: [PATCH] Add key management syscalls to non-i386 archs

On Thu, 21 Oct 2004 00:56:25 +0200
Andi Kleen <[email protected]> wrote:

> I don't think that's a good idea. Normally new system calls
> are relatively obscure and the system works fine without them,
> so urgent action is not needed.
>
> And I think we can trust architecture maintainers to regularly
> sync the system calls with i386.

I disagree quite strongly. One major frustration for users of
non-x86 platforms is that functionality is often missing for some
time that we can make trivial to keep in sync.

I religiously watch what goes into Linus's tree for this purpose,
but that is kind of a rediculious burdon to expect every platform
maintainer to do. It's not just system calls, we have signal handling
bug fixes, trap handling infrastructure, and now the nice generic
IRQ handling subsystem as other examples.

Simply put, if you're not watching the tree in painstaking detail
every day, you miss all of these enhancements.

The knowledge should come from the person putting the changes into
the tree, therefore it gets done once and this makes it so that
the other platform maintainers will find out about it automatically
next time they update their tree.

2004-10-20 23:47:51

by David Miller

[permalink] [raw]
Subject: Re: [discuss] Re: [PATCH] Add key management syscalls to non-i386 archs

On Thu, 21 Oct 2004 01:25:09 +0200
Andi Kleen <[email protected]> wrote:

> IMHO breaking the build unnecessarily is extremly bad because
> it will prevent all testing. And would you really want to hold
> up the whole linux testing machinery just for some obscure
> system call? IMHO not a good tradeoff.

Then change the unistd.h cookie from "#error" to a "#warning". It
accomplishes both of our goals.

2004-10-21 00:12:50

by Andi Kleen

[permalink] [raw]
Subject: Re: [discuss] Re: [PATCH] Add key management syscalls to non-i386 archs

On Wed, Oct 20, 2004 at 04:41:44PM -0700, David S. Miller wrote:
> On Thu, 21 Oct 2004 01:25:09 +0200
> Andi Kleen <[email protected]> wrote:
>
> > IMHO breaking the build unnecessarily is extremly bad because
> > it will prevent all testing. And would you really want to hold
> > up the whole linux testing machinery just for some obscure
> > system call? IMHO not a good tradeoff.
>
> Then change the unistd.h cookie from "#error" to a "#warning". It
> accomplishes both of our goals.

#warnings would be fine for me.

-Andi

2004-10-21 01:23:24

by Andi Kleen

[permalink] [raw]
Subject: Re: [discuss] Re: [PATCH] Add key management syscalls to non-i386 archs

On Wed, Oct 20, 2004 at 04:04:50PM -0700, David S. Miller wrote:
> On Thu, 21 Oct 2004 00:56:25 +0200
> Andi Kleen <[email protected]> wrote:
>
> > I don't think that's a good idea. Normally new system calls
> > are relatively obscure and the system works fine without them,
> > so urgent action is not needed.
> >
> > And I think we can trust architecture maintainers to regularly
> > sync the system calls with i386.
>
> I disagree quite strongly. One major frustration for users of
> non-x86 platforms is that functionality is often missing for some
> time that we can make trivial to keep in sync.

I'm not sure really if the users of some embedded platform
are all sheering for key management system calls...

I guess they will prefer just something that compiles.

>
> I religiously watch what goes into Linus's tree for this purpose,
> but that is kind of a rediculious burdon to expect every platform
> maintainer to do. It's not just system calls, we have signal handling
> bug fixes, trap handling infrastructure, and now the nice generic
> IRQ handling subsystem as other examples.

Most of that is optional. When the arch maintainer choses not to
use it you have just unnecessarily broken the build.

IMHO breaking the build unnecessarily is extremly bad because
it will prevent all testing. And would you really want to hold
up the whole linux testing machinery just for some obscure
system call? IMHO not a good tradeoff.

>
> Simply put, if you're not watching the tree in painstaking detail
> every day, you miss all of these enhancements.

I would assume the other maintainers go at least from time to
time through the i386 diffs and check if they miss anything
(that is what I do). For system calls they do definitely, although
it may take some time.

>
> The knowledge should come from the person putting the changes into
> the tree, therefore it gets done once and this makes it so that
> the other platform maintainers will find out about it automatically
> next time they update their tree.

And causing merging headaches and all kind of other problems.

-Andi

2004-10-21 01:59:48

by Benjamin Herrenschmidt

[permalink] [raw]
Subject: Re: [discuss] Re: [PATCH] Add key management syscalls to non-i386 archs

On Thu, 2004-10-21 at 09:04, David S. Miller wrote:
> On Thu, 21 Oct 2004 00:56:25 +0200
> Andi Kleen <[email protected]> wrote:
>
> > I don't think that's a good idea. Normally new system calls
> > are relatively obscure and the system works fine without them,
> > so urgent action is not needed.
> >
> > And I think we can trust architecture maintainers to regularly
> > sync the system calls with i386.
>
> I disagree quite strongly. One major frustration for users of
> non-x86 platforms is that functionality is often missing for some
> time that we can make trivial to keep in sync.

I agree with David here. It's also easy for arch/platform maintainers to
"miss" a new syscall too ... for various reasons, we can't all read
_everything_ that gets posted to lkml and we all do occasionally miss
some csets going upstream, which means we can very well totally "forget"
about addint the new syscall to the arch ... until somebody complains,
which can be 1 or 2 releases later !

> I religiously watch what goes into Linus's tree for this purpose,
> but that is kind of a rediculious burdon to expect every platform
> maintainer to do. It's not just system calls, we have signal handling
> bug fixes, trap handling infrastructure, and now the nice generic
> IRQ handling subsystem as other examples.

Right.

> Simply put, if you're not watching the tree in painstaking detail
> every day, you miss all of these enhancements.
>
> The knowledge should come from the person putting the changes into
> the tree, therefore it gets done once and this makes it so that
> the other platform maintainers will find out about it automatically
> next time they update their tree.

Agreed,
Ben.

2004-10-20 22:59:56

by David Howells

[permalink] [raw]
Subject: Re: [PATCH] Add key management syscalls to non-i386 archs

> Hey, I already allocated 248 for setaltroot. And no, you cannot
> allocate system calls on your own without going through the
> architecture maintainer. The normal workflow is that you add
> them to i386 and the other follow on their own.

That's what I intended, but others, especially Arjan, seem to think I should
do all the compat stuff for all archs myself.

David

2004-10-21 03:28:59

by Greg Ungerer

[permalink] [raw]
Subject: Re: [uClinux-dev] Re: [PATCH] Add key management syscalls to non-i386 archs

Geert Uytterhoeven wrote:
> On Wed, 20 Oct 2004, David Howells wrote:
>
>>The attached patch adds syscalls for almost all archs (everything barring
>>m68knommu which is in a real mess, and i386 which already has it).
>
>
> m68nommu mirrors m68k now, but that patch doesn't seem to be in Linus' tree
> yet.

Yes, I have a patch to do that brings it into line with m68k.
I need to submit that a bunch of other patches. I am a little
behind :-)

Regards
Greg



------------------------------------------------------------------------
Greg Ungerer -- Chief Software Dude EMAIL: [email protected]
SnapGear -- a CyberGuard Company PHONE: +61 7 3435 2888
825 Stanley St, FAX: +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com

2004-10-20 22:29:59

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] Add key management syscalls to non-i386 archs


David, I applaud your effort to take care of this.
However, this patch will conflict with what I've
sent into Linus already for Sparc. I also had to
add the sys_altroot syscall entry as well.

I've mentioned several times that perhaps the best
way to deal with this problem is to purposefully
break the build of platforms when new system calls
are added.

Simply adding a:

#error new syscall entries for X and Y needed

to include/asm-*/unistd.h would handle this just
fine I think.

That way it won't be missed, and if the platform
maintainer wants to just ignore the new syscall
they can choose to do that as well.

2004-10-21 08:22:50

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [discuss] Re: [PATCH] Add key management syscalls to non-i386 archs

On Wed, 20 Oct 2004, David S. Miller wrote:
> On Thu, 21 Oct 2004 01:25:09 +0200
> Andi Kleen <[email protected]> wrote:
>
> > IMHO breaking the build unnecessarily is extremly bad because
> > it will prevent all testing. And would you really want to hold
> > up the whole linux testing machinery just for some obscure
> > system call? IMHO not a good tradeoff.
>
> Then change the unistd.h cookie from "#error" to a "#warning". It
> accomplishes both of our goals.

Please do so! And not only for syscalls, but also for other things.

That way we can procmail all mails sent to lkml or bk-commits-head that
add #warnings to arch/<arch>/ or include/asm-<arch>/.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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

2004-10-21 08:56:03

by Jan-Benedict Glaw

[permalink] [raw]
Subject: Re: [discuss] Re: [PATCH] Add key management syscalls to non-i386 archs

On Wed, 2004-10-20 16:04:50 -0700, David S. Miller <[email protected]>
wrote in message <[email protected]>:
> On Thu, 21 Oct 2004 00:56:25 +0200
> Andi Kleen <[email protected]> wrote:

*VAX hacker's hat on*

> I disagree quite strongly. One major frustration for users of
> non-x86 platforms is that functionality is often missing for some
> time that we can make trivial to keep in sync.

Full ACK.

> Simply put, if you're not watching the tree in painstaking detail
> every day, you miss all of these enhancements.

Right; and these missing enhancements will cause extra-pain when they're
used some time later from core code. That is, you missed the feature
while it was discusses/accepted and need to put it in place later on. So
you've got to do extra searching etc.

> The knowledge should come from the person putting the changes into
> the tree, therefore it gets done once and this makes it so that
> the other platform maintainers will find out about it automatically
> next time they update their tree.

Here's my proposal:

$ mkdir ./Documentation/new_enhancements_to_implement
$ cat ./Documentation/new_enhancements_to_implement/new_key_syscalls << EOF
> Dear Architecture Maintailers,
>
> please add these four new cryptographic key functions to your syscall
> table. It's quite easy; just extend the ./include/arch-xxx/unistd.h
> for four new defines and then add them to your ./arch/xxx/kernel/entry.S
> file. For reference, here's my i386 patch doing this:
>
> diff -Nurp
> --- path-old/to/file/one
> +++ path-new/to/file/one
> text
> -del
> +add
> more text
>
>
> Thanks, your keychain hacker:-)
> EOF
$

This way, all arch maintainers just *see* what needs to be done and
get a small introduction on how to do that. I'd *really* like to see
that! That would particularly help those that cannot do full-time
hacking on their port (like us VAX hackers:-)

MfG, JBG

--
Jan-Benedict Glaw [email protected] . +49-172-7608481 _ O _
"Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg _ _ O
fuer einen Freien Staat voll Freier B?rger" | im Internet! | im Irak! O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));


Attachments:
(No filename) (2.18 kB)
signature.asc (189.00 B)
Digital signature
Download all attachments

2004-10-21 09:22:33

by Arjan van de Ven

[permalink] [raw]
Subject: Re: [PATCH] Add key management syscalls to non-i386 archs

On Wed, 2004-10-20 at 21:48, David Howells wrote:
> > Hey, I already allocated 248 for setaltroot. And no, you cannot
> > allocate system calls on your own without going through the
> > architecture maintainer. The normal workflow is that you add
> > them to i386 and the other follow on their own.
>
> That's what I intended, but others, especially Arjan, seem to think I should
> do all the compat stuff for all archs myself.

eh please don't abuse my name like that.
I asked for ONE compat emulation thing to show it can be done, that's
not the same as asking for butchering every arch.

2004-10-21 09:11:13

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH] Add key management syscalls to non-i386 archs

On Wed, Oct 20, 2004 at 10:50:27AM -0700, Andrew Morton wrote:
> Christoph Hellwig <[email protected]> wrote:
> >
> > > 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.
> >
> > Umm, that patch added the damn multiplexer that had been vetoed multiple
> > times. Why did this happen?
>
> Fifteen new syscalls was judged excessive and the keyfs interface was
> judged slow and bloaty.

Maybe 15 syscalls just means the API is goddamn awfull and we certainly
shouldn't merge it as-is.

2004-10-21 12:00:41

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH] Add key management syscalls to non-i386 archs

On Middeweken 20 Oktober 2004 16:44, David Howells wrote:

> 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

The comments don't match with the code. Please use the correct
lgfr/llgfr/llgtr opcodes for signed/unsigned/pointer extension.
Note that for keyctl_wrapper, the actual conversion is not static
but depends on the value of %r2. You probably want to code that
conversion in C.

Arnd <><


Attachments:
(No filename) (1.61 kB)
(No filename) (189.00 B)
signature
Download all attachments

2004-10-20 15:53:12

by Matthew Wilcox

[permalink] [raw]
Subject: Re: [parisc-linux] [PATCH] Add key management syscalls to non-i386 archs

On Wed, Oct 20, 2004 at 03:44:15PM +0100, David Howells wrote:
> 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.

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

Um, no. Should be ENTRY_COMP() if there's compat syscalls. And those
particular syscall numbers have already been assigned (blame Linus for
dropping the PA-RISC patch on the floor instead of including it in 2.6.9).

--
"Next the statesmen will invent cheap lies, putting the blame upon
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince
himself that the war is just, and will thank God for the better sleep
he enjoys after this process of grotesque self-deception." -- Mark Twain