diff --git a/Cargo.lock b/Cargo.lock index ae937b661..f64321f6d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -213,7 +213,7 @@ dependencies = [ [[package]] name = "solana_rbpf" -version = "0.2.3" +version = "0.2.4" dependencies = [ "byteorder 1.2.7", "combine", diff --git a/Cargo.toml b/Cargo.toml index f80009de3..023b85d5e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "solana_rbpf" -version = "0.2.3" +version = "0.2.4" description = "Virtual machine and JIT compiler for eBPF programs" authors = ["Solana Maintainers "] repository = "https://github.com/solana-labs/rbpf" diff --git a/README.md b/README.md index 3c5603e85..1ec7c02fd 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ so it should work out of the box by adding it as a dependency in your ```toml [dependencies] -solana_rbpf = "0.2.2" +solana_rbpf = "0.2.4" ``` You can also use the development version from this GitHub repository. This diff --git a/cli/Cargo.lock b/cli/Cargo.lock index 97de01363..f925dd086 100644 --- a/cli/Cargo.lock +++ b/cli/Cargo.lock @@ -297,7 +297,7 @@ dependencies = [ [[package]] name = "rbpf_cli" -version = "0.2.3" +version = "0.2.4" dependencies = [ "clap", "rustc-demangle", @@ -333,7 +333,7 @@ dependencies = [ [[package]] name = "solana_rbpf" -version = "0.2.3" +version = "0.2.4" dependencies = [ "byteorder", "combine", diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 09f474dbb..44cb19026 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rbpf_cli" -version = "0.2.3" +version = "0.2.4" description = "CLI to test and analyze eBPF programs" authors = ["Solana Maintainers "] repository = "https://github.com/solana-labs/rbpf" diff --git a/cli/src/main.rs b/cli/src/main.rs index c9ceb936d..8ba49dab9 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -268,7 +268,7 @@ impl AnalysisResult { fn main() { let matches = App::new("Solana RBPF CLI") - .version("0.2.3") + .version("0.2.4") .author("Solana Maintainers ") .about("CLI to test and analyze eBPF programs") .arg( diff --git a/src/error.rs b/src/error.rs index a04580564..1265333bc 100644 --- a/src/error.rs +++ b/src/error.rs @@ -32,11 +32,14 @@ pub enum EbpfError { #[error("ELF error: {0}")] ELFError(#[from] ELFError), /// Syscall was already registered before - #[error("syscall was already registered before")] - SycallAlreadyRegistered, + #[error("syscall #{0} was already registered before")] + SycallAlreadyRegistered(usize), + /// Syscall was not registered before bind + #[error("syscall #{0} was not registered before bind")] + SyscallNotRegistered(usize), /// Syscall already has a bound context object - #[error("syscall already has a bound context object")] - SycallAlreadyBound, + #[error("syscall #{0} already has a bound context object")] + SyscallAlreadyBound(usize), /// Exceeded max BPF to BPF call depth #[error("exceeded max BPF to BPF call depth of {1} at instruction #{0}")] CallDepthExceeded(usize, usize), diff --git a/src/vm.rs b/src/vm.rs index 46b3628ea..e6e23fccf 100644 --- a/src/vm.rs +++ b/src/vm.rs @@ -134,7 +134,7 @@ impl SyscallRegistry { .insert(function, context_object_slot) .is_some() { - Err(EbpfError::SycallAlreadyRegistered) + Err(EbpfError::SycallAlreadyRegistered(hash as usize)) } else { Ok(()) } @@ -518,15 +518,17 @@ impl<'a, E: UserDefinedError, I: InstructionMeter> EbpfVm<'a, E, I> { Some(hash) => { syscall_registry .lookup_syscall(hash) - .unwrap() + .ok_or(EbpfError::SyscallNotRegistered(hash as usize))? .context_object_slot } None => syscall_registry .lookup_context_object_slot(fat_ptr.vtable.methods[0] as u64) - .unwrap(), + .ok_or(EbpfError::SyscallNotRegistered( + fat_ptr.vtable.methods[0] as usize, + ))?, }; if !self.syscall_context_objects[SYSCALL_CONTEXT_OBJECTS_OFFSET + slot].is_null() { - Err(EbpfError::SycallAlreadyBound) + Err(EbpfError::SyscallAlreadyBound(slot)) } else { self.syscall_context_objects[SYSCALL_CONTEXT_OBJECTS_OFFSET + slot] = fat_ptr.data; // Keep the dyn trait objects so that they can be dropped properly later