• Andrei Vagin's avatar
    syscall: add all ambient capabilities into permitted and inheritable sets · 5930c7de
    Andrei Vagin authored
    According to the prctl man page, each capability from the ambient set
    must already be present in both  the  permitted  and  the  inheritable
    sets  of the process.
    
    exec_linux_test suggests configuring the capabilities in the parent
    process. This doesn't look nice, because:
    * Capabilities are a per-thread attribute, so we need to use
    LockOSThread.
    * Need to restore capabilities after creating a process.
    * Doesn't work with user namespaces, because a process gets capabilities
    when a namespace is created.
    
    Fixes #23152
    
    Change-Id: Iba23e530fc7b9f5182d602fe855f82218f354219
    Reviewed-on: https://go-review.googlesource.com/c/go/+/156577
    Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
    5930c7de
exec_linux.go 16 KB