Skip to content

fix(3198): fix difference in how commands are passed after exec and ps #3201

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 2 commits into
base: main
Choose a base branch
from

Conversation

tommady
Copy link
Collaborator

@tommady tommady commented Jul 20, 2025

Description

Fix the Difference in how commands are passed after exec
This is Part of Enhancing Compatibility with runc

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)
./target/debug/youki exec testcon sh -c "echo hello"
DEBUG youki: started by user 1000 with ArgsOs { inner: ["./target/debug/youki", "exec", "testcon", "sh", "-c", "echo hello"] }                                │
│DEBUG libcontainer::user_ns: container with new user namespace should be created                                                                              │
│DEBUG libcontainer::user_ns: validating spec for container with new user namespace spec=Spec { version: "1.0.2-dev", root: Some(Root { path: "rootfs", readonl│
│y: Some(true) }), mounts: Some([Mount { destination: "/proc", typ: Some("proc"), source: Some("proc"), options: Some([]) }, Mount { destination: "/dev", typ: │
│Some("tmpfs"), source: Some("tmpfs"), options: Some(["nosuid", "strictatime", "mode=755", "size=65536k"]) }, Mount { destination: "/dev/pts", typ: Some("devpt│
│s"), source: Some("devpts"), options: Some(["nosuid", "noexec", "newinstance", "ptmxmode=0666", "mode=0620"]) }, Mount { destination: "/dev/shm", typ: Some("t│
│mpfs"), source: Some("shm"), options: Some(["nosuid", "noexec", "nodev", "mode=1777", "size=65536k"]) }, Mount { destination: "/dev/mqueue", typ: Some("mqueue│
"), source: Some("mqueue"), options: Some(["nosuid", "noexec", "nodev"]) }, Mount { destination: "/sys", typ: Some("none"), source: Some("/sys"), options: Som│
│e(["rbind", "nosuid", "noexec", "nodev", "ro"]) }, Mount { destination: "/sys/fs/cgroup", typ: Some("cgroup"), source: Some("cgroup"), options: Some(["nosuid"│
│, "noexec", "nodev", "relatime", "ro"]) }]), process: Some(Process { terminal: Some(false), console_size: None, user: User { uid: 0, gid: 0, umask: None, addi│
│tional_gids: None, username: None }, args: Some(["sh"]), command_line: None, env: Some(["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "
│TERM=xterm"]), cwd: "/", capabilities: Some(LinuxCapabilities { bounding: Some({AuditWrite, NetBindService, Kill}), effective: Some({NetBindService, AuditWrit│
│e, Kill}), inheritable: Some({NetBindService, Kill, AuditWrite}), permitted: Some({AuditWrite, Kill, NetBindService}), ambient: Some({AuditWrite, Kill, NetBin│
│dService}) }), rlimits: Some([PosixRlimit { typ: RlimitNofile, hard: 1024, soft: 1024 }]), no_new_privileges: Some(true), apparmor_profile: None, oom_score_ad│
│j: None, selinux_label: None, io_priority: None, scheduler: None, exec_cpu_affinity: None }), hostname: Some("youki"), domainname: None, hooks: None, annotati│
│ons: Some({}), linux: Some(Linux { net_devices: None, uid_mappings: Some([LinuxIdMapping { host_id: 1000, container_id: 0, size: 1 }]), gid_mappings: Some([Li│
│nuxIdMapping { host_id: 1000, container_id: 0, size: 1 }]), sysctl: None, resources: Some(LinuxResources { devices: Some([]), memory: None, cpu: None, pids: N│
│one, block_io: None, hugepage_limits: None, network: None, rdma: None, unified: None }), cgroups_path: None, namespaces: Some([LinuxNamespace { typ: Pid, path│
│: None }, LinuxNamespace { typ: Ipc, path: None }, LinuxNamespace { typ: Uts, path: None }, LinuxNamespace { typ: Mount, path: None }, LinuxNamespace { typ: C│
│group, path: None }, LinuxNamespace { typ: User, path: None }]), devices: None, seccomp: None, rootfs_propagation: None, masked_paths: Some(["/proc/acpi", "/p│
│roc/asound", "/proc/kcore", "/proc/keys", "/proc/latency_stats", "/proc/timer_list", "/proc/timer_stats", "/proc/sched_debug", "/sys/firmware", "/proc/scsi"])│
│, readonly_paths: Some(["/proc/bus", "/proc/fs", "/proc/irq", "/proc/sys", "/proc/sysrq-trigger"]), mount_label: None, intel_rdt: None, personality: None, tim│
│e_offsets: None }), solaris: None, windows: None, vm: None, uid_mappings: None, gid_mappings: None }    

...   

./target/debug/youki ps testcon -e -x
DEBUG youki: started by user 1000 with ArgsOs { inner: ["./target/debug/youki", "ps", "testcon", "-e", "-x"] }                                                │
INFO libcgroups::common: cgroup manager V2 will be used                                                                                                 
DEBUG libcgroups::common: scan pids in folder: "/sys/fs/cgroup/:youki:testcon"   

...                                                                                                   

Related Issues

Fixes #3198

Additional Context

@saku3
Copy link
Contributor

saku3 commented Jul 20, 2025

@tommady

Thank you for the PR.

I’ve updated the issue.
The ps command has the same problem. Could you please fix that as well?

@tommady
Copy link
Collaborator Author

tommady commented Jul 20, 2025

@tommady

Thank you for the PR.

I’ve updated the issue. The ps command has the same problem. Could you please fix that as well?

Sure, will do!

@tommady tommady changed the title fix(3198): fix difference in how commands are passed after exec fix(3198): fix difference in how commands are passed after exec and ps Jul 20, 2025
@tommady tommady force-pushed the close-issue-3198 branch from 3dd09a1 to 5957dbe Compare July 20, 2025 05:29
@tommady
Copy link
Collaborator Author

tommady commented Jul 24, 2025

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

@saku3
Copy link
Contributor

saku3 commented Jul 26, 2025

Thanks!
I think this modification looks good.

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.

Difference in how commands are passed after exec and ps
2 participants