Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Returns 0 on success, -errno on denial.

Proto:static int __ptrace_may_access(struct task_struct *task, unsigned int mode)

Type:int

Parameter:

TypeParameterName
struct task_struct *task
unsigned intmode
283  cred = 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.()
288  If Not (mode & PTRACE_MODE_FSCREDS) == Not (mode & PTRACE_MODE_REALCREDS) Then
289  WARN(1, "denying ptrace access check without PTRACE_MODE_*CREDS\n")
290  Return -EPERM
303  If same_thread_group(task, current process) Then Return 0
305  _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
306  If mode & PTRACE_MODE_FSCREDS Then
307  caller_uid = UID for VFS ops
308  caller_gid = GID for VFS ops
309  Else
318  caller_uid = real UID of the task
319  caller_gid = real GID of the task
321  tcred = __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();(task)
322  If uid_eq(caller_uid, effective UID of the task ) && uid_eq(caller_uid, saved UID of the task ) && uid_eq(caller_uid, real UID of the task ) && gid_eq(caller_gid, effective GID of the task ) && gid_eq(caller_gid, saved GID of the task ) && gid_eq(caller_gid, real GID of the task ) Then Go to ok
329  If ptrace_has_cap(cred, user_ns the caps and keyrings are relative to. , mode) Then Go to ok
331  _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()
332  Return -EPERM
333  ok :
334  _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()
344  smp_rmb()
345  mm = mm
346  If mm && get_dumpable(mm) != Dump as user of process && Not ptrace_has_cap(cred, user_ns, mode) Then Return -EPERM
351  Return security_ptrace_access_check(task, mode)
Caller
NameDescribe
ptrace_may_access
ptrace_attach