mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-18 23:39:30 +00:00
Merge pull request #6871 from kmjohansen/bugfix/ptmx
runtime: make debug console work with sandbox_cgroup_only
This commit is contained in:
@@ -697,6 +697,7 @@ func (s *Sandbox) createResourceController() error {
|
||||
// Determine if device /dev/null and /dev/urandom exist, and add if they don't
|
||||
nullDeviceExist := false
|
||||
urandomDeviceExist := false
|
||||
ptmxDeviceExist := false
|
||||
for _, device := range resources.Devices {
|
||||
if device.Type == "c" && device.Major == intptr(1) && device.Minor == intptr(3) {
|
||||
nullDeviceExist = true
|
||||
@@ -705,6 +706,10 @@ func (s *Sandbox) createResourceController() error {
|
||||
if device.Type == "c" && device.Major == intptr(1) && device.Minor == intptr(9) {
|
||||
urandomDeviceExist = true
|
||||
}
|
||||
|
||||
if device.Type == "c" && device.Major == intptr(5) && device.Minor == intptr(2) {
|
||||
ptmxDeviceExist = true
|
||||
}
|
||||
}
|
||||
|
||||
if !nullDeviceExist {
|
||||
@@ -720,6 +725,18 @@ func (s *Sandbox) createResourceController() error {
|
||||
}...)
|
||||
}
|
||||
|
||||
// If the hypervisor debug console is enabled and
|
||||
// sandbox_cgroup_only are configured, then the vmm needs access to
|
||||
// /dev/ptmx. Add this to the device allowlist if it is not
|
||||
// already present in the config.
|
||||
if s.config.HypervisorConfig.Debug && s.config.SandboxCgroupOnly && !ptmxDeviceExist {
|
||||
// "/dev/ptmx"
|
||||
resources.Devices = append(resources.Devices, []specs.LinuxDeviceCgroup{
|
||||
{Type: "c", Major: intptr(5), Minor: intptr(2), Access: rwm, Allow: true},
|
||||
}...)
|
||||
|
||||
}
|
||||
|
||||
if spec.Linux.Resources.CPU != nil {
|
||||
resources.CPU = &specs.LinuxCPU{
|
||||
Cpus: spec.Linux.Resources.CPU.Cpus,
|
||||
|
Reference in New Issue
Block a user