Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump to v0.9.0 #2

Merged
merged 3 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: rbpf
name: sbpf

on:
push:
Expand Down
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
name = "solana_rbpf"
version = "0.8.2"
name = "solana-sbpf"
version = "0.9.0"
description = "Virtual machine and JIT compiler for eBPF programs"
authors = ["Solana Maintainers <[email protected]>"]
repository = "https://github.com/solana-labs/rbpf"
repository = "https://github.com/anza-xyz/sbpf"
homepage = "https://solana.com/"
keywords = ["BPF", "eBPF", "interpreter", "JIT", "filtering"]
license = "Apache-2.0"
Expand Down
32 changes: 15 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# solana_rbpf
# solana-sbpf

![](misc/rbpf_256.png)
SBPF virtual machine

Rust (user-space) virtual machine for eBPF

[![Build Status](https://github.com/solana-labs/rbpf/actions/workflows/main.yml/badge.svg)](https://github.com/solana-labs/rbpf/actions/workflows/main.yml)
[![Crates.io](https://img.shields.io/crates/v/solana_rbpf.svg)](https://crates.io/crates/solana_rbpf)
[![Build Status](https://github.com/anza-xyz/sbpf/actions/workflows/main.yml/badge.svg)](https://github.com/anza-xyz/sbpf/actions/workflows/main.yml)
[![Crates.io](https://img.shields.io/crates/v/solana-sbpf.svg)](https://crates.io/crates/solana-sbpf)

## Description

This is a fork of [RBPF](https://github.com/qmonnet/rbpf) by Quentin Monnet.
This is a fork of [RBPF](https://github.com/solana-labs/rbpf) which in turn is a fork of [RBPF](https://github.com/qmonnet/rbpf) by Quentin Monnet.

This crate contains a virtual machine for eBPF program execution. BPF, as in
_Berkeley Packet Filter_, is an assembly-like language initially developed for
Expand All @@ -26,48 +24,48 @@ although the JIT-compiler does not work with Windows at this time.

## Link to the crate

This crate is available from [crates.io](https://crates.io/crates/solana_rbpf),
This crate is available from [crates.io](https://crates.io/crates/solana-sbpf),
so it should work out of the box by adding it as a dependency in your
`Cargo.toml` file:

```toml
[dependencies]
solana_rbpf = "0.8.2"
solana-sbpf = "0.9.0"
```

You can also use the development version from this GitHub repository. This
should be as simple as putting this inside your `Cargo.toml`:

```toml
[dependencies]
solana_rbpf = { git = "https://github.com/solana-labs/rbpf", branch = "main" }
solana-sbpf = { git = "https://github.com/anza-xyz/sbpf", branch = "main" }
```

Of course, if you prefer, you can clone it locally, possibly hack the crate,
and then indicate the path of your local version in `Cargo.toml`:

```toml
[dependencies]
solana_rbpf = { path = "path/to/solana_rbpf" }
solana-sbpf = { path = "path/to/sbpf" }
```

Then indicate in your source code that you want to use the crate:

```rust,ignore
extern crate solana_rbpf;
extern crate solana_sbpf;
```

## API

The API is pretty well documented inside the source code. You should also be
able to access [an online version of the documentation from
here](https://docs.rs/solana_rbpf/), automatically generated from the
[crates.io](https://crates.io/crates/solana_rbpf)
here](https://docs.rs/solana-sbpf/), automatically generated from the
[crates.io](https://crates.io/crates/solana-sbpf)
version (may not be up-to-date with master branch).
[Examples](examples), [unit tests](tests) and [performance benchmarks](benches)
should also prove helpful.

Here are the steps to follow to run an eBPF program with rbpf:
Here are the steps to follow to run an SBPF:

1. Create the config and a loader built-in program, add some functions.
2. Create an executable, either from the bytecode or an ELF.
Expand All @@ -81,7 +79,7 @@ Here are the steps to follow to run an eBPF program with rbpf:
## Developer

### Dependencies
- rustc version 1.72 or higher
- rustc version 1.83 or higher

### Build and test instructions
- To build run `cargo build`
Expand All @@ -90,7 +88,7 @@ Here are the steps to follow to run an eBPF program with rbpf:
## License

Following the effort of the Rust language project itself in order to ease
integration with other projects, the rbpf crate is distributed under the terms
integration with other projects, the sbpf crate is distributed under the terms
of both the MIT license and the Apache License (Version 2.0).

See [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT) for details.
4 changes: 2 additions & 2 deletions benches/elf_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

#![feature(test)]

extern crate solana_rbpf;
extern crate solana_sbpf;
extern crate test;
extern crate test_utils;

use solana_rbpf::{
use solana_sbpf::{
elf::Executable,
program::{BuiltinFunction, BuiltinProgram, FunctionRegistry},
syscalls,
Expand Down
4 changes: 2 additions & 2 deletions benches/jit_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

#![feature(test)]

extern crate solana_rbpf;
extern crate solana_sbpf;
extern crate test;

use solana_rbpf::{
use solana_sbpf::{
elf::Executable, program::BuiltinProgram, verifier::RequisiteVerifier, vm::TestContextObject,
};
use std::{fs::File, io::Read, sync::Arc};
Expand Down
4 changes: 2 additions & 2 deletions benches/memory_mapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
#![feature(test)]

extern crate rand;
extern crate solana_rbpf;
extern crate solana_sbpf;
extern crate test;

use rand::{rngs::SmallRng, Rng, SeedableRng};
use solana_rbpf::{
use solana_sbpf::{
memory_region::{
AccessType, AlignedMemoryMapping, MemoryRegion, MemoryState, UnalignedMemoryMapping,
},
Expand Down
8 changes: 4 additions & 4 deletions benches/vm_execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@

#![feature(test)]

extern crate solana_rbpf;
extern crate solana_sbpf;
extern crate test;

#[cfg(all(feature = "jit", not(target_os = "windows"), target_arch = "x86_64"))]
use solana_rbpf::{
use solana_sbpf::{
ebpf,
memory_region::MemoryRegion,
program::{FunctionRegistry, SBPFVersion},
vm::Config,
};
use solana_rbpf::{
use solana_sbpf::{
elf::Executable, program::BuiltinProgram, verifier::RequisiteVerifier, vm::TestContextObject,
};
use std::{fs::File, io::Read, sync::Arc};
Expand Down Expand Up @@ -83,7 +83,7 @@ fn bench_jit_vs_interpreter(
instruction_meter: u64,
mem: &mut [u8],
) {
let mut executable = solana_rbpf::assembler::assemble::<TestContextObject>(
let mut executable = solana_sbpf::assembler::assemble::<TestContextObject>(
assembly,
Arc::new(BuiltinProgram::new_loader(
config,
Expand Down
14 changes: 7 additions & 7 deletions cli/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[package]
name = "rbpf_cli"
version = "0.8.2"
name = "sbpf_cli"
version = "0.9.0"
description = "CLI to test and analyze eBPF programs"
authors = ["Solana Maintainers <[email protected]>"]
repository = "https://github.com/solana-labs/rbpf"
repository = "https://github.com/anza-xyz/sbpf"
homepage = "https://solana.com/"
keywords = ["BPF", "eBPF", "interpreter", "JIT"]
edition = "2018"

[dependencies]
solana_rbpf = { path = "../", features = ["debugger"] }
solana-sbpf = { path = "../", features = ["debugger"] }
test_utils = { path = "../test_utils/" }
clap = "3.0.0-beta.2"
2 changes: 1 addition & 1 deletion cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use clap::{crate_version, App, Arg};
use solana_rbpf::{
use solana_sbpf::{
aligned_memory::AlignedMemory,
assembler::assemble,
ebpf,
Expand Down
4 changes: 2 additions & 2 deletions examples/disassemble.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// the MIT license <http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except according to those terms.

extern crate solana_rbpf;
use solana_rbpf::{
extern crate solana_sbpf;
use solana_sbpf::{
elf::Executable,
program::{BuiltinProgram, FunctionRegistry, SBPFVersion},
static_analysis::Analysis,
Expand Down
4 changes: 2 additions & 2 deletions examples/to_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ extern crate json;
extern crate elf;
use std::path::PathBuf;

extern crate solana_rbpf;
use solana_rbpf::{
extern crate solana_sbpf;
use solana_sbpf::{
elf::Executable,
program::{BuiltinProgram, FunctionRegistry, SBPFVersion},
static_analysis::Analysis,
Expand Down
14 changes: 7 additions & 7 deletions fuzz/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions fuzz/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "solana_rbpf-fuzz"
version = "0.8.2"
name = "solana-sbpf-fuzz"
version = "0.9.0"
authors = ["Automatically generated"]
publish = false
edition = "2018"
Expand All @@ -15,7 +15,7 @@ num-traits = "0.2"
rayon = "1.5"
test_utils = { path = "../test_utils/" }

[dependencies.solana_rbpf]
[dependencies.solana-sbpf]
path = ".."
features = ["fuzzer-not-safe-for-production"]

Expand Down
2 changes: 1 addition & 1 deletion fuzz/fuzz_targets/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::mem::size_of;

use arbitrary::{Arbitrary, Unstructured};

use solana_rbpf::vm::Config;
use solana_sbpf::vm::Config;

#[derive(Debug)]
pub struct ConfigTemplate {
Expand Down
2 changes: 1 addition & 1 deletion fuzz/fuzz_targets/dumb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::hint::black_box;

use libfuzzer_sys::fuzz_target;

use solana_rbpf::{
use solana_sbpf::{
ebpf,
elf::Executable,
memory_region::MemoryRegion,
Expand Down
2 changes: 1 addition & 1 deletion fuzz/fuzz_targets/grammar_aware.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(dead_code)]

use solana_rbpf::insn_builder::{Arch, BpfCode, Cond, Endian, Instruction, MemSize, Source};
use solana_sbpf::insn_builder::{Arch, BpfCode, Cond, Endian, Instruction, MemSize, Source};

#[derive(arbitrary::Arbitrary, Debug, Eq, PartialEq)]
pub enum FuzzedOp {
Expand Down
2 changes: 1 addition & 1 deletion fuzz/fuzz_targets/semantic_aware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use std::num::NonZeroI32;

use solana_rbpf::insn_builder::{Arch, BpfCode, Cond, Endian, Instruction, MemSize, Move, Source};
use solana_sbpf::insn_builder::{Arch, BpfCode, Cond, Endian, Instruction, MemSize, Move, Source};

#[derive(arbitrary::Arbitrary, Debug, Eq, PartialEq, Copy, Clone)]
pub struct Register(u8);
Expand Down
Loading
Loading