• Michael Pratt's avatar
    runtime: use tgkill for raise · 43f54c8d
    Michael Pratt authored
    raise uses tkill to send a signal to the current thread. For this use,
    tgkill is functionally equivalent to tkill expect that it also takes the
    pid as the first argument.
    
    Using tgkill makes it simpler to run a Go program in a strict sandbox.
    With kill and tgkill, the sandbox policy (e.g., seccomp) can prevent the
    program from sending signals to other processes by checking that the
    first argument == getpid().
    
    With tkill, the policy must whitelist all tids in the process, which is
    effectively impossible given Go's dynamic thread creation.
    
    Fixes #27548
    
    Change-Id: I8ed282ef1f7215b02ef46de144493e36454029ea
    Reviewed-on: https://go-review.googlesource.com/133975
    Run-TryBot: Michael Pratt <mpratt@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
    43f54c8d
sys_linux_arm64.s 11.3 KB