函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\ptrace.c Create Date:2022-07-27 10:13:08
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:Returns 0 on success, -errno on denial.

函数原型:static int __ptrace_may_access(struct task_struct *task, unsigned int mode)

返回类型:int

参数:

类型参数名称
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  如果非mode按位与PTRACE_MODE_FSCREDS的值恒等于非mode按位与PTRACE_MODE_REALCREDS的值则
289  WARN(1, "denying ptrace access check without PTRACE_MODE_*CREDS\n")
290  返回:负EPERM
303  如果same_thread_group(task, 当前进程)则返回: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  如果mode按位与PTRACE_MODE_FSCREDS
307  caller_uid等于 UID for VFS ops
308  caller_gid等于 GID for VFS ops
309  否则
318  caller_uid等于进程uid
319  caller_gid等于进程gid
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  如果uid_eq(caller_uid, 有效uid)且uid_eq(caller_uid, 保留uid)且uid_eq(caller_uid, 进程uid)且gid_eq(caller_gid, 有效gid)且gid_eq(caller_gid, 保留gid)且gid_eq(caller_gid, 进程gid)则转到:ok
329  如果ptrace_has_cap(cred, user_ns the caps and keyrings are relative to. , mode)则转到: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  返回:负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等于内存信息
346  如果mmget_dumpable(mm)不等于Dump as user of process 且非ptrace_has_cap(cred, user_ns, mode)则返回:负EPERM
351  返回:security_ptrace_access_check(task, mode)
调用者
名称描述
ptrace_may_access
ptrace_attach