bottlerocket-os / bottlerocket-os/bottlerocket
kernel-parameters settings order is not preserved
- Dominant language
- Rust
- Stars
- 9.7k
- Forks
- 586
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 12
Description
Bottlerocket isn't preserving the order of kernel parameters provided to it via `settings.boot.kernel-parameters`.
For example, if I pass the following list of kernel parameters:
```
[settings.boot.kernel-parameters]
"hugepagesz" = [
"1G"
]
"hugepages" = [
"10"
]
```
What should result on the kernel command line is:
`hugepagesz="1G" hugepages="10"`
However, what can happen is
`hugepages="10" hugepagesz="1G"`
In Linux, the ordering of command line arguments can be important, and this is particularly true for [Huge TLB Page configuration](https://docs.kernel.org/admin-guide/mm/hugetlbpage.html). The two sets of arguments above do not have the same effect: the first argument list specifies that 10 huge pages of size 1GB should be allocated; the second argument list specifies that 10 huge pages of the default size should be allocated (and the second argument is ignored). While one could argue that the order shouldn't matter, it unfortunately does matter.
So, Bottlerocket should ensure the arguments are appended to the kernel command line in the order presented in the settings. If this isn't possible with TOML, some sort of ordering hint should be possible, or perhaps these need to be an array instead of a keyed argument list.
Contributor guide
Research direction
Start at the handling of `settings.boot.kernel-parameters` and trace how its entries become the Linux kernel command line; the issue names no files or tests. Done means the arguments retain the order presented in the settings, including the `hugepagesz` and `hugepages` example, with coverage for the ordering behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, rust
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100