Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\keys\process_keys.c Create Date:2022-07-28 18:22:49
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Join the named keyring as the session keyring if possible else attempt to* create a new one of that name and join that

Proto:long join_session_keyring(const char *name)

Type:long

Parameter:

TypeParameterName
const char *name
845  new = prepare_creds - Prepare a new set of credentials for modification* Prepare a new set of task credentials for modification
846  If Not new Then Return -ENOMEM
848  old = current_cred - Access the current task's subjective credentials* Access the subjective credentials of the current task. RCU-safe,* since nobody else can modify it.()
851  If Not name Then
852  ret = Install the given keyring as the session keyring of the given credentials* struct, replacing the existing one if any. If the given keyring is NULL,* then install a new anonymous session keyring.*@cred can not be in use by any task yet.
853  If ret < 0 Then Go to error
856  serial = key serial number
857  ret = mmit_creds - Install new credentials upon the current task*@new: The credentials to be assigned* Install a new set of credentials to the current task, using RCU to replace* the old set. Both the objective and the subjective credentials pointers are
858  If ret == 0 Then ret = serial
860  Go to okay
864  mutex_lock( & Session keyring create vs join semaphore )
867  keyring = Find a keyring with the specified name
868  If PTR_ERR(keyring) == -ENOKEY Then
870  keyring = Allocate a keyring and link into the destination keyring.
874  If IS_ERR(keyring) Then
875  ret = PTR_ERR(keyring)
876  Go to error2
878  Else if IS_ERR(keyring) Then
879  ret = PTR_ERR(keyring)
880  Go to error2
881  Else if keyring == keyring inherited over fork Then
882  ret = 0
883  Go to error3
887  ret = Install the given keyring as the session keyring of the given credentials* struct, replacing the existing one if any. If the given keyring is NULL,* then install a new anonymous session keyring.*@cred can not be in use by any task yet.
888  If ret < 0 Then Go to error3
891  mmit_creds - Install new credentials upon the current task*@new: The credentials to be assigned* Install a new set of credentials to the current task, using RCU to replace* the old set. Both the objective and the subjective credentials pointers are
892  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
894  ret = key serial number
895  key_put - Discard a reference to a key.*@key: The key to discard a reference from.* Discard a reference to a key, and when all the references are gone, we* schedule the cleanup task to come and pull it out of the tree in process
896  okay :
897  Return ret
899  error3 :
900  key_put - Discard a reference to a key.*@key: The key to discard a reference from.* Discard a reference to a key, and when all the references are gone, we* schedule the cleanup task to come and pull it out of the tree in process
901  error2 :
902  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
903  error :
904  abort_creds - Discard a set of credentials and unlock the current task*@new: The credentials that were going to be applied* Discard a set of credentials that were under construction and unlock the* current task.
905  Return ret
Caller
NameDescribe
lookup_user_keyLook up a key ID given us by userspace with a given permissions mask to get* the key it refers to.* Flags can be passed to request that special keyrings be created if referred* to directly, to permit partially constructed keys to be found and to skip
keyctl_join_session_keyringJoin a (named) session keyring.* Create and join an anonymous session keyring or join a named session* keyring, creating it if necessary. A named session keyring must have Search* permission for it to be joined. Session keyrings without this permit will