Skip to content

Memory Leak in Guest on Error Calling Host Function #826

@adamperlin

Description

@adamperlin

What happened?

This leak was uncovered in fuzzing. When a guest calls a host function, if there is an error calling the host function itself -- for example, the host function does not exist -- the error propagates on the host side and we never return back to the guest to allow it to unwind and drop any allocated resources. In the fuzz_host_call target, we are currently running into memory exhaustion because we try to execute many iterations of such faulty host calls on the same sandbox in sequence.

What did you expect to happen?

If there is any error produced in attempting to call a host function in the guest, we need to yield control back to the guest and trigger some kind of unwind.

Steps to reproduce the behavior

  1. Checkout the branch used in Remove Allocations from Panic Handler #818
  2. Run just guests; just fuzz fuzz_host_call
  3. Fuzzing should fail with a memory allocation error almost immediately

Hyperlight Version

0.8.0

OS version

On Linux:
$ cat /etc/os-release

PRETTY_NAME="Ubuntu 22.04.5 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.5 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
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=jammy

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

Additional Information

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions