Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:ptrace_attach

Proto:static int ptrace_attach(struct task_struct *task, long request, unsigned long addr, unsigned long flags)

Type:int

Parameter:

TypeParameterName
struct task_struct *task
longrequest
unsigned longaddr
unsigned longflags
367  seize = request == PTRACE_SEIZE
370  retval = -EIO
371  If seize Then
372  If addr != 0 Then Go to out
374  If flags & ~PTRACE_O_MASK Then Go to out
376  flags = PT_PTRACED | SEIZE used, enable new behavior | flags << PT_OPT_FLAG_SHIFT
377  Else
378  flags = PT_PTRACED
381  audit_ptrace(task)
383  retval = -EPERM
384  If Value for the false possibility is greater at compile time( Per task flags (PF_*), defined further below: & I am a kernel thread ) Then Go to out
386  If same_thread_group(task, current process) Then Go to out
394  retval = -ERESTARTNOINTR
395  If mutex_lock_interruptible( & cred_guard_mutex) Then Go to 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  If retval Then Go to unlock_creds
404  write_lock_irq( & tasklist_lock)
405  retval = -EPERM
406  If Value for the false possibility is greater at compile time(exit state) Then Go to unlock_tasklist
408  If ptrace Then Go to unlock_tasklist
411  If seize Then flags |= 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  If Not seize Then send_sig_info(SIGSTOP, SEND_SIG_PRIV, task)
421  spin_lock( & siglock)
440  If task_is_stopped(task) && task_set_jobctl_pending(task, JOBCTL_TRAP_STOP | JOBCTL_TRAPPING) Then signal_wake_up_state(task, __TASK_STOPPED)
444  spin_unlock( & siglock)
446  retval = 0
447  unlock_tasklist :
448  write_unlock_irq( & tasklist_lock)
449  unlock_creds :
450  mutex_unlock( & cred_guard_mutex)
451  out :
452  If Not retval Then
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  Return retval
Caller
NameDescribe
SYSCALL_DEFINE4
COMPAT_SYSCALL_DEFINE4