Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\keys\keyctl.c Create Date:2022-07-28 18:21:02
Last Modify:2020-03-18 07:59:52 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Attempt to install the calling process's session keyring on the process's* parent process.* The keyring must exist and must grant the caller LINK permission, and the* parent process must be single-threaded and must have the same effective

Proto:long keyctl_session_to_parent(void)

Type:long

Parameter:Nothing

1559  keyring_r = Look 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
1560  If IS_ERR(keyring_r) Then Return PTR_ERR(keyring_r)
1563  ret = -ENOMEM
1568  cred = Allocate blank credentials, such that the credentials can be filled in at a* later date without risk of ENOMEM.
1569  If Not cred Then Go to error_keyring
1571  newwork = RCU deletion hook
1573  keyring inherited over fork = key_ref_to_ptr(keyring_r)
1574  keyring_r = NULL
1575  init_task_work(newwork, key_change_session_keyring)
1577  me = current process
1578  _read_lock() - mark the beginning of an RCU read-side critical section* When synchronize_rcu() is invoked on one CPU while other CPUs* are within RCU read-side critical sections, then the* synchronize_rcu() is guaranteed to block until after all the other
1579  write_lock_irq( & tasklist_lock)
1581  ret = -EPERM
1582  oldwork = NULL
1583  parent = cu_dereference_protected() - fetch RCU pointer when updates prevented*@p: The pointer to read, prior to dereferencing*@c: The conditions under which the dereference will take place* Return the value of the specified RCU-protected pointer, but omit(real_parent, lockdep_is_held( & tasklist_lock))
1587  If pid <= 1 || Not mm Then Go to unlock
1591  If Not thread_group_empty(parent) Then Go to unlock
1596  mycred = 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.()
1597  pcred = __task_cred - Access a task's objective credentials*@task: The task to query* Access the objective credentials of a task. The caller must hold the RCU* readlock.* The result of this function should not be passed directly to get_cred();(parent)
1598  If mycred == pcred || keyring inherited over fork == keyring inherited over fork Then
1600  ret = 0
1601  Go to unlock
1606  If Not uid_eq( real UID of the task , effective UID of the task ) || Not uid_eq( effective UID of the task , effective UID of the task ) || Not uid_eq( saved UID of the task , effective UID of the task ) || Not gid_eq( real GID of the task , effective GID of the task ) || Not gid_eq( effective GID of the task , effective GID of the task ) || Not gid_eq( saved GID of the task , effective GID of the task ) Then Go to unlock
1615  If keyring inherited over fork && Not uid_eq(uid, effective UID of the task ) || Not uid_eq(uid, effective UID of the task ) Then Go to unlock
1621  oldwork = ask_work_cancel - cancel a pending work added by task_work_add()*@task: the task which should execute the work*@func: identifies the work to remove* Find the last queued pending work with ->func == @func and remove* it from queue.* RETURNS:
1625  ret = ask_work_add - ask the @task to execute @work->func()*@task: the task which should run the callback*@work: the callback to run*@notify: send the notification if true* Queue @work for task_work_run() below and notify the @task if @notify.
1626  If Not ret Then newwork = NULL
1628  unlock :
1629  write_unlock_irq( & tasklist_lock)
1630  _read_unlock() - marks the end of an RCU read-side critical section.* In most situations, rcu_read_unlock() is immune from deadlock.* However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
1631  If oldwork Then put_cred - Release a reference to a set of credentials*@cred: The credentials to release* Release a reference to a set of credentials, deleting them when the last ref* is released
1633  If newwork Then put_cred - Release a reference to a set of credentials*@cred: The credentials to release* Release a reference to a set of credentials, deleting them when the last ref* is released
1635  Return ret
1637  error_keyring :
1638  key_ref_put(keyring_r)
1639  Return ret
Caller
NameDescribe
SYSCALL_DEFINE5The key control system call
COMPAT_SYSCALL_DEFINE5The key control system call, 32-bit compatibility version for 64-bit archs