Skip to content

Exception handler with instruction that requires 16btye alignement causes GP fault #1047

@jsturtevant

Description

@jsturtevant

What happened?

We currently do an fxsave during exception handling, which means we should be able to use simd instructions in our handlers altough we might want to reconsider this at somepoint.

When tracing was enabled we added the attribute to map_memory function which is called from the page fault handler in HL-wasm:

#[instrument(skip_all, parent = Span::current(), level= "Trace")]
pub unsafe fn map_region(phys_base: u64, virt_base: *mut u8, len: u64) {
let mut pml4_base: u64;

HL-wasm started compiling for a target that enabled this to fix an issue an assumption that simd would be available in the host bytecodealliance/wasmtime#11506.

This causes that compiler to generated simd instructions in the instrument macro and cause a page fault (actually a stack over flow but the root cuase was the page fault which got cuaght in an endless loop untill the stack ran out).

We might want to consider removing the instrument macro but since we currently support Simd instructions in the exceptions handlers we should fix that issue.

What did you expect to happen?

not to panic with simd instructions in the exception handler.

Steps to reproduce the behavior

hyperlight-dev/hyperlight-wasm#166

Hyperlight Version

0.11

OS version

On Linux:
$ cat /etc/os-release
# paste output here

$ uname -a
# paste output here

On Windows:
C:\> cmd /c ver
# paste output here

Additional Information

No response

Metadata

Metadata

Assignees

Labels

lifecycle/confirmedBug is verified or proposal seems reasonable

Type

No type

Projects

Status

No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions