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

src/ebpf.rs: Increase instruction limit to 1 million #108

Merged
merged 1 commit into from
May 2, 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 src/ebpf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use byteorder::{ByteOrder, LittleEndian};

/// Maximum number of instructions in an eBPF program.
pub const PROG_MAX_INSNS: usize = 4096;
pub const PROG_MAX_INSNS: usize = 1000000;
/// Size of an eBPF instructions, in bytes.
pub const INSN_SIZE: usize = 8;
/// Maximum size of an eBPF program, in bytes.
Expand Down
4 changes: 2 additions & 2 deletions tests/ubpf_verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ fn test_verifier_err_no_exit_backward_jump() {
}

#[test]
#[should_panic(expected = "[Verifier] Error: eBPF program length limited to 4096, here 4097")]
#[should_panic(expected = "[Verifier] Error: eBPF program length limited to 1000000, here 1000001")]
fn test_verifier_err_too_many_instructions() {
// uBPF uses 65637 instructions, because it sets its limit at 65636.
// We use the classic 4096 limit from kernel, so no need to produce as many instructions.
let mut prog = (0..(4096 * ebpf::INSN_SIZE)).map( |x| match x % 8 {
let mut prog = (0..(1_000_000 * ebpf::INSN_SIZE)).map( |x| match x % 8 {
0 => 0xb7,
1 => 0x01,
_ => 0
Expand Down
Loading