Skip to content

fix(guest): allow guest functions with more than 11 parameters - #1998

Merged
ludfjig merged 1 commit into
hyperlight-dev:mainfrom
ludfjig:ll/guest-param-limit
Oct 29, 2026
Merged

ludfjig merged 1 commit into
hyperlight-dev:mainfrom
ludfjig:ll/guest-param-limit

Conversation

@ludfjig

@ludfjig ludfjig commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Guest functions register with up to 32 parameters, but verify_parameters rejected every call with more than 11. This removes the limit. The guest still rejects a call whose argument count differs from the function's parameter count.

Tests:

  • A 32-parameter guest function, called from a host test.
  • Doctests on ParameterTuple: 32 parameters compile, 33 do not.

Fixes #1996

Registration accepts guest functions with up to 32 parameters, but
verify_parameters rejected every call with more than 11. Remove the
limit. The guest still rejects a call whose argument count differs
from the function's parameter count.

Add a 32-parameter guest function test, and doctests that 32
parameters compile and 33 do not.

Fixes hyperlight-dev#1996

Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
@ludfjig ludfjig added the kind/bugfix For PRs that fix bugs label Oct 29, 2026
Copilot AI balanced review requested due to automatic review settings October 29, 2026 21:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues remain for the change extending guest-call support to 32 parameters.

No open issues 🎉

What changed in this PR

This PR fixes #1996 by allowing guest calls beyond 11 parameters, matching registration’s 32-parameter support. Signature validation still rejects mismatched argument counts.

Changes:

  • Removes the 11-parameter runtime limit.
  • Adds a 32-argument integration test and doctests for the 32/33-parameter boundary.
  • Documents the supported limit and records the fix in the changelog.
File Description
src/​tests/​rust_guests/​simpleguest/​src/​main.rs Adds a 32-parameter guest function for testing.
src/​hyperlight_host/​tests/​sandbox_host_tests.rs Tests a host call with 32 arguments.
src/​hyperlight_guest_macro/​src/​lib.rs Documents the 32-parameter limit.
src/​hyperlight_guest_bin/​src/​guest_function/​definition.rs Removes the 11-parameter rejection while preserving signature checks.
src/​hyperlight_common/​src/​func/​param_type.rs Adds doctests accepting 32 parameters and rejecting 33.
CHANGELOG.md Records the guest-call fix.

Review effort: Balanced

@hyperlight-gh-bot

Copy link
Copy Markdown

Benchmark Results

Measured commit: 21b6ebaa66f9
Baseline commit: 3233086b0243

kvm / amd (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

decode_vec_bytes_copy encode_control
372.00 µs (➖ 1.00x slower)
byte_chunks 761.98 ns (➖ 1.03x faster)
vec_bytes 590.07 ns (➖ 1.01x slower)

payload_allocation

slot_pool_segmented
65536 142.58 ns (➖ 1.02x faster)
262144 538.03 ns (➖ 1.02x slower)

sandboxes

create_initialized_and_drop
medium 81.06 ms (➖ 1.00x slower)

slot_pool

alloc_dealloc_4096 alloc_dealloc_128 alloc_dealloc_1500
7.68 ns (➖ 1.00x faster) 7.74 ns (➖ 1.01x slower) 8.63 ns (➖ 1.12x slower)

snapshot_files

load_snapshot_unverified
small 94.22 µs (➖ 1.02x slower)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
65536 1.97 µs (➖ 1.06x faster) 2.03 µs (➖ 1.07x slower)
262144 7.09 µs (➖ 1.02x slower) 7.04 µs (➖ 1.01x faster)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
8192 1.05 µs (➖ 1.01x slower) 1.03 µs (➖ 1.02x slower)
65536 6.16 µs (➖ 1.07x faster) 6.46 µs (➖ 1.01x faster)
262144 27.09 µs (➖ 1.01x faster)
kvm / intel (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

decode_vec_bytes_copy encode_control
744.24 µs (➖ 1.04x slower)
byte_chunks 805.32 ns (➖ 1.06x slower)
vec_bytes 580.36 ns (➖ 1.02x slower)

payload_allocation

slot_pool_segmented
65536 166.79 ns (➖ 1.19x faster)
262144 546.12 ns (➖ 1.04x faster)

sandboxes

create_initialized_and_drop
medium 81.06 ms (➖ 1.02x slower)

slot_pool

alloc_dealloc_4096 alloc_dealloc_128 alloc_dealloc_1500
7.46 ns (➖ 1.03x faster) 7.46 ns (➖ 1.03x faster) 7.43 ns (➖ 1.04x faster)

snapshot_files

load_snapshot_unverified
small 49.05 µs (➖ 1.01x slower)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
65536 2.43 µs (➖ 1.02x slower) 2.46 µs (➖ 1.01x slower)
262144 8.43 µs (➖ 1.01x faster) 8.55 µs (➖ 1.01x slower)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
8192 834.33 ns (➖ 1.03x slower) 824.17 ns (➖ 1.00x faster)
65536 7.97 µs (➖ 1.04x faster) 8.45 µs (➖ 1.04x slower)
262144 35.82 µs (➖ 1.08x slower)
mshv3 / amd (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

decode_vec_bytes_copy encode_control
311.83 µs (➖ 1.10x faster)
byte_chunks 949.05 ns (➖ 1.03x slower)
vec_bytes 746.98 ns (➖ 1.06x slower)

payload_allocation

slot_pool_segmented
65536 194.77 ns (➖ 1.00x slower)
262144 731.10 ns (➖ 1.00x slower)

sandboxes

create_initialized_and_drop
medium 56.68 ms (➖ 1.03x faster)

slot_pool

alloc_dealloc_4096 alloc_dealloc_128 alloc_dealloc_1500
9.51 ns (➖ 1.01x faster) 9.51 ns (➖ 1.00x faster) 9.61 ns (➖ 1.00x slower)

snapshot_files

load_snapshot_unverified
small 85.47 µs (➖ 1.01x slower)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
65536 2.23 µs (➖ 1.01x faster) 2.52 µs (➖ 1.03x slower)
262144 9.76 µs (➖ 1.01x slower) 10.04 µs (➖ 1.00x faster)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
8192 1.27 µs (➖ 1.05x slower) 1.23 µs (➖ 1.06x faster)
65536 8.22 µs (➖ 1.18x faster) 8.29 µs (➖ 1.16x faster)
262144 36.38 µs (➖ 1.03x faster)
mshv3 / intel (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

decode_vec_bytes_copy encode_control
832.73 µs (➖ 1.11x slower)
byte_chunks 890.43 ns (➖ 1.01x slower)
vec_bytes 642.85 ns (➖ 1.08x faster)

payload_allocation

slot_pool_segmented
65536 262.59 ns (➖ 1.01x faster)
262144 656.12 ns (➖ 1.01x faster)

sandboxes

create_initialized_and_drop
medium 66.83 ms (➖ 1.04x slower)

slot_pool

alloc_dealloc_4096 alloc_dealloc_128 alloc_dealloc_1500
8.68 ns (➖ 1.00x slower) 9.44 ns (➖ 1.08x slower) 8.74 ns (➖ 1.00x slower)

snapshot_files

load_snapshot_unverified
small 44.77 µs (➖ 1.01x faster)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
65536 2.29 µs (➖ 1.02x faster) 2.29 µs (➖ 1.00x faster)
262144 7.97 µs (➖ 1.00x slower) 8.02 µs (➖ 1.01x slower)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
8192 889.31 ns (➖ 1.02x faster) 910.32 ns (➖ 1.00x faster)
65536 7.45 µs (➖ 1.01x slower) 7.46 µs (➖ 1.00x faster)
262144 40.07 µs (➖ 1.09x faster)
hyperv-ws2025 / amd (Windows) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

decode_vec_bytes_copy encode_control
1.97 ms (➖ 1.00x slower)
byte_chunks 1.20 µs (➖ 1.01x slower)
vec_bytes 782.32 ns (➖ 1.05x faster)

payload_allocation

slot_pool_segmented
65536 236.92 ns (➖ 1.03x slower)
262144 790.54 ns (➖ 1.01x slower)

sandboxes

create_initialized_and_drop
medium 80.41 ms (➖ 1.16x faster)

slot_pool

alloc_dealloc_4096 alloc_dealloc_128 alloc_dealloc_1500
10.06 ns (➖ 1.00x slower) 10.00 ns (➖ 1.00x slower) 9.90 ns (➖ 1.00x slower)

snapshot_files

load_snapshot_unverified
small 900.22 µs (➖ 1.02x faster)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
65536 2.35 µs (➖ 1.08x faster) 2.32 µs (➖ 1.02x faster)
262144 9.06 µs (➖ 1.10x faster) 8.87 µs (➖ 1.04x faster)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
8192 1.28 µs (➖ 1.01x faster) 1.30 µs (➖ 1.02x slower)
65536 8.91 µs (➖ 1.05x faster) 9.25 µs (➖ 1.02x slower)
262144 38.36 µs (➖ 1.13x faster)
hyperv-ws2025 / intel (Windows) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

decode_vec_bytes_copy encode_control
2.90 ms (➖ 1.03x faster)
byte_chunks 1.18 µs (➖ 1.00x faster)
vec_bytes 787.64 ns (➖ 1.02x slower)

payload_allocation

slot_pool_segmented
65536 207.86 ns (➖ 1.01x faster)
262144 760.93 ns (➖ 1.03x slower)

sandboxes

create_initialized_and_drop
medium 104.97 ms (➖ 1.01x faster)

slot_pool

alloc_dealloc_4096 alloc_dealloc_128 alloc_dealloc_1500
10.06 ns (➖ 1.00x slower) 9.92 ns (➖ 1.03x slower) 9.80 ns (➖ 1.02x slower)

snapshot_files

load_snapshot_unverified
small 625.35 µs (➖ 1.22x slower)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
65536 2.58 µs (➖ 1.10x slower) 2.30 µs (➖ 1.00x slower)
262144 7.76 µs (➖ 1.02x slower) 7.77 µs (➖ 1.03x slower)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
8192 1.12 µs (➖ 1.06x slower) 1.26 µs (➖ 1.17x slower)
65536 8.26 µs (➖ 1.18x faster) 8.52 µs (➖ 1.04x slower)
262144 39.98 µs (➖ 1.26x faster)

Reported by cargo ci bench-report --candidate run:40960542919 --config-file bench_report.toml.

@ludfjig
ludfjig merged commit a4563db into hyperlight-dev:main Oct 29, 2026
64 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bugfix For PRs that fix bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Guest functions with more than 11 parameters fail every call

4 participants