Make key management syscalls work on PPC/PPC64
Subsystems (2)
David Howells
maintainerPATCH 1/1 Make key management syscalls work on PPC/PPC64
The attached patch permits my key management stuff to be used on PPC, PPC64 and PPC on PPC64. Syscall numbers were allocated by Paul Mackerras.
I've updated my keyctl utility to work on PPC/PPC64 too:
http://people.redhat.com/~dhowells/keys/keyctl.c
Signed-off-by David Howells <[email protected]>
---
warthog>diffstat keys-269bk5.diff
arch/ppc/kernel/misc.S | 3 + arch/ppc64/Kconfig | 5 ++ arch/ppc64/kernel/misc.S | 6 +++ arch/ppc64/kernel/sys_ppc32.c | 18 +++++++++ include/asm-ppc/unistd.h | 5 ++ include/asm-ppc64/unistd.h | 5 ++ include/linux/compat.h | 2 + security/keys/Makefile | 1 security/keys/compat.c | 78 ++++++++++++++++++++++++++++++++++++++++++ security/keys/internal.h | 20 ++++++++++ security/keys/keyctl.c | 54 +++++++++++++---------------- 11 files changed, 166 insertions(+), 31 deletions(-)
arch/ppc/kernel/misc.S +3 -0
@@ -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
arch/ppc64/Kconfig +5 -0
@@ -356,6 +356,11 @@ source "arch/ppc64/Kconfig.debug" source "security/Kconfig" +config KEYS_COMPAT + bool + depends on COMPAT && KEYS + default y + source "crypto/Kconfig" source "lib/Kconfig"
arch/ppc64/kernel/misc.S +6 -0
@@ -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 .compat_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
arch/ppc64/kernel/sys_ppc32.c +18 -0
@@ -1328,3 +1328,21 @@ 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) +{ +return sys_add_key (_type, _description, _payload, plen, ringid); +} + +asmlinkage long sys32_request_key (const char __user *_type, +const char __user *_description, +const char __user *_callout_info, +u32 destringid) +{ +return sys_request_key (_type, _description, _callout_info, destringid); +} +
include/asm-ppc/unistd.h +4 -1
@@ -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
include/asm-ppc64/unistd.h +4 -1
@@ -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
include/linux/compat.h +2 -0
@@ -119,6 +119,8 @@ long compat_sys_shmat(int first, int seclong compat_sys_shmctl (int first,int second,void __user *uptr);long compat_sys_semtimedop (int semid,struct sembuf __user *tsems,unsigned nsems,const struct compat_timespec __user *timeout); +asmlinkage long compat_keyctl (u32 option, +u32 arg2,u32 arg3,u32 arg4,u32 arg5); asmlinkage ssize_t compat_sys_readv(unsigned long fd,const struct compat_iovec __user *vec,unsigned long vlen);
security/keys/compat.c +78 -0
78 lines not on this page · raw message
security/keys/internal.h +20 -0
@@ -81,6 +81,26 @@ extern struct key *find_keyring_by_name(extern int install_thread_keyring (struct task_struct *tsk); +/* +* keyctl functions +*/ +extern long keyctl_get_keyring_ID (key_serial_t ,int ); +extern long keyctl_join_session_keyring (const char __user *); +extern long keyctl_update_key (key_serial_t ,const void __user *,size_t ); +extern long keyctl_revoke_key (key_serial_t ); +extern long keyctl_keyring_clear (key_serial_t ); +extern long keyctl_keyring_link (key_serial_t ,key_serial_t ); +extern long keyctl_keyring_unlink (key_serial_t ,key_serial_t ); +extern long keyctl_describe_key (key_serial_t ,char __user *,size_t ); +extern long keyctl_keyring_search (key_serial_t ,const char __user *, +const char __user *,key_serial_t ); +extern long keyctl_read_key (key_serial_t ,char __user *,size_t ); +extern long keyctl_chown_key (key_serial_t ,uid_t ,gid_t ); +extern long keyctl_setperm_key (key_serial_t ,key_perm_t ); +extern long keyctl_instantiate_key (key_serial_t ,const void __user *, +size_t ,key_serial_t ); +extern long keyctl_negate_key (key_serial_t ,unsigned ,key_serial_t ); +/* * debugging key validation
security/keys/keyctl.c +25 -29
150 lines not on this page · raw message
security/keys/Makefile +1 -0
@@ -10,4 +10,5 @@ obj-y := \ user_defined.o \ request_key.o +obj-$(CONFIG_KEYS_COMPAT) += compat.o obj-$(CONFIG_PROC_FS) += proc.o
Quoted 3 lines · David Howells
The attached patch permits my key management stuff to be used on PPC, PPC64
and PPC on PPC64.
Please remember to test your patches with CONFIG_KEYS=n
kernel/sys.c renamed from kernel/sys.c~ppc-ppc64-make-key-management-syscalls-work-fix +1 -0
@@ -286,6 +286,7 @@ cond_syscall(compat_set_mempolicy) cond_syscall(sys_add_key) cond_syscall(sys_request_key) cond_syscall(sys_keyctl) +cond_syscall(compat_keyctl) cond_syscall(compat_sys_socketcall)/* arch-specific weak syscall entries */
_