函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:ptrace_attach

函数原型:static int ptrace_attach(struct task_struct *task, long request, unsigned long addr, unsigned long flags)

返回类型:int

参数:

类型参数名称
struct task_struct *task
longrequest
unsigned longaddr
unsigned longflags
367  seize等于request恒等于PTRACE_SEIZE
370  retval等于负EIO
371  如果seize
372  如果addr不等于0则转到:out
374  如果flags按位与PTRACE_O_MASK的反则转到:out
376  flags等于PT_PTRACED按位或SEIZE used, enable new behavior 按位或flags左移PT_OPT_FLAG_SHIFT
377  否则
378  flags等于PT_PTRACED
381  audit_ptrace(task)
383  retval等于负EPERM
384  如果此条件成立可能性小(为编译器优化)(任务标志 & I am a kernel thread )则转到:out
386  如果same_thread_group(task, 当前进程)则转到:out
394  retval等于负ERESTARTNOINTR
395  如果mutex_lock_interruptible( & cred_guard_mutex)则转到:out
398  Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring* subscriptions and synchronises with wait4(). Also used in procfs. Also* pins the final release of task.io_context. Also protects ->cpuset and* ->cgroup.subsys[]. And ->vfork_done.
399  retval等于Returns 0 on success, -errno on denial.
400  task_unlock(task)
401  如果retval则转到:unlock_creds
404  write_lock_irq( & tasklist_lock)
405  retval等于负EPERM
406  如果此条件成立可能性小(为编译器优化)(进程退出时状态)则转到:unlock_tasklist
408  如果ptrace则转到:unlock_tasklist
411  如果seizeflags或等于SEIZE used, enable new behavior
413  ptrace等于flags
415  ptrace a task: make the debugger its new parent and* move it to the ptrace list.* Must be called with the tasklist lock write-held.
418  如果非seize信号发送入口
421  加自旋锁
440  如果task_is_stopped(task)且task_set_jobctl_pending(task, JOBCTL_TRAP_STOP | JOBCTL_TRAPPING)则signal_wake_up_state(task, __TASK_STOPPED)
444  自旋锁解锁
446  retval等于0
447  unlock_tasklist :
448  write_unlock_irq( & tasklist_lock)
449  unlock_creds :
450  mutex_unlock( & cred_guard_mutex)
451  out :
452  如果非retval
460  wait_on_bit - wait for a bit to be cleared*@word: the word being waited on, a kernel virtual address*@bit: the bit of the word being waited on*@mode: the task state to sleep in* There is a standard hashed waitqueue table for generic use. This
461  proc_ptrace_connector(task, PTRACE_ATTACH)
464  返回:retval
调用者
名称描述
SYSCALL_DEFINE4
COMPAT_SYSCALL_DEFINE4