Skip to content

Passing app arguments on the kernel command line quietly mangles some of them #1067

Description

@pocopepe

For Linux guests (including the default urunit path) we hand the application its arguments through the kernel command line — init=/urunit -- <args>, joined with spaces. When kernel splits on white spaces and treats -- specially. Anything that does't fit those rules exact gets changed silently, when the guest boots fine,

A few shapes I ran into,

  • An empty argument disappears, since everything is glued together with spaces — ["a", "", "b"] reaches the app as a, b.
  • An argument that's literally -- cuts off everything after it — ["a", "--", "b", "c"] arrives as just a.
  • A long argument list gets chopped at 2048 bytes, the last argument is cut mid value and anything past it is gone.
  • Go past 32 arguments and the guest doesn't start at all, it panics, Kernel panic - not syncing: Too many boot init vars.

I don't think these are four separate parsing bugs so much as one thing: the command line was never really able to carry an arbitrary argument list.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    GuestsRelated to guestsbugSomething isn't workingenhancementNew feature or request

    Type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions