1 /* keyctl.c: userspace keyctl operations
3 * Copyright (C) 2004-5 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
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.
12 #include <linux/module.h>
13 #include <linux/init.h>
14 #include <linux/sched.h>
15 #include <linux/slab.h>
16 #include <linux/syscalls.h>
17 #include <linux/keyctl.h>
19 #include <linux/capability.h>
20 #include <linux/string.h>
21 #include <linux/err.h>
22 #include <asm/uaccess.h>
25 static int key_get_type_from_user(char *type
,
26 const char __user
*_type
,
31 ret
= strncpy_from_user(type
, _type
, len
);
36 if (ret
== 0 || ret
>= len
)
47 /*****************************************************************************/
49 * extract the description of a new key from userspace and either add it as a
50 * new key to the specified keyring or update a matching key in that keyring
51 * - the keyring must be writable
52 * - returns the new key's serial number
53 * - implements add_key()
55 asmlinkage
long sys_add_key(const char __user
*_type
,
56 const char __user
*_description
,
57 const void __user
*_payload
,
61 key_ref_t keyring_ref
, key_ref
;
62 char type
[32], *description
;
70 /* draw all the data into kernel space */
71 ret
= key_get_type_from_user(type
, _type
, sizeof(type
));
75 description
= strndup_user(_description
, PAGE_SIZE
);
76 if (IS_ERR(description
)) {
77 ret
= PTR_ERR(description
);
81 /* pull the payload in if one was supplied */
86 payload
= kmalloc(plen
, GFP_KERNEL
);
91 if (copy_from_user(payload
, _payload
, plen
) != 0)
95 /* find the target keyring (which must be writable) */
96 keyring_ref
= lookup_user_key(NULL
, ringid
, 1, 0, KEY_WRITE
);
97 if (IS_ERR(keyring_ref
)) {
98 ret
= PTR_ERR(keyring_ref
);
102 /* create or update the requested key and add it to the target
104 key_ref
= key_create_or_update(keyring_ref
, type
, description
,
105 payload
, plen
, KEY_ALLOC_IN_QUOTA
);
106 if (!IS_ERR(key_ref
)) {
107 ret
= key_ref_to_ptr(key_ref
)->serial
;
108 key_ref_put(key_ref
);
111 ret
= PTR_ERR(key_ref
);
114 key_ref_put(keyring_ref
);
122 } /* end sys_add_key() */
124 /*****************************************************************************/
126 * search the process keyrings for a matching key
127 * - nested keyrings may also be searched if they have Search permission
128 * - if a key is found, it will be attached to the destination keyring if
129 * there's one specified
130 * - /sbin/request-key will be invoked if _callout_info is non-NULL
131 * - the _callout_info string will be passed to /sbin/request-key
132 * - if the _callout_info string is empty, it will be rendered as "-"
133 * - implements request_key()
135 asmlinkage
long sys_request_key(const char __user
*_type
,
136 const char __user
*_description
,
137 const char __user
*_callout_info
,
138 key_serial_t destringid
)
140 struct key_type
*ktype
;
143 char type
[32], *description
, *callout_info
;
146 /* pull the type into kernel space */
147 ret
= key_get_type_from_user(type
, _type
, sizeof(type
));
151 /* pull the description into kernel space */
152 description
= strndup_user(_description
, PAGE_SIZE
);
153 if (IS_ERR(description
)) {
154 ret
= PTR_ERR(description
);
158 /* pull the callout info into kernel space */
161 callout_info
= strndup_user(_callout_info
, PAGE_SIZE
);
162 if (IS_ERR(callout_info
)) {
163 ret
= PTR_ERR(callout_info
);
168 /* get the destination keyring if specified */
171 dest_ref
= lookup_user_key(NULL
, destringid
, 1, 0, KEY_WRITE
);
172 if (IS_ERR(dest_ref
)) {
173 ret
= PTR_ERR(dest_ref
);
178 /* find the key type */
179 ktype
= key_type_lookup(type
);
181 ret
= PTR_ERR(ktype
);
186 key
= request_key_and_link(ktype
, description
, callout_info
,
187 key_ref_to_ptr(dest_ref
),
200 key_ref_put(dest_ref
);
208 } /* end sys_request_key() */
210 /*****************************************************************************/
212 * get the ID of the specified process keyring
213 * - the keyring must have search permission to be found
214 * - implements keyctl(KEYCTL_GET_KEYRING_ID)
216 long keyctl_get_keyring_ID(key_serial_t id
, int create
)
221 key_ref
= lookup_user_key(NULL
, id
, create
, 0, KEY_SEARCH
);
222 if (IS_ERR(key_ref
)) {
223 ret
= PTR_ERR(key_ref
);
227 ret
= key_ref_to_ptr(key_ref
)->serial
;
228 key_ref_put(key_ref
);
232 } /* end keyctl_get_keyring_ID() */
234 /*****************************************************************************/
236 * join the session keyring
237 * - implements keyctl(KEYCTL_JOIN_SESSION_KEYRING)
239 long keyctl_join_session_keyring(const char __user
*_name
)
244 /* fetch the name from userspace */
247 name
= strndup_user(_name
, PAGE_SIZE
);
254 /* join the session */
255 ret
= join_session_keyring(name
);
260 } /* end keyctl_join_session_keyring() */
262 /*****************************************************************************/
264 * update a key's data payload
265 * - the key must be writable
266 * - implements keyctl(KEYCTL_UPDATE)
268 long keyctl_update_key(key_serial_t id
,
269 const void __user
*_payload
,
277 if (plen
> PAGE_SIZE
)
280 /* pull the payload in if one was supplied */
284 payload
= kmalloc(plen
, GFP_KERNEL
);
289 if (copy_from_user(payload
, _payload
, plen
) != 0)
293 /* find the target key (which must be writable) */
294 key_ref
= lookup_user_key(NULL
, id
, 0, 0, KEY_WRITE
);
295 if (IS_ERR(key_ref
)) {
296 ret
= PTR_ERR(key_ref
);
301 ret
= key_update(key_ref
, payload
, plen
);
303 key_ref_put(key_ref
);
309 } /* end keyctl_update_key() */
311 /*****************************************************************************/
314 * - the key must be writable
315 * - implements keyctl(KEYCTL_REVOKE)
317 long keyctl_revoke_key(key_serial_t id
)
322 key_ref
= lookup_user_key(NULL
, id
, 0, 0, KEY_WRITE
);
323 if (IS_ERR(key_ref
)) {
324 ret
= PTR_ERR(key_ref
);
328 key_revoke(key_ref_to_ptr(key_ref
));
331 key_ref_put(key_ref
);
335 } /* end keyctl_revoke_key() */
337 /*****************************************************************************/
339 * clear the specified process keyring
340 * - the keyring must be writable
341 * - implements keyctl(KEYCTL_CLEAR)
343 long keyctl_keyring_clear(key_serial_t ringid
)
345 key_ref_t keyring_ref
;
348 keyring_ref
= lookup_user_key(NULL
, ringid
, 1, 0, KEY_WRITE
);
349 if (IS_ERR(keyring_ref
)) {
350 ret
= PTR_ERR(keyring_ref
);
354 ret
= keyring_clear(key_ref_to_ptr(keyring_ref
));
356 key_ref_put(keyring_ref
);
360 } /* end keyctl_keyring_clear() */
362 /*****************************************************************************/
364 * link a key into a keyring
365 * - the keyring must be writable
366 * - the key must be linkable
367 * - implements keyctl(KEYCTL_LINK)
369 long keyctl_keyring_link(key_serial_t id
, key_serial_t ringid
)
371 key_ref_t keyring_ref
, key_ref
;
374 keyring_ref
= lookup_user_key(NULL
, ringid
, 1, 0, KEY_WRITE
);
375 if (IS_ERR(keyring_ref
)) {
376 ret
= PTR_ERR(keyring_ref
);
380 key_ref
= lookup_user_key(NULL
, id
, 1, 0, KEY_LINK
);
381 if (IS_ERR(key_ref
)) {
382 ret
= PTR_ERR(key_ref
);
386 ret
= key_link(key_ref_to_ptr(keyring_ref
), key_ref_to_ptr(key_ref
));
388 key_ref_put(key_ref
);
390 key_ref_put(keyring_ref
);
394 } /* end keyctl_keyring_link() */
396 /*****************************************************************************/
398 * unlink the first attachment of a key from a keyring
399 * - the keyring must be writable
400 * - we don't need any permissions on the key
401 * - implements keyctl(KEYCTL_UNLINK)
403 long keyctl_keyring_unlink(key_serial_t id
, key_serial_t ringid
)
405 key_ref_t keyring_ref
, key_ref
;
408 keyring_ref
= lookup_user_key(NULL
, ringid
, 0, 0, KEY_WRITE
);
409 if (IS_ERR(keyring_ref
)) {
410 ret
= PTR_ERR(keyring_ref
);
414 key_ref
= lookup_user_key(NULL
, id
, 0, 0, 0);
415 if (IS_ERR(key_ref
)) {
416 ret
= PTR_ERR(key_ref
);
420 ret
= key_unlink(key_ref_to_ptr(keyring_ref
), key_ref_to_ptr(key_ref
));
422 key_ref_put(key_ref
);
424 key_ref_put(keyring_ref
);
428 } /* end keyctl_keyring_unlink() */
430 /*****************************************************************************/
432 * describe a user key
433 * - the key must have view permission
434 * - if there's a buffer, we place up to buflen bytes of data into it
435 * - unless there's an error, we return the amount of description available,
436 * irrespective of how much we may have copied
437 * - the description is formatted thus:
438 * type;uid;gid;perm;description<NUL>
439 * - implements keyctl(KEYCTL_DESCRIBE)
441 long keyctl_describe_key(key_serial_t keyid
,
445 struct key
*key
, *instkey
;
450 key_ref
= lookup_user_key(NULL
, keyid
, 0, 1, KEY_VIEW
);
451 if (IS_ERR(key_ref
)) {
452 /* viewing a key under construction is permitted if we have the
453 * authorisation token handy */
454 if (PTR_ERR(key_ref
) == -EACCES
) {
455 instkey
= key_get_instantiation_authkey(keyid
);
456 if (!IS_ERR(instkey
)) {
458 key_ref
= lookup_user_key(NULL
, keyid
,
460 if (!IS_ERR(key_ref
))
465 ret
= PTR_ERR(key_ref
);
470 /* calculate how much description we're going to return */
472 tmpbuf
= kmalloc(PAGE_SIZE
, GFP_KERNEL
);
476 key
= key_ref_to_ptr(key_ref
);
478 ret
= snprintf(tmpbuf
, PAGE_SIZE
- 1,
480 key_ref_to_ptr(key_ref
)->type
->name
,
481 key_ref_to_ptr(key_ref
)->uid
,
482 key_ref_to_ptr(key_ref
)->gid
,
483 key_ref_to_ptr(key_ref
)->perm
,
484 key_ref_to_ptr(key_ref
)->description
?
485 key_ref_to_ptr(key_ref
)->description
: ""
488 /* include a NUL char at the end of the data */
489 if (ret
> PAGE_SIZE
- 1)
494 /* consider returning the data */
495 if (buffer
&& buflen
> 0) {
499 if (copy_to_user(buffer
, tmpbuf
, buflen
) != 0)
505 key_ref_put(key_ref
);
509 } /* end keyctl_describe_key() */
511 /*****************************************************************************/
513 * search the specified keyring for a matching key
514 * - the start keyring must be searchable
515 * - nested keyrings may also be searched if they are searchable
516 * - only keys with search permission may be found
517 * - if a key is found, it will be attached to the destination keyring if
518 * there's one specified
519 * - implements keyctl(KEYCTL_SEARCH)
521 long keyctl_keyring_search(key_serial_t ringid
,
522 const char __user
*_type
,
523 const char __user
*_description
,
524 key_serial_t destringid
)
526 struct key_type
*ktype
;
527 key_ref_t keyring_ref
, key_ref
, dest_ref
;
528 char type
[32], *description
;
531 /* pull the type and description into kernel space */
532 ret
= key_get_type_from_user(type
, _type
, sizeof(type
));
536 description
= strndup_user(_description
, PAGE_SIZE
);
537 if (IS_ERR(description
)) {
538 ret
= PTR_ERR(description
);
542 /* get the keyring at which to begin the search */
543 keyring_ref
= lookup_user_key(NULL
, ringid
, 0, 0, KEY_SEARCH
);
544 if (IS_ERR(keyring_ref
)) {
545 ret
= PTR_ERR(keyring_ref
);
549 /* get the destination keyring if specified */
552 dest_ref
= lookup_user_key(NULL
, destringid
, 1, 0, KEY_WRITE
);
553 if (IS_ERR(dest_ref
)) {
554 ret
= PTR_ERR(dest_ref
);
559 /* find the key type */
560 ktype
= key_type_lookup(type
);
562 ret
= PTR_ERR(ktype
);
567 key_ref
= keyring_search(keyring_ref
, ktype
, description
);
568 if (IS_ERR(key_ref
)) {
569 ret
= PTR_ERR(key_ref
);
571 /* treat lack or presence of a negative key the same */
577 /* link the resulting key to the destination keyring if we can */
579 ret
= key_permission(key_ref
, KEY_LINK
);
583 ret
= key_link(key_ref_to_ptr(dest_ref
), key_ref_to_ptr(key_ref
));
588 ret
= key_ref_to_ptr(key_ref
)->serial
;
591 key_ref_put(key_ref
);
595 key_ref_put(dest_ref
);
597 key_ref_put(keyring_ref
);
603 } /* end keyctl_keyring_search() */
605 /*****************************************************************************/
607 * read a user key's payload
608 * - the keyring must be readable or the key must be searchable from the
610 * - if there's a buffer, we place up to buflen bytes of data into it
611 * - unless there's an error, we return the amount of data in the key,
612 * irrespective of how much we may have copied
613 * - implements keyctl(KEYCTL_READ)
615 long keyctl_read_key(key_serial_t keyid
, char __user
*buffer
, size_t buflen
)
621 /* find the key first */
622 key_ref
= lookup_user_key(NULL
, keyid
, 0, 0, 0);
623 if (IS_ERR(key_ref
)) {
628 key
= key_ref_to_ptr(key_ref
);
630 /* see if we can read it directly */
631 ret
= key_permission(key_ref
, KEY_READ
);
637 /* we can't; see if it's searchable from this process's keyrings
638 * - we automatically take account of the fact that it may be
639 * dangling off an instantiation key
641 if (!is_key_possessed(key_ref
)) {
646 /* the key is probably readable - now try to read it */
648 ret
= key_validate(key
);
651 if (key
->type
->read
) {
652 /* read the data with the semaphore held (since we
654 down_read(&key
->sem
);
655 ret
= key
->type
->read(key
, buffer
, buflen
);
665 } /* end keyctl_read_key() */
667 /*****************************************************************************/
669 * change the ownership of a key
670 * - the keyring owned by the changer
671 * - if the uid or gid is -1, then that parameter is not changed
672 * - implements keyctl(KEYCTL_CHOWN)
674 long keyctl_chown_key(key_serial_t id
, uid_t uid
, gid_t gid
)
681 if (uid
== (uid_t
) -1 && gid
== (gid_t
) -1)
684 key_ref
= lookup_user_key(NULL
, id
, 1, 1, KEY_SETATTR
);
685 if (IS_ERR(key_ref
)) {
686 ret
= PTR_ERR(key_ref
);
690 key
= key_ref_to_ptr(key_ref
);
692 /* make the changes with the locks held to prevent chown/chown races */
694 down_write(&key
->sem
);
696 if (!capable(CAP_SYS_ADMIN
)) {
697 /* only the sysadmin can chown a key to some other UID */
698 if (uid
!= (uid_t
) -1 && key
->uid
!= uid
)
701 /* only the sysadmin can set the key's GID to a group other
702 * than one of those that the current process subscribes to */
703 if (gid
!= (gid_t
) -1 && gid
!= key
->gid
&& !in_group_p(gid
))
707 /* change the UID (have to update the quotas) */
708 if (uid
!= (uid_t
) -1 && uid
!= key
->uid
) {
709 /* don't support UID changing yet */
715 if (gid
!= (gid_t
) -1)
726 } /* end keyctl_chown_key() */
728 /*****************************************************************************/
730 * change the permission mask on a key
731 * - the keyring owned by the changer
732 * - implements keyctl(KEYCTL_SETPERM)
734 long keyctl_setperm_key(key_serial_t id
, key_perm_t perm
)
741 if (perm
& ~(KEY_POS_ALL
| KEY_USR_ALL
| KEY_GRP_ALL
| KEY_OTH_ALL
))
744 key_ref
= lookup_user_key(NULL
, id
, 1, 1, KEY_SETATTR
);
745 if (IS_ERR(key_ref
)) {
746 ret
= PTR_ERR(key_ref
);
750 key
= key_ref_to_ptr(key_ref
);
752 /* make the changes with the locks held to prevent chown/chmod races */
754 down_write(&key
->sem
);
756 /* if we're not the sysadmin, we can only change a key that we own */
757 if (capable(CAP_SYS_ADMIN
) || key
->uid
== current
->fsuid
) {
767 } /* end keyctl_setperm_key() */
769 /*****************************************************************************/
771 * instantiate the key with the specified payload, and, if one is given, link
772 * the key into the keyring
774 long keyctl_instantiate_key(key_serial_t id
,
775 const void __user
*_payload
,
779 struct request_key_auth
*rka
;
781 key_ref_t keyring_ref
;
789 /* the appropriate instantiation authorisation key must have been
790 * assumed before calling this */
792 instkey
= current
->request_key_auth
;
796 rka
= instkey
->payload
.data
;
797 if (rka
->target_key
->serial
!= id
)
800 /* pull the payload in if one was supplied */
805 payload
= kmalloc(plen
, GFP_KERNEL
);
810 if (copy_from_user(payload
, _payload
, plen
) != 0)
814 /* find the destination keyring amongst those belonging to the
818 keyring_ref
= lookup_user_key(rka
->context
, ringid
, 1, 0,
820 if (IS_ERR(keyring_ref
)) {
821 ret
= PTR_ERR(keyring_ref
);
826 /* instantiate the key and link it into a keyring */
827 ret
= key_instantiate_and_link(rka
->target_key
, payload
, plen
,
828 key_ref_to_ptr(keyring_ref
), instkey
);
830 key_ref_put(keyring_ref
);
832 /* discard the assumed authority if it's just been disabled by
833 * instantiation of the key */
835 key_put(current
->request_key_auth
);
836 current
->request_key_auth
= NULL
;
844 } /* end keyctl_instantiate_key() */
846 /*****************************************************************************/
848 * negatively instantiate the key with the given timeout (in seconds), and, if
849 * one is given, link the key into the keyring
851 long keyctl_negate_key(key_serial_t id
, unsigned timeout
, key_serial_t ringid
)
853 struct request_key_auth
*rka
;
855 key_ref_t keyring_ref
;
858 /* the appropriate instantiation authorisation key must have been
859 * assumed before calling this */
861 instkey
= current
->request_key_auth
;
865 rka
= instkey
->payload
.data
;
866 if (rka
->target_key
->serial
!= id
)
869 /* find the destination keyring if present (which must also be
873 keyring_ref
= lookup_user_key(NULL
, ringid
, 1, 0, KEY_WRITE
);
874 if (IS_ERR(keyring_ref
)) {
875 ret
= PTR_ERR(keyring_ref
);
880 /* instantiate the key and link it into a keyring */
881 ret
= key_negate_and_link(rka
->target_key
, timeout
,
882 key_ref_to_ptr(keyring_ref
), instkey
);
884 key_ref_put(keyring_ref
);
886 /* discard the assumed authority if it's just been disabled by
887 * instantiation of the key */
889 key_put(current
->request_key_auth
);
890 current
->request_key_auth
= NULL
;
896 } /* end keyctl_negate_key() */
898 /*****************************************************************************/
900 * set the default keyring in which request_key() will cache keys
901 * - return the old setting
903 long keyctl_set_reqkey_keyring(int reqkey_defl
)
907 switch (reqkey_defl
) {
908 case KEY_REQKEY_DEFL_THREAD_KEYRING
:
909 ret
= install_thread_keyring(current
);
914 case KEY_REQKEY_DEFL_PROCESS_KEYRING
:
915 ret
= install_process_keyring(current
);
919 case KEY_REQKEY_DEFL_DEFAULT
:
920 case KEY_REQKEY_DEFL_SESSION_KEYRING
:
921 case KEY_REQKEY_DEFL_USER_KEYRING
:
922 case KEY_REQKEY_DEFL_USER_SESSION_KEYRING
:
924 current
->jit_keyring
= reqkey_defl
;
926 case KEY_REQKEY_DEFL_NO_CHANGE
:
927 return current
->jit_keyring
;
929 case KEY_REQKEY_DEFL_GROUP_KEYRING
:
934 } /* end keyctl_set_reqkey_keyring() */
936 /*****************************************************************************/
938 * set or clear the timeout for a key
940 long keyctl_set_timeout(key_serial_t id
, unsigned timeout
)
948 key_ref
= lookup_user_key(NULL
, id
, 1, 1, KEY_SETATTR
);
949 if (IS_ERR(key_ref
)) {
950 ret
= PTR_ERR(key_ref
);
954 key
= key_ref_to_ptr(key_ref
);
956 /* make the changes with the locks held to prevent races */
957 down_write(&key
->sem
);
961 now
= current_kernel_time();
962 expiry
= now
.tv_sec
+ timeout
;
965 key
->expiry
= expiry
;
974 } /* end keyctl_set_timeout() */
976 /*****************************************************************************/
978 * assume the authority to instantiate the specified key
980 long keyctl_assume_authority(key_serial_t id
)
985 /* special key IDs aren't permitted */
990 /* we divest ourselves of authority if given an ID of 0 */
992 key_put(current
->request_key_auth
);
993 current
->request_key_auth
= NULL
;
998 /* attempt to assume the authority temporarily granted to us whilst we
999 * instantiate the specified key
1000 * - the authorisation key must be in the current task's keyrings
1003 authkey
= key_get_instantiation_authkey(id
);
1004 if (IS_ERR(authkey
)) {
1005 ret
= PTR_ERR(authkey
);
1009 key_put(current
->request_key_auth
);
1010 current
->request_key_auth
= authkey
;
1011 ret
= authkey
->serial
;
1016 } /* end keyctl_assume_authority() */
1018 /*****************************************************************************/
1020 * the key control system call
1022 asmlinkage
long sys_keyctl(int option
, unsigned long arg2
, unsigned long arg3
,
1023 unsigned long arg4
, unsigned long arg5
)
1026 case KEYCTL_GET_KEYRING_ID
:
1027 return keyctl_get_keyring_ID((key_serial_t
) arg2
,
1030 case KEYCTL_JOIN_SESSION_KEYRING
:
1031 return keyctl_join_session_keyring((const char __user
*) arg2
);
1034 return keyctl_update_key((key_serial_t
) arg2
,
1035 (const void __user
*) arg3
,
1039 return keyctl_revoke_key((key_serial_t
) arg2
);
1041 case KEYCTL_DESCRIBE
:
1042 return keyctl_describe_key((key_serial_t
) arg2
,
1043 (char __user
*) arg3
,
1047 return keyctl_keyring_clear((key_serial_t
) arg2
);
1050 return keyctl_keyring_link((key_serial_t
) arg2
,
1051 (key_serial_t
) arg3
);
1054 return keyctl_keyring_unlink((key_serial_t
) arg2
,
1055 (key_serial_t
) arg3
);
1058 return keyctl_keyring_search((key_serial_t
) arg2
,
1059 (const char __user
*) arg3
,
1060 (const char __user
*) arg4
,
1061 (key_serial_t
) arg5
);
1064 return keyctl_read_key((key_serial_t
) arg2
,
1065 (char __user
*) arg3
,
1069 return keyctl_chown_key((key_serial_t
) arg2
,
1073 case KEYCTL_SETPERM
:
1074 return keyctl_setperm_key((key_serial_t
) arg2
,
1077 case KEYCTL_INSTANTIATE
:
1078 return keyctl_instantiate_key((key_serial_t
) arg2
,
1079 (const void __user
*) arg3
,
1081 (key_serial_t
) arg5
);
1084 return keyctl_negate_key((key_serial_t
) arg2
,
1086 (key_serial_t
) arg4
);
1088 case KEYCTL_SET_REQKEY_KEYRING
:
1089 return keyctl_set_reqkey_keyring(arg2
);
1091 case KEYCTL_SET_TIMEOUT
:
1092 return keyctl_set_timeout((key_serial_t
) arg2
,
1095 case KEYCTL_ASSUME_AUTHORITY
:
1096 return keyctl_assume_authority((key_serial_t
) arg2
);
1102 } /* end sys_keyctl() */