Skip to content

Commit 74f3c23

Browse files
committed
Changes to allow hyperlight-host to build with x86_64-unknown-linux-musl target
Signed-off-by: Simon Davies <[email protected]>
1 parent bdf5800 commit 74f3c23

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

Justfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,13 @@ alias cg := build-and-move-c-guests
2424

2525
# build host library
2626
build target=default-target:
27-
cargo build --profile={{ if target == "debug" { "dev" } else { target } }}
27+
cargo build --profile={{ if target == "debug" { "dev" } else { target } }}
28+
29+
# build host library
30+
build-with-musl-libc target=default-target:
31+
rustup target add x86_64-unknown-linux-musl
32+
cargo build --profile={{ if target == "debug" { "dev" } else { target } }} --target x86_64-unknown-linux-musl
33+
2834

2935
# build testing guest binaries
3036
guests: build-and-move-rust-guests build-and-move-c-guests

src/hyperlight_host/src/hypervisor/hyperv_linux.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,9 @@ impl HypervLinuxDriver {
405405
interrupt_handle: Arc::new(LinuxInterruptHandle {
406406
running: AtomicU64::new(0),
407407
cancel_requested: AtomicBool::new(false),
408+
#[cfg(all(target_arch= "x86_64", target_vendor="unknown", target_os="linux", target_env="musl"))]
409+
tid: AtomicU64::new(unsafe { libc::pthread_self() as u64}),
410+
#[cfg(not(all(target_arch= "x86_64", target_vendor="unknown", target_os="linux", target_env="musl")))]
408411
tid: AtomicU64::new(unsafe { libc::pthread_self() }),
409412
retry_delay: config.get_interrupt_retry_delay(),
410413
sig_rt_min_offset: config.get_interrupt_vcpu_sigrtmin_offset(),

src/hyperlight_host/src/hypervisor/kvm.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,9 @@ impl KVMDriver {
360360
interrupt_handle: Arc::new(LinuxInterruptHandle {
361361
running: AtomicU64::new(0),
362362
cancel_requested: AtomicBool::new(false),
363+
#[cfg(all(target_arch= "x86_64", target_vendor="unknown", target_os="linux", target_env="musl"))]
364+
tid: AtomicU64::new(unsafe { libc::pthread_self() as u64}),
365+
#[cfg(not(all(target_arch= "x86_64", target_vendor="unknown", target_os="linux", target_env="musl")))]
363366
tid: AtomicU64::new(unsafe { libc::pthread_self() }),
364367
retry_delay: config.get_interrupt_retry_delay(),
365368
dropped: AtomicBool::new(false),

src/hyperlight_host/src/seccomp/guest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ fn syscalls_allowlist() -> Result<Vec<(i64, Vec<SeccompRule>)>> {
4949
// because we don't currently support registering parameterized syscalls.
5050
(
5151
libc::SYS_ioctl,
52-
or![and![Cond::new(1, ArgLen::Dword, Eq, libc::TCGETS)?]],
52+
or![and![Cond::new(1, ArgLen::Dword, Eq, libc::TCGETS.try_into()?)?]],
5353
),
5454
// `futex` is needed for some tests that run in parallel (`simple_test_parallel`,
5555
// and `callback_test_parallel`).

0 commit comments

Comments
 (0)