Home | History | Annotate | Download | only in net
History log of /src/sys/net/bpfjit.c
RevisionDateAuthorComments
 1.48  01-Feb-2020  riastradh Fix wrong memory order and switch bpf to atomic_load/store_*.
 1.47  20-Jan-2019  alnsn branches: 1.47.6;
Add missing include.
 1.46  29-Jul-2016  alnsn branches: 1.46.14; 1.46.16;
Don't trigger BJ_ASSERT(false) on invalid BPF_Jxxx opcode in jmp_to_op().

This change helps survive AFL fuzzing without calling bpf_validate() first.

Also change alu_to_op() function to have a similar interface.
 1.45  29-May-2016  alnsn branches: 1.45.2;
Adapt to the new version of sljit@r313.
 1.44  29-Dec-2015  alnsn Replace the nsaveds() function with #define NSAVEDS 3. No functional change.

Patch from Michael McConville.
 1.43  14-Feb-2015  alnsn Copyright year.
 1.42  14-Feb-2015  alnsn In some implementations pc->k is signed. Cast it to uint32_t before comparing.
 1.41  14-Feb-2015  alnsn Properly track initialisation of registers for BPF_JMP instructions.
 1.40  13-Feb-2015  alnsn Don't emit wrapped-around reads. They're dead code but dead code elimination
logic isn't smart enough to figure it out.

Found by afl fuzzer http://lcamtuf.coredump.cx/afl/.
 1.39  12-Feb-2015  alnsn Fix bugs found by afl fuzzer http://lcamtuf.coredump.cx/afl/.
 1.38  15-Jan-2015  christos rename variable to avoid conflict with "div"
 1.37  08-Dec-2014  justin Help gcc by initialising variable
 1.36  20-Nov-2014  alnsn branches: 1.36.2;
Implement BPF_MOD.
 1.35  20-Nov-2014  alnsn Implement BPF_ALU+BPF_MOD-BPF_K when pc->k is a power of 2. Get rid of divt
and divw arguments in emit_moddiv(), they're accessible via the pc argument.
 1.34  20-Nov-2014  alnsn Follow argument convension of other emit_xxx() functions.
 1.33  19-Nov-2014  christos Add BPF_MOD/BPF_XOR (untested, needs work)
 1.32  26-Jul-2014  alnsn branches: 1.32.2;
Don't use saved EREG registers because sljit 0.91 can generate
bogus code on amd64. The A and X registers are saved on the stack.

The most recent version of sljit fixes bogus code generation but
it's not backward compatible with sljit 0.91.
 1.31  24-Jul-2014  alnsn For P[X+0] load, don't emit wrap around check and copy X intead of emitting X+0.
 1.30  22-Jul-2014  alnsn Two tweaks: don't use a temporary register to dereference the err agrument
after xcall and don't generate ((tmp1 & 0xf) << 2) twice in emit_msh().
 1.29  22-Jul-2014  alnsn Don't use scratch registers for X and to restore A after BPF_COPX call.
 1.28  13-Jul-2014  alnsn Refactor BPF_COPX code. New version doesn't load buf and buflen after copx call.
 1.27  13-Jul-2014  alnsn Don't use BJ_TMP2REG for 32bit packet reads. Assign this register to (buf+X)
in BPF_LD+BPF_IND and save one instruction.
 1.26  12-Jul-2014  alnsn emit_xcall: check overflow by comparing X with (UINT32_MAX - pk->k), restore
the A register after checking that xcall succeeded.
 1.25  12-Jul-2014  alnsn Initialise status to avoid -Wuninitialized warning.
 1.24  12-Jul-2014  alnsn Some small changes: add missing error checks; move sjump initialisation away
from optimize(); +BJ_HINT_PKT, -BJ_HINT_IND; tweak comments.
 1.23  11-Jul-2014  alnsn Handle overflow in BPF_LD+BPF_IND for mbuf chains and make two minor changes:
move sljit_emit_return() to generate_insn_code() and use a different register
for checking errors after xcall.
 1.22  08-Jul-2014  alnsn Most filter programs in the kernel need 3 scratch registers.
 1.21  05-Jul-2014  alnsn Review some SLJIT_MOV instructions with respect to width.
 1.20  04-Jul-2014  alnsn Add optimization hints. They replace nscratches and ncopfuncs and improve
readability.
 1.19  01-Jul-2014  alnsn Move the main loop in bpfjit_generate_code() to a new function and make few
small changes.
 1.18  25-Jun-2014  alnsn Default initialize external memwords.

This change doesn't affect performance of valid bpf kernel programs
because bpf_filter_ext() checks that all memwords are initialized
explicitly.
 1.17  25-Jun-2014  alnsn New jitcode takes two arguments.
 1.16  25-Jun-2014  alnsn Use SLJIT_MOV_P to copy extmem pointer.
 1.15  25-Jun-2014  rmind bpfjit_generate_code: emit the instruction correctly.
 1.14  24-Jun-2014  rmind - Improve the comments in bpf.h and KNF a little.
- Rename bpf_ctx_t member noinit to preinited (reflects the meaning better).
 1.13  24-Jun-2014  alnsn Implement copfuncs and external memory in bpfjit.
 1.12  17-Jun-2014  alnsn Update code to the latest sljit version.
 1.11  23-May-2014  alnsn Enable ABC optimization when one branch returns 0.
 1.10  23-May-2014  alnsn Loads at offsets UINT32_MAX or greater are unreachable.
 1.9  23-May-2014  alnsn Implement unconditional jump to "return 0" for loads at UINT32_MAX+1 or greater.
 1.8  22-May-2014  alnsn Some small changes in preparation for a bigger change.

- typedef for ABC variables and MAX_ABC_LENGTH constant,
- cast pc->k to uint32_t in more places,
- whitespaces.
 1.7  15-May-2014  alnsn Refactor bpfjit code.

- Implement Array Bounds Check Elimination for packet bytes.
- Track initialization of registers and memwords.
- Remove "bj_" prefix from struct members.
- Shorten "BPFJIT_" prefix to "BJ_".
- Other small improvements.
 1.6  15-Dec-2013  pooka branches: 1.6.2;
XXXgcc Wuninitialized kludge
 1.5  15-Nov-2013  rmind Fix the bpfjit build.
 1.4  15-Nov-2013  rmind - Add bpf_args_t and convert bpf_filter_ext() to use it. This allows the
caller to initialise (and re-use) the memory store.
- Add bpf_jit_generate() and bpf_jit_freecode() wrappers.
 1.3  20-Sep-2013  rmind bpfjit: replace malloc with kmem, KNF a little, add RCS ID.
 1.2  10-Nov-2012  alnsn branches: 1.2.2; 1.2.4;
Add RCSID and fix -Wsign-compare warnings.
 1.1  27-Oct-2012  alnsn branches: 1.1.2;
Add bpfjit and enable it for amd64.
 1.1.2.4  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.2.3  16-Jan-2013  yamt sync with (a bit old) head
 1.1.2.2  30-Oct-2012  yamt sync with head
 1.1.2.1  27-Oct-2012  yamt file bpfjit.c was added on branch yamt-pagecache on 2012-10-30 17:22:42 +0000
 1.2.4.1  18-May-2014  rmind sync with head
 1.2.2.4  03-Dec-2017  jdolecek update from HEAD
 1.2.2.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.2.2  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.2.2.1  10-Nov-2012  tls file bpfjit.c was added on branch tls-maxphys on 2012-11-20 03:02:46 +0000
 1.6.2.1  10-Aug-2014  tls Rebase.
 1.32.2.1  16-Feb-2015  martin Pull up following revision(s) (requested by alnsn in ticket #519):
sys/net/bpfjit.c: revision 1.39-1.41
Fix bugs found by afl fuzzer http://lcamtuf.coredump.cx/afl/.
-
Don't emit wrapped-around reads. They're dead code but dead code elimination
logic isn't smart enough to figure it out.
-
Properly track initialisation of registers for BPF_JMP instructions.
 1.36.2.4  05-Oct-2016  skrll Sync with HEAD
 1.36.2.3  09-Jul-2016  skrll Sync with HEAD
 1.36.2.2  19-Mar-2016  skrll Sync with HEAD
 1.36.2.1  06-Apr-2015  skrll Sync with HEAD
 1.45.2.1  06-Aug-2016  pgoyette Sync with HEAD
 1.46.16.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.46.16.1  10-Jun-2019  christos Sync with HEAD
 1.46.14.1  26-Jan-2019  pgoyette Sync with HEAD
 1.47.6.1  29-Feb-2020  ad Sync with head.

RSS XML Feed