Skip to content

[Bug] virtio-mmio kernel cmdline append breaks init arguments separated by --  #2709

Closed
@leonjza

Description

@leonjza

Describe the bug

Currently, it is not possible to pass arguments to init using -- (ref) as extra arguments are appended after the user provided command line here. When a user uses --, the behaviour causes essential arguments to be ignored as they will be passed to init.

In a bit of a contrived example, but for illustrations sake, let's imagine my init was to /bin/cat a file.
When specifying kernel boot_args such as console=ttyS0 nomodules random.trust_cpu=on reboot=k panic=1 pci=off ip=:::::eth0:dhcp init=/bin/cat -- /etc/password, the aforementioned code block will append extra arguments which technically get discarded because of the the --. The resultant command line would therefore be:

[    0.000000] Command line: console=ttyS0 nomodules random.trust_cpu=on reboot=k panic=1 pci=off ip=:::::eth0:dhcp init=/bin/cat -- /etc/password root=/dev/vda rw virtio_mmio.device=4K@0xd0000000:5 virtio_mmio.device=4K@0xd0001000:6 virtio_mmio.device=4K@0xd0002000:7

To Reproduce

  1. Start firecracker with firecracker --api-sock /tmp/firecracker.socket.
  2. Configure the kernel with the following JSON body:
{
   "kernel_image_path":"/path/to/kern",
   "boot_args":"console=ttyS0 nomodules random.trust_cpu=on reboot=k panic=1 pci=off ip=:::::eth0:dhcp init=/bin/cat -- /etc/password"
}
  1. Configure other parts to get a VM to boot.
  2. Start the instance and observe the Command line: output.

Expected behaviour

Kernel arguments such as root= and virtio_mmio.device= should appear before user supplied arguments.

Environment

  1. Arch : x86_64
  2. OS: Ubuntu 21.04
  3. Firecracker 0.24.6

Checks

  • Have you searched the Firecracker Issues database for similar problems?
  • Have you read the existing relevant Firecracker documentation?
  • Are you certain the bug being reported is a Firecracker issue?

Metadata

Metadata

Assignees

Labels

Priority: HighIndicates than an issue or pull request should be resolved ahead of issues or pull requests labelledType: BugIndicates an unexpected problem or unintended behavior

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions