Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libct/cap: switch to moby/sys/capability, lazy init #4358

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Commits on Oct 4, 2024

  1. libct/cap: preallocate slices

    Signed-off-by: Kir Kolyshkin <[email protected]>
    kolyshkin committed Oct 4, 2024
    Configuration menu
    Copy the full SHA
    a4bcfe2 View commit details
    Browse the repository at this point in the history
  2. libct/cap: switch to lazy init

    A map which is created in func init is only used by capSlice, which is
    only used by New, which is only used by runc init. Switch to lazy init
    to slightly save on startup time.
    
    Signed-off-by: Kir Kolyshkin <[email protected]>
    kolyshkin committed Oct 4, 2024
    Configuration menu
    Copy the full SHA
    07da3fc View commit details
    Browse the repository at this point in the history
  3. libct/cap: internalize capSlice

    Move capSlice to be an internal function of New. This way, we don't have
    to pass most parameters.
    
    This is a preparation for the next commit.
    
    Signed-off-by: Kir Kolyshkin <[email protected]>
    kolyshkin committed Oct 4, 2024
    Configuration menu
    Copy the full SHA
    aebb94c View commit details
    Browse the repository at this point in the history
  4. libct: warn on amb caps when inh not set

    Fixing a long standing bug in github.com/syndtr/gocapability package
    (ignoring errors when setting ambient caps, see [1]) revealed that
    it's not possible to raise those ambient capabilities for which
    inheritable capabilities are not raised. In other words, "the Ambient
    vector cannot contain values not raised in the Inh vector" ([2]).
    
    The example spec in libct/specconv had a few ambient capabilities set
    but no inheritable ones. As a result, when capability package with fix
    from [1] is used, we get an error trying to start a container ("unable
    to apply caps: permission denied").
    
    The only decent way to fix this is to ignore raised ambient capabilities
    for which inheritable capabilities are not raised (essentially mimicking
    the old behavior). Let's also add a warning about ignored capabilities,
    with an intention to change it to an error later.
    
    Fix the example spec accordingly (remove the ambient caps).
    
    This is in preparation to switch to github.com/kolyshkin/capability.
    
    [1]: kolyshkin/capability#3
    [2]: https://pkg.go.dev/kernel.org/pub/linux/libs/security/libcap/cap#IAB.SetVector
    Signed-off-by: Kir Kolyshkin <[email protected]>
    kolyshkin committed Oct 4, 2024
    Configuration menu
    Copy the full SHA
    890ce8e View commit details
    Browse the repository at this point in the history

Commits on Oct 5, 2024

  1. Switch to github.com/moby/sys/capability v0.3.0

    This removes the last unversioned package in runc's direct dependencies.
    
    Signed-off-by: Kir Kolyshkin <[email protected]>
    kolyshkin committed Oct 5, 2024
    Configuration menu
    Copy the full SHA
    4b54b98 View commit details
    Browse the repository at this point in the history