Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
virtcontainers: Append max_ports to virtio-serial device
Browse files Browse the repository at this point in the history
Allow API consumers to change the maximum number of ports in the
virtio-serial devices, setting a lower number of ports can improve the
boot time and reduce the attack surface.

Before this patch on arm64:
[    0.028664] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    0.055031] printk: console [hvc0] enabled

After this patch on arm64:
[    0.028484] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    0.031370] printk: console [hvc0] enabled

Fixes: #2676
Signed-off-by: Jia He <[email protected]>
  • Loading branch information
justin-he committed Dec 2, 2020
1 parent 2a98f43 commit a91deab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions virtcontainers/qemu_arch_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ func (q *qemuArchBase) appendConsole(devices []govmmQemu.Device, path string) ([
Driver: govmmQemu.VirtioSerial,
ID: "serial0",
DisableModern: q.nestedRun,
MaxPorts: uint(2),
}

devices = append(devices, serial)
Expand Down
5 changes: 3 additions & 2 deletions virtcontainers/qemu_arch_base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,9 @@ func TestQemuArchBaseAppendConsoles(t *testing.T) {

expectedOut := []govmmQemu.Device{
govmmQemu.SerialDevice{
Driver: govmmQemu.VirtioSerial,
ID: "serial0",
Driver: govmmQemu.VirtioSerial,
ID: "serial0",
MaxPorts: uint(2),
},
govmmQemu.CharDevice{
Driver: govmmQemu.Console,
Expand Down

0 comments on commit a91deab

Please sign in to comment.