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

early-boot-config: downgrade warning about inability to iopl to debug #2732

Merged

Conversation

markusboehme
Copy link
Member

Issue number: #2727

Closes #2727

Description of changes:

The VMware provider of early-boot-config communicates with the hypervisor via the VMware backdoor, a couple ports in the x86 port IO address space. By default Linux does not allow IO port access to user space processes, and so the used crate optionally invokes the iopl system call to change the IO privilege level of the process. The crate calls this "privileged" access.

The kernel update in 22a6a58 ("kernel-5.15: update to 5.15.79") changed the configuration to disable the iopl system call. This causes the VMware provider to emit a warning about the inability to use the VMware backdoor via "privileged" access. The provider falls back to "unprivileged" access, i.e. proceeds to use the backdoor without changing the IO privilege level first.

This fallback works just as well since both VMware and KVM (in its VMware guest data emulation) special-case the two IO ports used for the VMware backdoor. A process trying to access these will only enter into the hypervisor's fault handler which proceeds to serve the requests; the hypervisor does not inject a fault into the guest. Hence, the prior call to iopl is redundant, and "unprivileged" access works just as well.

Only downgrade the warning about the inability to invoke iopl to debug level for now. After some more experience with the behavior on variants with the 5.15 kernel we can then eliminate the "privileged" access for the variants with the 5.10 kernel as well.

Testing done:

Booted a vmware-dev build on VMware with and without this change. Without this change, I see repeated messages of the form:

[WARN] Unable to access guestinfo via privileged mode, using unprivileged: vmware backdoor error: iopl failed: Function not implemented (errno: 38)

They disappear with the change.

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

The VMware provider of early-boot-config communicates with the
hypervisor via the VMware backdoor, a couple ports in the x86 port IO
address space. By default Linux does not allow IO port access to user
space processes, and so the used crate optionally invokes the `iopl`
system call to change the IO privilege level of the process. The crate
calls this "privileged" access.

The kernel update in 22a6a58 ("kernel-5.15: update to 5.15.79")
changed the configuration to disable the `iopl` system call. This causes
the VMware provider to emit a warning about the inability to use the
VMware backdoor via "privileged" access. The provider falls back to
"unprivileged" access, i.e. proceeds to use the backdoor without
changing the IO privilege level first.

This fallback works just as well since both VMware and KVM (in its
VMware guest data emulation [1]) special-case the two IO ports used for
the VMware backdoor. A process trying to access these will only enter
into the hypervisor's fault handler which proceeds to serve the
requests; the hypervisor does not inject a fault into the guest. Hence,
the prior call to `iopl` is redundant, and "unprivileged" access works
just as well.

Only downgrade the warning about the inability to invoke `iopl` to debug
level for now. After some more experience with the behavior on variants
with the 5.15 kernel we can then eliminate the "privileged" access for
the variants with the 5.10 kernel as well.

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9a29d449e3fb7

Signed-off-by: Markus Boehme <markubo@amazon.com>
Copy link
Contributor

@zmrow zmrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🖖

@markusboehme markusboehme merged commit 4f2bf9b into bottlerocket-os:develop Jan 11, 2023
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.

early-boot-config fails with iopl error on vmware-dev variant
4 participants