Skip to content
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

uname: add configurability of sysname and release #2008

Merged
merged 1 commit into from
Mar 21, 2024

Conversation

francescolavra
Copy link
Member

With this change, it is possible to configure the kernel to insert arbitrary strings in the sysname and release fields of the struct used in the uname syscall. This allows running user programs that expect these fields to have specific values (e.g. programs that expect the sysname to be "Linux", or programs that parse the release string to infer a Linux kernel version).
To configure the sysname and release fields, a "uname" configuration tuple is used: this tuple can contain a "sysname" string and a "release" string, which allow configuring the respective fields; if a given string is not present in the configuration, its default value is used (i.e., "Nanos" for the sysname field, and "5.0-<NANOS_VERSION>" for the release field). Example snippet of Ops configuration file:

"ManifestPassthrough": {
  "uname": {
    "sysname": "Linux",
    "release": "5.0.5"
  }
}

With this change, it is possible to configure the kernel to insert
arbitrary strings in the `sysname` and `release` fields of the
struct used in the uname syscall. This allows running user programs
that expect these fields to have specific values (e.g. programs
that expect the sysname to be "Linux", or programs that parse the
release string to infer a Linux kernel version).
To configure the sysname and release fields, a "uname"
configuration tuple is used: this tuple can contain a "sysname"
string and a "release" string, which allow configuring the
respective fields; if a given string is not present in the
configuration, its default value is used (i.e., "Nanos" for the
sysname field, and "5.0-<NANOS_VERSION>" for the release field).
Example snippet of Ops configuration file:
```
"ManifestPassthrough": {
  "uname": {
    "sysname": "Linux",
    "release": "5.0.5"
  }
}
```
@rinor
Copy link
Contributor

rinor commented Mar 15, 2024

How would we detect that we are running on nanos if sysname gets changed then, since this #1885 (comment) is not reliable anymore

@francescolavra
Copy link
Member Author

The default behavior is not changing, i.e. if the user doesn't override the sysname, the kernel will continue to output "Nanos".
If the user does override the sysname, I would assume they know what they are doing.

@francescolavra francescolavra merged commit fea96ad into master Mar 21, 2024
5 checks passed
@francescolavra francescolavra deleted the feature/uname branch March 21, 2024 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants