Skip to content

Fix guest logging StackOverflow issue #1065

Open

Description

@dblnz

What happened?

When using logging in a hyperlight guest that enables the use of tracing crate with the log or log-always feature, the guest returns StackOverflow.
This especially impacts hyperlight-wasm because it uses the log feature of tracing.

What did you expect to happen?

The expected behavior is for hyperlight to correctly receive the logs from the guest through the OutBAction::Log VMExit.

Steps to reproduce the behavior

  1. set RUST_LOG="none,hyperlight_guest=trace,hyperlight_guest_bin=trace"
  2. run a hyperlight guest example
  3. The guest returns StackOverflow

Hyperlight Version

0.11.0

OS version

Details
On Linux:
$ cat /etc/os-release
PRETTY_NAME="Ubuntu 24.04.3 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04.3 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo

$ uname -a
Linux laptop 6.6.87.2-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC Thu Jun  5 18:30:46 UTC 2025 x86_64 GNU/Linux

On Windows:
C:\> cmd /c ver
not tested but should behave the same

</details>


### Additional Information

When tracing is not enabled, the previous way of reporting logs, `outb` with `OutBAction::Log` action, calls [push_shared_output_data](https://github.com/hyperlight-dev/hyperlight/blob/main/src/hyperlight_guest/src/guest_handle/io.rs#L92) which is instrumented for logging/tracing. This `instrument` tries to send a new log again, this results in an infinite `loop` that produces the `StackOverflow`.

The reason for this issue is the `log_message` function call that reports the message to the host, more specifically the [hyperlight_guest/src/host_comm.rs#L196](https://github.com/hyperlight-dev/hyperlight/blob/main/src/hyperlight_guest/src/guest_handle/host_comm.rs#L196), that uses the `input/output` buffer for the log.

The simple solution is to remove the `instrument` from the `push_shared_output_data`, the correct solution is to use the same `event batching` logic and buffer as the tracing uses.

Activity

  1. added theissue type on Dec 2, 2025
  2. added
    lifecycle/confirmedBug is verified or proposal seems reasonable
    and removed on Dec 2, 2025
  3. self-assigned this
    on Dec 2, 2025
  4. modified the milestones: v0.12.0, v0.13.0 on Dec 3, 2025
  5. jsturtevant commented on Feb 18, 2026

    @jsturtevant
    Contributor

    this is partially fixed in #1065

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

Metadata

Metadata

Assignees

Labels

area/securityInvolves security-related changes or fixeslifecycle/confirmedBug is verified or proposal seems reasonable

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions