Skip to content

Commit 9564dc0

Browse files
authored
Merge branch 'main' into get-simple-guest-for-fuzzing
2 parents 03f950d + 4a4c5f7 commit 9564dc0

File tree

11 files changed

+119
-109
lines changed

11 files changed

+119
-109
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ RUN apt-get update \
1414
build-essential \
1515
cmake \
1616
curl \
17+
gdb \
1718
git \
1819
gnupg \
1920
gnuplot \

.devcontainer/devcontainer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"customizations": {
2424
"vscode": {
2525
"extensions": [
26+
"ms-vscode.cpptools-extension-pack",
2627
"ms-vscode.cmake-tools",
2728
"rust-lang.rust-analyzer",
2829
"vadimcn.vscode-lldb"

.github/workflows/dep_rust.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ jobs:
5858
run: just fmt-check
5959

6060
- name: clippy
61-
run: just clippy ${{ matrix.config }}
61+
run: |
62+
just clippy ${{ matrix.config }}
63+
just clippy-guests ${{ matrix.config }}
6264
6365
# Does not check for updated Cargo.lock files for test rust guests as this causes an issue with this checkwhen deoendabot updates dependencies in common crates
6466
- name: Ensure up-to-date Cargo.lock

Cargo.lock

Lines changed: 20 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Justfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ fmt-apply:
138138
clippy target=default-target:
139139
cargo clippy --all-targets --all-features --profile={{ if target == "debug" { "dev" } else { target } }} -- -D warnings
140140

141+
clippy-guests target=default-target:
142+
cd src/tests/rust_guests/simpleguest && cargo clippy --profile={{ if target == "debug" { "dev" } else { target } }} -- -D warnings
143+
cd src/tests/rust_guests/callbackguest && cargo clippy --profile={{ if target == "debug" { "dev" } else { target } }} -- -D warnings
144+
141145
clippy-apply-fix-unix:
142146
cargo clippy --fix --all
143147

src/hyperlight_guest/src/guest_function_call.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub(crate) fn call_guest_function(function_call: FunctionCall) -> Result<Vec<u8>
5858

5959
let p_function = unsafe {
6060
let function_pointer = registered_function_definition.function_pointer;
61-
core::mem::transmute::<i64, GuestFunc>(function_pointer)
61+
core::mem::transmute::<usize, GuestFunc>(function_pointer)
6262
};
6363

6464
p_function(&function_call)

src/hyperlight_guest/src/guest_function_definition.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub struct GuestFunctionDefinition {
3333
/// The type of the return value from the host function call
3434
pub return_type: ReturnType,
3535
/// The function pointer to the guest function
36-
pub function_pointer: i64,
36+
pub function_pointer: usize,
3737
}
3838

3939
impl GuestFunctionDefinition {
@@ -42,7 +42,7 @@ impl GuestFunctionDefinition {
4242
function_name: String,
4343
parameter_types: Vec<ParameterType>,
4444
return_type: ReturnType,
45-
function_pointer: i64,
45+
function_pointer: usize,
4646
) -> Self {
4747
Self {
4848
function_name,

src/hyperlight_guest_capi/src/dispatch.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub fn guest_dispatch_function(function_call: FunctionCall) -> Result<Vec<u8>> {
3939
let ffi_func_call = FfiFunctionCall::from_function_call(function_call)?;
4040

4141
let guest_func =
42-
unsafe { mem::transmute::<i64, CGuestFunc>(registered_func.function_pointer) };
42+
unsafe { mem::transmute::<usize, CGuestFunc>(registered_func.function_pointer) };
4343
let function_result = guest_func(&ffi_func_call);
4444

4545
unsafe { Ok(FfiVec::into_vec(*function_result)) }
@@ -76,12 +76,8 @@ pub extern "C" fn hl_register_function_definition(
7676

7777
let func_params = unsafe { slice::from_raw_parts(params_type, param_no).to_vec() };
7878

79-
let func_def = GuestFunctionDefinition::new(
80-
func_name,
81-
func_params,
82-
return_type,
83-
func_ptr as usize as i64,
84-
);
79+
let func_def =
80+
GuestFunctionDefinition::new(func_name, func_params, return_type, func_ptr as usize);
8581

8682
#[allow(static_mut_refs)]
8783
unsafe { &mut REGISTERED_C_GUEST_FUNCTIONS }.register(func_def);

src/hyperlight_host/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ paste = "1.0"
2929
flatbuffers = "25.2.10"
3030
page_size = "0.6.0"
3131
termcolor = "1.2.0"
32-
bitflags = "2.8.0"
32+
bitflags = "2.9.0"
3333
lazy_static = "1.4.0"
3434
serde = { version = "1.0", features = ["derive"] }
3535
serde_json = "1.0"
@@ -67,7 +67,7 @@ windows = { version = "0.59", features = [
6767
windows-sys = { version = "0.59", features = ["Win32"] }
6868
windows-result = "0.3"
6969
rust-embed = { version = "8.3.0", features = ["debug-embed", "include-exclude", "interpolate-folder-path"] }
70-
sha256 = "1.4.0"
70+
sha256 = "1.6.0"
7171
windows-version = "0.1"
7272

7373
[target.'cfg(unix)'.dependencies]

0 commit comments

Comments
 (0)