-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[Bug] FC doesn't parse kernel command lines containing -- correctly #3023
Comments
We are currently considering the option of integrating this functionality upstream in We will follow up once we have made a decision. |
@upxe do you have an example of a boot argument that follows the |
I investigated this issue a little bit and this is a summary of what I discovered / tried:
Running like this, the VM booted in emergency mode, meaning that the
Running like this, the VM did NOT boot in emergency mode, meaning that the So, that being said, it looks to me t.=hat the whitespace is required after What do you think? Am I right? Did I miss something? |
Great investigation @andreitraistaru! That looks correct and matches my understanding as well. I think with this though minimal changes are required to the Firecracker code to fix the problem:
We can propagate this change to rust-vmm as well, but as we discussed offline the rust-vmm code needs a bit of a redesign to be able to accommodate the change. |
Ok, sounds good! I'll come up with the code changes for the rust-vmm and the integration in Firecracker of the bugfix. |
@andreeaflorescu, @andreitraistaru thank you for your input. The kernel documentation is ambiguous in its description of For clarity, our production workloads require multiple "--foo" and "--foo=bar" style arguments to I've attached a tool for comparing kernel command line handling in Firecracker and QEMU. Please remove the To run:
With this we can investigate the bug. In all cases below, AFAICT QEMU is correct; Firecracker is incorrect:
Based on my reading of the kernel source code (parse_args in kernel/params.c), the kernel command line is parsed thus:
|
We are considering the rework of the cmdline parser to cover this usecase as well. I'll have a look on that and let you know the progress on our side. |
Describe the bug
Firecracker since PR #2716 (issue #2709) attempts to parse the command line to inject virtio MMIO kernel parameters before any
--
in the command line.That PR has two problems:
It doesn't require the
--
to be whitespace-delimited: it incorrectly parses e.g.foo --bar
as a kernel parameter offoo
and an init argument ofbar
. The kernel would interpret it as two kernel parameters (foo
and--bar
), and no init arguments.It rejects kernel command lines containing multiple
--
substrings, irrespective of whitespace delimiting. This means that you can't pass arguments to init that contain--
.To Reproduce
Run a Linux VM with a kernel command line of e.g.
foo -- --bar
. This is a valid kernel command line:foo
is a kernel parameter;--bar
is passed as argv[1] to /sbin/init.Any kernel command containing multiple
--
substrings will fail to boot. Any command line containing a non-whitespace-delimited--
substring will be parsed incorrectly. For example, use the reproducer in #2709 but put--dummy
at the start ofboot_args
, before theconsole=...
.Expected behaviour
Firecracker starts the VM.
Environment
Additional context
This breaks our production use of Firecracker, which uses Linux VMs with an /sbin/init that takes
--foo
-style arguments, passed on the kernel command line.I'll submit a PR that splits the command line in a way that more closely follows the kernel's behaviour (
parse_args()
inkernel/params.c
).Checks
The text was updated successfully, but these errors were encountered: