Skip to content

Behavior change when duplicate additionalGids are specified #4769

@saku3

Description

@saku3

Description

In runc v1.3.0, the behavior has changed when specifying duplicate AdditionalGids.

Previously, duplicate group IDs in AdditionalGids were deduplicated.
In the current version, duplicates are no longer removed.

This change in behavior is due to this PR: #3999

Previously, deduplication occurred because the GetAdditionalGroupsPath (which calls GetAdditionalGroups) function stored the GIDs in a map.

The OCI runtime-spec does not define behavior regarding duplicated group IDs.
(Should this be standardized?)

Steps to reproduce the issue

Specify the following fields in the process section of your spec:

"process": {
  "terminal": false,
  "user": {
    "uid": 0,
    "gid": 0,
    "additionalGids": [1000, 2000, 3000, 3000]
  },
  "args": ["id"]
}

runc v1.3.0
Duplicate GIDs appear in the output:

$ runc --version
runc version 1.3.0
commit: v1.3.0-0-g4ca628d1
spec: 1.2.1
go: go1.23.0
libseccomp: 2.5.5

$ runc create testcon
$ runc start testcon
uid=0(root) gid=0(root) groups=1000,2000,3000,3000

runc v1.2.6
Duplicate GIDs are removed:

$ runc --version
runc version 1.2.6
commit: v1.2.6-0-ge89a2992
spec: 1.2.0
go: go1.22.4
libseccomp: 2.5.5

$ runc create testcon
$ runc start testcon
uid=0(root) gid=0(root) groups=1000,2000,3000

Describe the results you received and expected

The results are as shown in the reproduction steps.

There are a few options to consider:

  • Modify the implementation to preserve the previous behavior (i.e., deduplicate duplicate group IDs).
  • Define the expected behavior in the runtime-spec specification.

Additionally, crun does not deduplicate duplicates.

$ crun --version
crun version 1.14.1
commit: de537a7965bfbe9992e2cfae0baeb56a08128171
rundir: /run/crun
spec: 1.0.0
+SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +WASM:wasmedge +YAJL

$ crun create testcon
$ crun start testcon
uid=0(root) gid=0(root) groups=1000,2000,3000,3000

youki references the older runc behavior and deduplicates additionalGids.

What version of runc are you using?

runc --version
runc version 1.3.0
commit: v1.3.0-0-g4ca628d1
spec: 1.2.1
go: go1.23.0
libseccomp: 2.5.5

Host OS information

cat /etc/os-release

PRETTY_NAME="Ubuntu 24.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04.2 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo

Host kernel information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions