Skip to content

Commit

Permalink
Run spell checks on the repo (#58)
Browse files Browse the repository at this point in the history
* Run spell checks on the repo

Signed-off-by: Tomasz Andrzejak <[email protected]>

* Fix typo in `GuestPanicContext`

Signed-off-by: Tomasz Andrzejak <[email protected]>

---------

Signed-off-by: Tomasz Andrzejak <[email protected]>
  • Loading branch information
andreiltd authored Nov 14, 2024
1 parent 22b6795 commit 1f66dca
Show file tree
Hide file tree
Showing 32 changed files with 60 additions and 48 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/ValidatePullRequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ jobs:
max_total_time: 300 # 5 minutes in seconds
docs_only: ${{needs.docs-pr.outputs.docs-only}}
secrets: inherit
spelling:
name: spell check with typos
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Spell Check Repo
uses: crate-ci/typos@master

#####
# start build-on-windows
Expand Down
2 changes: 1 addition & 1 deletion Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ run-rust-examples target=default-target: (build-rust target)
cargo run --profile={{ if target == "debug" { "dev" } else { target } }} --example metrics --features "function_call_metrics"
{{ set-trace-env-vars }} cargo run --profile={{ if target == "debug" { "dev" } else { target } }} --example logging

# The two tracing eamples are flaky on windows so we run them on linux only for now, need to figure out why as they run fine locally on windows
# The two tracing examples are flaky on windows so we run them on linux only for now, need to figure out why as they run fine locally on windows
run-rust-examples-linux target=default-target: (build-rust target) (run-rust-examples target)
{{ set-trace-env-vars }} cargo run --profile={{ if target == "debug" { "dev" } else { target } }} --example tracing
{{ set-trace-env-vars }} cargo run --profile={{ if target == "debug" { "dev" } else { target } }} --example tracing --features "function_call_metrics"
Expand Down
2 changes: 1 addition & 1 deletion NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ under the standard MIT terms.
All other files which have no copyright comments are original works
produced specifically for use as part of this library, written either
by Rich Felker, the main author of the library, or by one or more
contibutors listed above. Details on authorship of individual files
contributors listed above. Details on authorship of individual files
can be found in the git version control history of the project. The
omission of copyright and license comments in each file is in the
interest of source tree size.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl From<&LogLevel> for FbLogLevel {

impl From<&LogLevel> for Level {
// There is a test (sandbox::outb::tests::test_log_outb_log) which emits trace record as logs
// which causes a panic when this function is instrumeneted as the logger is contained in refcell and
// which causes a panic when this function is instrumented as the logger is contained in refcell and
// instrumentation ends up causing a double mutborrow. So this is not instrumented.
//TODO: instrument this once we fix the test
fn from(val: &LogLevel) -> Level {
Expand Down
2 changes: 1 addition & 1 deletion src/hyperlight_host/benches/benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ fn sandbox_benchmark(c: &mut Criterion) {

// Benchmarks the time to create a new uninintialized sandbox.
// Does **not** include the time to drop the sandbox.
group.bench_function("create_uninitalized_sandbox", |b| {
group.bench_function("create_uninitialized_sandbox", |b| {
b.iter_with_large_drop(create_uninit_sandbox);
});

Expand Down
2 changes: 1 addition & 1 deletion src/hyperlight_host/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ pub enum HyperlightError {
#[error("Failed To Convert Parameter Value {0:?} to {1:?}")]
ParameterValueConversionFailure(ParameterValue, &'static str),

/// a failure occured processing a PE file
/// a failure occurred processing a PE file
#[error("Failure processing PE File {0:?}")]
PEFileProcessingFailure(#[from] goblin::error::Error),

Expand Down
6 changes: 3 additions & 3 deletions src/hyperlight_host/src/func/call_ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl MultiUseGuestCallContext {
///
/// Every call to a guest function through this method will be made with the same "context"
/// meaning that the guest state resulting from any previous call will be present/osbservable
/// by the guest funcation called.
/// by the guest function called.
///
/// If you want to reset state, call `finish()` on this `MultiUseGuestCallContext`
/// and get a new one from the resulting `MultiUseSandbox`
Expand Down Expand Up @@ -89,9 +89,9 @@ impl MultiUseGuestCallContext {
/// Note that this method is pub(crate) and does not reset the state of the
/// sandbox.
///
/// It is intended to be used when evolving a MutliUseSandbox to a new state
/// It is intended to be used when evolving a MultiUseSandbox to a new state
/// and is not intended to be called publicly. It allows the state of the guest to be altered
/// during the eveolution of one sandbox state to another, enabling the new state created
/// during the evolution of one sandbox state to another, enabling the new state created
/// to be captured and stored in the Sandboxes state stack.
///
pub(crate) fn finish_no_reset(self) -> MultiUseSandbox {
Expand Down
2 changes: 1 addition & 1 deletion src/hyperlight_host/src/hypervisor/hypervisor_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,7 @@ fn set_up_hypervisor_partition(
// debug build without in-process feature
log_then_return!("In-process mode requires `inprocess` cargo feature");
} else {
log_then_return!("In-process mode requires `inprocess` cargo feature and is only avaiable on debug-builds");
log_then_return!("In-process mode requires `inprocess` cargo feature and is only available on debug-builds");
}
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/hyperlight_host/src/hypervisor/kvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ impl KVMDriver {
})?;

let mut vcpu_fd = vm_fd.create_vcpu(0)?;
Self::setup_inital_sregs(&mut vcpu_fd, pml4_addr)?;
Self::setup_initial_sregs(&mut vcpu_fd, pml4_addr)?;

let rsp_gp = GuestPtr::try_from(RawPtr::from(rsp))?;
Ok(Self {
Expand All @@ -117,7 +117,7 @@ impl KVMDriver {
}

#[instrument(err(Debug), skip_all, parent = Span::current(), level = "Trace")]
fn setup_inital_sregs(vcpu_fd: &mut VcpuFd, pml4_addr: u64) -> Result<()> {
fn setup_initial_sregs(vcpu_fd: &mut VcpuFd, pml4_addr: u64) -> Result<()> {
// setup paging and IA-32e (64-bit) mode
let mut sregs = vcpu_fd.get_sregs()?;
sregs.cr3 = pml4_addr;
Expand Down
4 changes: 2 additions & 2 deletions src/hyperlight_host/src/hypervisor/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ mod tests {
/// Marking this test as ignored means that running `cargo test` will not
/// run it. This will allow a developer who runs that command
/// from their workstation to be successful without needing to know about
/// test interdependencies. This test will, however, be run explcitly as a
/// test interdependencies. This test will, however, be run explicitly as a
/// part of the CI pipeline.
fn test_metrics() {
let iter: HypervisorMetricIter = HypervisorMetric::iter();
Expand Down Expand Up @@ -151,7 +151,7 @@ mod tests {
/// Marking this test as ignored means that running `cargo test` will not
/// run it. This will allow a developer who runs that command
/// from their workstation to be successful without needing to know about
/// test interdependencies. This test will, however, be run explcitly as a
/// test interdependencies. This test will, however, be run explicitly as a
/// part of the CI pipeline.
fn test_gather_metrics() {
lazy_static! {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,13 +307,13 @@ fn ensure_surrogate_process_exe() -> Result<()> {
if p.exists() {
// check to see if sha's match and if not delete the file so we'll extract
// the embedded file below.
let embeded_file_sha = sha256::digest(exe.data.as_ref());
let embedded_file_sha = sha256::digest(exe.data.as_ref());
let file_on_disk_sha = sha256::try_digest(&p)?;

if embeded_file_sha != file_on_disk_sha {
if embedded_file_sha != file_on_disk_sha {
println!(
"sha of embedded surrorate '{}' does not match sha of file on disk '{}' - deleting surrogate binary at {}",
embeded_file_sha,
embedded_file_sha,
file_on_disk_sha,
&surrogate_process_path.display()
);
Expand Down
2 changes: 1 addition & 1 deletion src/hyperlight_host/src/mem/exe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use super::pe::pe_info::PEInfo;
use super::ptr_offset::Offset;
use crate::Result;

// This is used extremely infrequently, so being unusally large for PE
// This is used extremely infrequently, so being unusually large for PE
// files _really_ doesn't matter, and probably isn't really worth the
// cost of an indirection.
#[allow(clippy::large_enum_variant)]
Expand Down
6 changes: 3 additions & 3 deletions src/hyperlight_host/src/mem/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ impl SandboxMemoryLayout {
/// Get the offset in guest memory to the output data pointer.
#[instrument(skip_all, parent = Span::current(), level= "Trace")]
fn get_output_data_pointer_offset(&self) -> usize {
// This field is immedaitely after the output data size field,
// This field is immediately after the output data size field,
// which is a `u64`.
self.get_output_data_size_offset() + size_of::<u64>()
}
Expand Down Expand Up @@ -626,7 +626,7 @@ impl SandboxMemoryLayout {
#[instrument(skip_all, parent = Span::current(), level= "Trace")]
pub(crate) fn get_guest_panic_context_buffer_pointer_offset(&self) -> usize {
// The guest panic data pointer is immediately after the guest
// panic data size field in the `GuestPanicCOntext` data which is a `u64`
// panic data size field in the `GuestPanicContext` data which is a `u64`
self.get_guest_panic_context_size_offset() + size_of::<u64>()
}

Expand Down Expand Up @@ -715,7 +715,7 @@ impl SandboxMemoryLayout {
stack_size: usize,
heap_size: usize,
) -> usize {
// Get the conigured memory size (assume each section is 4K aligned)
// Get the configured memory size (assume each section is 4K aligned)

let mut total_mapped_memory_size: usize = round_up_to(code_size, PAGE_SIZE_USIZE);
total_mapped_memory_size += round_up_to(stack_size, PAGE_SIZE_USIZE);
Expand Down
2 changes: 1 addition & 1 deletion src/hyperlight_host/src/mem/loaded_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl LoadedLib {
let mut lock = LOADED_LIB.lock().unwrap();
if lock.upgrade().is_some() {
// An owning copy of the loaded library still exists somewhere,
// we can't load a new libary yet
// we can't load a new library yet
log_then_return!("LoadedLib: Only one guest binary can be loaded at any single time");
}
let inner = Arc::new(LoadedLibInner::load(path)?);
Expand Down
4 changes: 2 additions & 2 deletions src/hyperlight_host/src/mem/mgr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ where
PAGE_PRESENT | PAGE_RW | PAGE_USER | PAGE_NX
}
// The guard page is marked RW and User so that if it gets written to we can detect it in the host
// If/When we implement an interupt handler for page faults in the guest then we can remove this access and handle things properly there
// If/When we implement an interrupt handler for page faults in the guest then we can remove this access and handle things properly there
MemoryRegionType::GuardPage => {
PAGE_PRESENT | PAGE_RW | PAGE_USER | PAGE_NX
}
Expand Down Expand Up @@ -585,7 +585,7 @@ impl SandboxMemoryManager<HostSharedMemory> {
// addresses that are valid are in its own address space.
//
// When executing in-process, maniulating this pointer could cause the
// host to execute arbitary functions.
// host to execute arbitrary functions.
let guest_ptr = GuestPtr::try_from(RawPtr::from(guest_dispatch_function_ptr))?;
guest_ptr.absolute()
}
Expand Down
2 changes: 1 addition & 1 deletion src/hyperlight_host/src/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub mod layout;
pub(super) mod loaded_lib;
/// memory regions to be mapped inside a vm
pub mod memory_region;
/// Functionality taht wraps a `SandboxMemoryLayout` and a
/// Functionality that wraps a `SandboxMemoryLayout` and a
/// `SandboxMemoryConfig` to mutate a sandbox's memory as necessary.
pub mod mgr;
/// Functionality to read and mutate a PE file in a structured manner.
Expand Down
2 changes: 1 addition & 1 deletion src/hyperlight_host/src/mem/pe/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

/// Extends goblin to suport base relocations in PE file
/// Extends goblin to support base relocations in PE file
pub(super) mod base_relocations;
/// PE file headers
pub(super) mod headers;
Expand Down
4 changes: 2 additions & 2 deletions src/hyperlight_host/src/mem/shared_mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ impl ExclusiveSharedMemory {
/// Convert the ExclusiveSharedMemory, which may be freely
/// modified, into a GuestSharedMemory, which may be somewhat
/// freely modified (mostly by the guest), and a HostSharedMemory,
/// which may only make certain kinds of acceses that do not race
/// which may only make certain kinds of accesses that do not race
/// in the presence of malicious code inside the guest mutating
/// the GuestSharedMemory.
pub fn build(self) -> (HostSharedMemory, GuestSharedMemory) {
Expand Down Expand Up @@ -1095,7 +1095,7 @@ mod tests {
/// Marking this test as ignored means that running `cargo test` will not
/// run it. This feature will allow a developer who runs that command
/// from their workstation to be successful without needing to know about
/// test interdependencies. This test will, however, be run explcitly as a
/// test interdependencies. This test will, however, be run explicitly as a
/// part of the CI pipeline.
#[test]
#[ignore]
Expand Down
10 changes: 5 additions & 5 deletions src/hyperlight_host/src/metrics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ pub fn set_metrics_registry(registry: &'static Registry) -> Result<()> {
REGISTRY
.set(registry)
// This should be impossible
.map_err(|e| new_error!("Registry alread set : {0:?}", e))
.map_err(|e| new_error!("Registry already set : {0:?}", e))
}
}
}
Expand All @@ -259,7 +259,7 @@ fn get_histogram_opts(name: &str, help: &str, buckets: Vec<f64>) -> HistogramOpt
opts.buckets(buckets)
}

/// Provides functionaility to help with testing Hyperlight Metrics
/// Provides functionality to help with testing Hyperlight Metrics
pub mod tests {
use std::collections::HashSet;

Expand All @@ -281,11 +281,11 @@ pub mod tests {
fn enum_has_variant_for_all_metrics() {
let metric_definitions = Self::get_metric_definitions().iter();
for metric_definition in metric_definitions {
let metric_defintion_name = metric_definition.name;
let metric_definition_name = metric_definition.name;
assert!(
Self::get_enum_variant_names().contains(&metric_defintion_name),
Self::get_enum_variant_names().contains(&metric_definition_name),
"Metric Definition Name {} not found",
metric_defintion_name,
metric_definition_name,
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/hyperlight_host/src/sandbox/initialized_multi_use.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl MultiUseSandbox {
/// `MultiUseGuestCallContext` is guaranteed mutual exclusion for calling
/// functions within the sandbox. This guarantee is enforced at compile
/// time, and no locks, atomics, or any other mutual exclusion mechanisms
/// are used at rumtime.
/// are used at runtime.
///
/// If you have called this function, have a `MultiUseGuestCallContext`,
/// and wish to "return" it to a `MultiUseSandbox`, call the `finish`
Expand Down Expand Up @@ -238,7 +238,7 @@ where
/// An implementation such as HyperlightJs or HyperlightWasm can use this to call guest functions to load JS or WASM code and then evolve the sandbox causing state to be captured.
/// The new MultiUseSandbox can then be used to call guest functions to execute the loaded code.
///
/// The evolve function creates a new MutliUseCallContext which is then passed to a callback function allowing the
/// The evolve function creates a new MultiUseCallContext which is then passed to a callback function allowing the
/// callback function to call guest functions as part of the evolve process, once the callback function is complete
/// the context is finished using a crate internal method that does not restore the prior state of the Sanbbox.
/// It then creates a mew memory snapshot on the snapshot stack and returns the MultiUseSandbox
Expand Down
2 changes: 1 addition & 1 deletion src/hyperlight_host/src/sandbox/initialized_single_use.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl SingleUseSandbox {
}

/// Create a new `SingleUseCallContext` . The main purpose of the
/// a SingleUseSandbox is to allow mutiple calls to guest functions from within a callback function.
/// a SingleUseSandbox is to allow multiple calls to guest functions from within a callback function.
///
/// Since this function consumes `self`, the returned
/// `SingleUseGuestCallContext` is guaranteed mutual exclusion for calling
Expand Down
8 changes: 4 additions & 4 deletions src/hyperlight_host/src/sandbox/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

/*!
This modue contains the definitions and implementations of the metrics used by the sandbox module
This module contains the definitions and implementations of the metrics used by the sandbox module
*/
use std::collections::HashMap;
use std::sync::Once;
Expand Down Expand Up @@ -150,7 +150,7 @@ mod tests {
/// Marking this test as ignored means that running `cargo test` will not
/// run it. This feature will allow a developer who runs that command
/// from their workstation to be successful without needing to know about
/// test interdependencies. This test will, however, be run explcitly as a
/// test interdependencies. This test will, however, be run explicitly as a
/// part of the CI pipeline.
fn test_metrics() {
let iter: SandboxMetricIter = SandboxMetric::iter();
Expand Down Expand Up @@ -226,7 +226,7 @@ mod tests {
assert_eq!(histogram.get_sample_sum(&label_vals).unwrap(), 1.0);
}
_ => {
panic!("metric is not an IntGauge,IntCounterVec or HistorgamVec");
panic!("metric is not an IntGauge,IntCounterVec or HistogramVec");
}
},
Err(e) => {
Expand All @@ -242,7 +242,7 @@ mod tests {
/// Marking this test as ignored means that running `cargo test` will not
/// run it. This feature will allow a developer who runs that command
/// from their workstation to be successful without needing to know about
/// test interdependencies. This test will, however, be run explcitly as a
/// test interdependencies. This test will, however, be run explicitly as a
/// part of the CI pipeline.
fn test_gather_metrics() {
lazy_static! {
Expand Down
2 changes: 1 addition & 1 deletion src/hyperlight_host/src/sandbox/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ mod run_options;
/// Functionality for creating uninitialized sandboxes, manipulating them,
/// and converting them to initialized sandboxes.
pub mod uninitialized;
/// Functionality for properly converting `UninitailizedSandbox`es to
/// Functionality for properly converting `UninitializedSandbox`es to
/// initialized `Sandbox`es.
pub(crate) mod uninitialized_evolve;

Expand Down
2 changes: 1 addition & 1 deletion src/hyperlight_host/src/sandbox/outb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ mod tests {
// this test is ignored because it is incompatible with other tests , specifically those which require a logger for tracing
// marking this test as ignored means that running `cargo test` will not run this test but will allow a developer who runs that command
// from their workstation to be successful without needed to know about test interdependencies
// this test will be run explcitly as a part of the CI pipeline
// this test will be run explicitly as a part of the CI pipeline
#[ignore]
#[test]
fn test_trace_outb_log() {
Expand Down
2 changes: 1 addition & 1 deletion src/hyperlight_host/src/sandbox/uninitialized.rs
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ mod tests {
// this test is ignored because it is incompatible with other tests , specifically those which require a logger for tracing
// marking this test as ignored means that running `cargo test` will not run this test but will allow a developer who runs that command
// from their workstation to be successful without needed to know about test interdependencies
// this test will be run explcitly as a part of the CI pipeline
// this test will be run explicitly as a part of the CI pipeline
#[ignore]
fn test_trace_trace() {
TestLogger::initialize_log_tracer();
Expand Down
2 changes: 1 addition & 1 deletion src/hyperlight_host/src/sandbox_state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

/// The standarized `Sandbox` trait and the ways it ban be transitioned
/// The standardized `Sandbox` trait and the ways it ban be transitioned
/// to a different `Sandbox` trait
pub mod sandbox;
/// Metadata about transitions between `Sandbox` states
Expand Down
Loading

0 comments on commit 1f66dca

Please sign in to comment.