github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/linux/test/landlock_ptrace (about)

     1  # Creates independent Landlock hierarchies and try different tracer/tracee
     2  # schemas (without scheduling control).
     3  
     4  capset(&AUTO={0x20080522, 0x0}, &AUTO={0x0, 0x0, 0x0, 0x0, 0x0, 0x0})
     5  prctl$PR_SET_NO_NEW_PRIVS(0x26, 0x1)
     6  
     7  r0 = syz_clone(0x11, 0x0, 0x0, 0x0, 0x0, 0x0)
     8  
     9  # PTRACE_ATTACH and PTRACE_DETACH
    10  
    11  ptrace(0x10, r0)
    12  ptrace(0x11, r0)
    13  
    14  r1 = landlock_create_ruleset(&AUTO={0x100, 0x0}, AUTO, 0x0)
    15  landlock_restrict_self(r1, 0x0)
    16  
    17  r2 = syz_clone(0x11, 0x0, 0x0, 0x0, 0x0, 0x0)
    18  
    19  ptrace(0x10, r0)
    20  ptrace(0x11, r0)
    21  
    22  ptrace(0x10, r2)
    23  ptrace(0x11, r2)
    24  
    25  r3 = landlock_create_ruleset(&AUTO={0x100, 0x0}, AUTO, 0x0)
    26  landlock_restrict_self(r3, 0x0)
    27  
    28  ptrace(0x10, r0)
    29  ptrace(0x11, r0)
    30  
    31  ptrace(0x10, r2)
    32  ptrace(0x11, r2)
    33  
    34  # For now, PTRACE_TRACEME is transformed to -1, which returns an error:
    35  # https://github.com/google/syzkaller/blob/cbd0445ec3b0b184db66966d8a47e6b37d13692e/sys/linux/init.go#L179-L182
    36  
    37  ptrace(0x0, 0x0)