Skip to content

Commit

Permalink
Bump up max program size
Browse files Browse the repository at this point in the history
  • Loading branch information
jackcmay committed Feb 22, 2019
1 parent 6a3856e commit ddfbaa0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/ebpf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use byteorder::{ByteOrder, LittleEndian};
use hash32::{Hash, Hasher, Murmur3Hasher};

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

#[test]
#[should_panic(expected = "[Verifier] Error: eBPF program length limited to 4096, here 4097")]
#[should_panic(expected = "[Verifier] Error: eBPF program length limited to 65536, here 65537")]
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..(65536 * ebpf::INSN_SIZE)).map( |x| match x % 8 {
0 => 0xb7,
1 => 0x01,
_ => 0
Expand Down

0 comments on commit ddfbaa0

Please sign in to comment.