Skip to content

feat(3199): Add Linux personality support #3202

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

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

Conversation

tommady
Copy link
Collaborator

@tommady tommady commented Jul 20, 2025

Description

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test updates
  • CI/CD related changes
  • Other (please describe):

Testing

  • Added new unit tests
  • Added new integration tests
  • Ran existing test suite
  • Tested manually (please provide steps)

using PerLinux

"linux": {
        "personality": {
            "domain": "LINUX"
        },
 sudo ./target/debug/youki --log-level info run testcon --bundle ./youki-bundle
 INFO libcgroups::common: cgroup manager V2 will be used
 WARN libcgroups::v2::util: Controller rdma is not yet implemented.
 WARN libcgroups::v2::util: Controller misc is not yet implemented.
 WARN libcgroups::v2::util: Controller dmem is not yet implemented.
 WARN libcgroups::v2::util: Controller rdma is not yet implemented.
 WARN libcgroups::v2::util: Controller misc is not yet implemented.
 WARN libcgroups::v2::util: Controller dmem is not yet implemented.
───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: /proc/self/personality
───────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ 00000000
───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 INFO libcgroups::common: cgroup manager V2 will be used

using PerLinux32

"linux": {
        "personality": {
            "domain": "LINUX32"
        },
sudo ./target/debug/youki --log-level info run testcon --bundle ./youki-bundle
 INFO libcgroups::common: cgroup manager V2 will be used
 WARN libcgroups::v2::util: Controller rdma is not yet implemented.
 WARN libcgroups::v2::util: Controller misc is not yet implemented.
 WARN libcgroups::v2::util: Controller dmem is not yet implemented.
 WARN libcgroups::v2::util: Controller rdma is not yet implemented.
 WARN libcgroups::v2::util: Controller misc is not yet implemented.
 WARN libcgroups::v2::util: Controller dmem is not yet implemented.
───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: /proc/self/personality
───────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ 00000008
───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 INFO libcgroups::common: cgroup manager V2 will be used

Related Issues

Fixes #3199

Additional Context

please use this config.json

{
    "ociVersion": "1.0.2-dev",
    "root": {
        "path": "rootfs",
        "readonly": true
    },
    "mounts": [
        {
            "destination": "/proc",
            "type": "proc",
            "source": "proc"
        },
        {
            "destination": "/dev",
            "type": "tmpfs",
            "source": "tmpfs",
            "options": [
                "nosuid",
                "strictatime",
                "mode=755",
                "size=65536k"
            ]
        },
        {
            "destination": "/dev/pts",
            "type": "devpts",
            "source": "devpts",
            "options": [
                "nosuid",
                "noexec",
                "newinstance",
                "ptmxmode=0666",
                "mode=0620",
                "gid=5"
            ]
        },
        {
            "destination": "/dev/shm",
            "type": "tmpfs",
            "source": "shm",
            "options": [
                "nosuid",
                "noexec",
                "nodev",
                "mode=1777",
                "size=65536k"
            ]
        },
        {
            "destination": "/dev/mqueue",
            "type": "mqueue",
            "source": "mqueue",
            "options": [
                "nosuid",
                "noexec",
                "nodev"
            ]
        },
        {
            "destination": "/sys",
            "type": "sysfs",
            "source": "sysfs",
            "options": [
                "nosuid",
                "noexec",
                "nodev",
                "ro"
            ]
        },
        {
            "destination": "/sys/fs/cgroup",
            "type": "cgroup",
            "source": "cgroup",
            "options": [
                "nosuid",
                "noexec",
                "nodev",
                "relatime",
                "ro"
            ]
        }
    ],
    "process": {
        "terminal": true,
        "user": {
            "uid": 0,
            "gid": 0
        },
        "args": [
            "/bin/bat",
            "/proc/self/personality"
        ],
        "env": [
            "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
            "TERM=xterm",
            "HOME=/root"
        ],
        "cwd": "/",
        "capabilities": {
            "bounding": [
                "CAP_AUDIT_WRITE",
                "CAP_KILL",
                "CAP_NET_BIND_SERVICE"
            ],
            "effective": [
                "CAP_AUDIT_WRITE",
                "CAP_KILL",
                "CAP_NET_BIND_SERVICE"
            ],
            "inheritable": [
                "CAP_AUDIT_WRITE",
                "CAP_KILL",
                "CAP_NET_BIND_SERVICE"
            ],
            "permitted": [
                "CAP_AUDIT_WRITE",
                "CAP_KILL",
                "CAP_NET_BIND_SERVICE"
            ],
            "ambient": [
                "CAP_AUDIT_WRITE",
                "CAP_KILL",
                "CAP_NET_BIND_SERVICE"
            ]
        },
        "rlimits": [
            {
                "type": "RLIMIT_NOFILE",
                "hard": 1024,
                "soft": 1024
            }
        ],
        "noNewPrivileges": true
    },
    "hostname": "youki",
    "annotations": {},
    "linux": {
        "personality": {
            "domain": "LINUX"
        },
        "resources": {
            "devices": []
        },
        "namespaces": [
            {
                "type": "pid"
            },
            {
                "type": "network"
            },
            {
                "type": "ipc"
            },
            {
                "type": "uts"
            },
            {
                "type": "mount"
            },
            {
                "type": "cgroup"
            }
        ],
        "maskedPaths": [
            "/proc/acpi",
            "/proc/asound",
            "/proc/kcore",
            "/proc/keys",
            "/proc/latency_stats",
            "/proc/timer_list",
            "/proc/timer_stats",
            "/proc/sched_debug",
            "/sys/firmware",
            "/proc/scsi"
        ],
        "readonlyPaths": [
            "/proc/bus",
            "/proc/fs",
            "/proc/irq",
            "/proc/sys",
            "/proc/sysrq-trigger"
        ]
    }
}

@tommady tommady marked this pull request as ready for review July 27, 2025 09:43
@tommady
Copy link
Collaborator Author

tommady commented Jul 27, 2025

Hi @saku3
I am done with the personality supporting.
Please take a moment to review while you have the time. 🙇🏻

BTW, I am not sure where to add the integration test. If needed, please guide me. Currently, I am testing manually.

Thanks.

@tommady
Copy link
Collaborator Author

tommady commented Jul 27, 2025

hi @utam0k
could you kindly add a label for this PR?
thanks

@saku3
Copy link
Contributor

saku3 commented Jul 28, 2025

BTW, I am not sure where to add the integration test. If needed, please guide me. Currently, I am testing manually.

I think it would be appropriate to add the test to the following integration tests:
https://github.com/youki-dev/youki/tree/main/tests/contest

You may want to refer to the following for the test:
https://github.com/opencontainers/runc/blob/main/tests/integration/personality.bats

@tommady
Copy link
Collaborator Author

tommady commented Jul 29, 2025

BTW, I am not sure where to add the integration test. If needed, please guide me. Currently, I am testing manually.

I think it would be appropriate to add the test to the following integration tests: https://github.com/youki-dev/youki/tree/main/tests/contest

You may want to refer to the following for the test: https://github.com/opencontainers/runc/blob/main/tests/integration/personality.bats

Hi @saku3
thank you for guiding me on how to add an integration test; I have done so.
but ahah seems the validate-contest-runc is not happy, which required this PR to be merged
#3201

please help review again while you have time.

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Linux personality support
2 participants