Skip to content

Investigate possible memory leak from hello-world example #946

@dblnz

Description

@dblnz

Running valgrind on the hello-world example yields the below output.
It looks like there might be some memory leak that needs investigation.

Valgrind output
➜  hyperlight git:(main) ✗ valgrind -s --leak-check=full --show-leak-kinds=all target/release/examples/hello-world
==197301== Memcheck, a memory error detector
==197301== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==197301== Using Valgrind-3.22.0 and LibVEX; rerun with -h for copyright info
==197301== Command: target/release/examples/hello-world
==197301==
--197301-- WARNING: unhandled amd64-linux syscall: 317
--197301-- You may be able to write your own handler.
--197301-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--197301-- Nevertheless we consider this a bug.  Please report
--197301-- it at http://valgrind.org/support/bug_reports.html.

thread 'main' panicked at src/hyperlight_host/examples/hello-world/main.rs:47:10:
called `Result::unwrap()` on an `Err` value: SeccompFilterError(Seccomp(Os { code: 38, kind: Unsupported, message: "Function not implemented" }))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
==197301==
==197301== HEAP SUMMARY:
==197301==     in use at exit: 520 bytes in 3 blocks
==197301==   total heap usage: 625 allocs, 622 frees, 1,031,802 bytes allocated
==197301==
==197301== 16 bytes in 1 blocks are still reachable in loss record 1 of 3
==197301==    at 0x4846828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==197301==    by 0x1499F0: std::sync::poison::once::Once::call_once::{{closure}} (in /home/dblnz/workspace/msft/hyperlight/target/release/examples/hello-world)
==197301==    by 0x12F633: std::sys::sync::once::futex::Once::call (in /home/dblnz/workspace/msft/hyperlight/target/release/examples/hello-world)
==197301==    by 0x151BC8: hyperlight_host::sandbox::uninitialized_evolve::evolve_impl_multi_use::{{closure}} (in /home/dblnz/workspace/msft/hyperlight/target/release/examples/hello-world)
==197301==    by 0x15020E: hyperlight_host::sandbox::uninitialized_evolve::evolve_impl_multi_use (in /home/dblnz/workspace/msft/hyperlight/target/release/examples/hello-world)
==197301==    by 0x178011: hyperlight_host::sandbox::uninitialized::UninitializedSandbox::evolve (in /home/dblnz/workspace/msft/hyperlight/target/release/examples/hello-world)
==197301==    by 0x136036: hello_world::main (in /home/dblnz/workspace/msft/hyperlight/target/release/examples/hello-world)
==197301==    by 0x13AEA5: std::sys::backtrace::__rust_begin_short_backtrace (in /home/dblnz/workspace/msft/hyperlight/target/release/examples/hello-world)
==197301==    by 0x136687: std::rt::lang_start::{{closure}} (in /home/dblnz/workspace/msft/hyperlight/target/release/examples/hello-world)
==197301==    by 0x1EE9BF: std::rt::lang_start_internal (in /home/dblnz/workspace/msft/hyperlight/target/release/examples/hello-world)
==197301==    by 0x1363D4: main (in /home/dblnz/workspace/msft/hyperlight/target/release/examples/hello-world)
==197301==
==197301== 48 bytes in 1 blocks are possibly lost in loss record 2 of 3
==197301==    at 0x4846828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==197301==    by 0x1EF893: std::thread::Thread::new (in /home/dblnz/workspace/msft/hyperlight/target/release/examples/hello-world)
==197301==    by 0x12E9AF: std::thread::current::init_current (in /home/dblnz/workspace/msft/hyperlight/target/release/examples/hello-world)
==197301==    by 0x149A74: std::thread::scoped::scope (in /home/dblnz/workspace/msft/hyperlight/target/release/examples/hello-world)
==197301==    by 0x176F60: hyperlight_host::sandbox::host_funcs::FunctionRegistry::call_host_func_impl::{{closure}} (in /home/dblnz/workspace/msft/hyperlight/target/release/examples/hello-world)
==197301==    by 0x17672F: hyperlight_host::sandbox::host_funcs::FunctionRegistry::call_host_func_impl (in /home/dblnz/workspace/msft/hyperlight/target/release/examples/hello-world)
==197301==    by 0x175E47: hyperlight_host::sandbox::host_funcs::FunctionRegistry::call_host_function (in /home/dblnz/workspace/msft/hyperlight/target/release/examples/hello-world)
==197301==    by 0x14FC8B: hyperlight_host::sandbox::outb::handle_outb::{{closure}} (in /home/dblnz/workspace/msft/hyperlight/target/release/examples/hello-world)
==197301==    by 0x14E67D: hyperlight_host::sandbox::outb::handle_outb (in /home/dblnz/workspace/msft/hyperlight/target/release/examples/hello-world)
==197301==    by 0x196502: <hyperlight_host::hypervisor::kvm::KVMDriver as hyperlight_host::hypervisor::Hypervisor>::handle_io::{{closure}} (in /home/dblnz/workspace/msft/hyperlight/target/release/examples/hello-world)
==197301==    by 0x195C23: <hyperlight_host::hypervisor::kvm::KVMDriver as hyperlight_host::hypervisor::Hypervisor>::handle_io (in /home/dblnz/workspace/msft/hyperlight/target/release/examples/hello-world)
==197301==    by 0x163F4C: hyperlight_host::hypervisor::VirtualCPU::run::{{closure}} (in /home/dblnz/workspace/msft/hyperlight/target/release/examples/hello-world)
==197301==
==197301== 456 bytes in 1 blocks are still reachable in loss record 3 of 3
==197301==    at 0x4846828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==197301==    by 0x1F8A9A: std::sys::pal::unix::stack_overflow::thread_info::set_current_info (in /home/dblnz/workspace/msft/hyperlight/target/release/examples/hello-world)
==197301==    by 0x1EE873: std::rt::lang_start_internal (in /home/dblnz/workspace/msft/hyperlight/target/release/examples/hello-world)
==197301==    by 0x1363D4: main (in /home/dblnz/workspace/msft/hyperlight/target/release/examples/hello-world)
==197301==
==197301== LEAK SUMMARY:
==197301==    definitely lost: 0 bytes in 0 blocks
==197301==    indirectly lost: 0 bytes in 0 blocks
==197301==      possibly lost: 48 bytes in 1 blocks
==197301==    still reachable: 472 bytes in 2 blocks
==197301==         suppressed: 0 bytes in 0 blocks
==197301==
==197301== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    lifecycle/needs-infoThe issue requires additional information from the original poster

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions