diff options
Diffstat (limited to 'security/keys/compat.c')
-rw-r--r-- | security/keys/compat.c | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/security/keys/compat.c b/security/keys/compat.c new file mode 100644 index 000000000000..aff8b22dcb5c --- /dev/null +++ b/security/keys/compat.c | |||
@@ -0,0 +1,78 @@ | |||
1 | /* compat.c: 32-bit compatibility syscall for 64-bit systems | ||
2 | * | ||
3 | * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/sched.h> | ||
13 | #include <linux/syscalls.h> | ||
14 | #include <linux/keyctl.h> | ||
15 | #include <linux/compat.h> | ||
16 | #include "internal.h" | ||
17 | |||
18 | /*****************************************************************************/ | ||
19 | /* | ||
20 | * the key control system call, 32-bit compatibility version for 64-bit archs | ||
21 | * - this should only be called if the 64-bit arch uses weird pointers in | ||
22 | * 32-bit mode or doesn't guarantee that the top 32-bits of the argument | ||
23 | * registers on taking a 32-bit syscall are zero | ||
24 | * - if you can, you should call sys_keyctl directly | ||
25 | */ | ||
26 | asmlinkage long compat_sys_keyctl(u32 option, | ||
27 | u32 arg2, u32 arg3, u32 arg4, u32 arg5) | ||
28 | { | ||
29 | switch (option) { | ||
30 | case KEYCTL_GET_KEYRING_ID: | ||
31 | return keyctl_get_keyring_ID(arg2, arg3); | ||
32 | |||
33 | case KEYCTL_JOIN_SESSION_KEYRING: | ||
34 | return keyctl_join_session_keyring(compat_ptr(arg2)); | ||
35 | |||
36 | case KEYCTL_UPDATE: | ||
37 | return keyctl_update_key(arg2, compat_ptr(arg3), arg4); | ||
38 | |||
39 | case KEYCTL_REVOKE: | ||
40 | return keyctl_revoke_key(arg2); | ||
41 | |||
42 | case KEYCTL_DESCRIBE: | ||
43 | return keyctl_describe_key(arg2, compat_ptr(arg3), arg4); | ||
44 | |||
45 | case KEYCTL_CLEAR: | ||
46 | return keyctl_keyring_clear(arg2); | ||
47 | |||
48 | case KEYCTL_LINK: | ||
49 | return keyctl_keyring_link(arg2, arg3); | ||
50 | |||
51 | case KEYCTL_UNLINK: | ||
52 | return keyctl_keyring_unlink(arg2, arg3); | ||
53 | |||
54 | case KEYCTL_SEARCH: | ||
55 | return keyctl_keyring_search(arg2, compat_ptr(arg3), | ||
56 | compat_ptr(arg4), arg5); | ||
57 | |||
58 | case KEYCTL_READ: | ||
59 | return keyctl_read_key(arg2, compat_ptr(arg3), arg4); | ||
60 | |||
61 | case KEYCTL_CHOWN: | ||
62 | return keyctl_chown_key(arg2, arg3, arg4); | ||
63 | |||
64 | case KEYCTL_SETPERM: | ||
65 | return keyctl_setperm_key(arg2, arg3); | ||
66 | |||
67 | case KEYCTL_INSTANTIATE: | ||
68 | return keyctl_instantiate_key(arg2, compat_ptr(arg3), arg4, | ||
69 | arg5); | ||
70 | |||
71 | case KEYCTL_NEGATE: | ||
72 | return keyctl_negate_key(arg2, arg3, arg4); | ||
73 | |||
74 | default: | ||
75 | return -EOPNOTSUPP; | ||
76 | } | ||
77 | |||
78 | } /* end compat_sys_keyctl() */ | ||