The NetBSD Project

CVS log for src/sys/net/bpfjit.c

[BACK] Up to [cvs.NetBSD.org] / src / sys / net

Request diff between arbitrary revisions


Default branch: MAIN
Current tag: MAIN


Revision 1.48 / (download) - annotate - [select for diffs], Sat Feb 1 02:54:02 2020 UTC (4 years, 2 months ago) by riastradh
Branch: MAIN
CVS Tags: thorpej-ifq-base, thorpej-ifq, thorpej-i2c-spi-conf2-base, thorpej-i2c-spi-conf2, thorpej-i2c-spi-conf-base, thorpej-i2c-spi-conf, thorpej-futex2-base, thorpej-futex2, thorpej-futex-base, thorpej-futex, thorpej-cfargs2-base, thorpej-cfargs2, thorpej-cfargs-base, thorpej-cfargs, thorpej-altq-separation-base, thorpej-altq-separation, phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, netbsd-10-base, netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, netbsd-10, is-mlppp-base, is-mlppp, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x, bouyer-xenpvh-base2, bouyer-xenpvh-base1, bouyer-xenpvh-base, bouyer-xenpvh, bouyer-sunxi-drm-base, bouyer-sunxi-drm, ad-namecache-base3, HEAD
Changes since 1.47: +5 -6 lines
Diff to previous 1.47 (unified)

Fix wrong memory order and switch bpf to atomic_load/store_*.

Revision 1.47 / (download) - annotate - [select for diffs], Sun Jan 20 23:36:57 2019 UTC (5 years, 2 months ago) by alnsn
Branch: MAIN
CVS Tags: phil-wifi-20191119, phil-wifi-20190609, pgoyette-compat-20190127, netbsd-9-base, netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9, isaki-audio2-base, isaki-audio2, ad-namecache-base2, ad-namecache-base1, ad-namecache-base
Branch point for: ad-namecache
Changes since 1.46: +4 -3 lines
Diff to previous 1.46 (unified)

Add missing include.

Revision 1.46 / (download) - annotate - [select for diffs], Fri Jul 29 20:29:38 2016 UTC (7 years, 8 months ago) by alnsn
Branch: MAIN
CVS Tags: tls-maxphys-base-20171202, prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, phil-wifi-base, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-compat-base, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, perseant-stdc-iso10646-base, perseant-stdc-iso10646, nick-nhusb-base-20170825, nick-nhusb-base-20170204, nick-nhusb-base-20161204, nick-nhusb-base-20161004, netbsd-8-base, netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, netbsd-8, matt-nb8-mediatek-base, matt-nb8-mediatek, localcount-20160914, jdolecek-ncq-base, jdolecek-ncq, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan
Branch point for: phil-wifi, pgoyette-compat
Changes since 1.45: +53 -39 lines
Diff to previous 1.45 (unified)

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.

Revision 1.45 / (download) - annotate - [select for diffs], Sun May 29 17:20:22 2016 UTC (7 years, 10 months ago) by alnsn
Branch: MAIN
CVS Tags: pgoyette-localcount-base, pgoyette-localcount-20160726, nick-nhusb-base-20160907
Branch point for: pgoyette-localcount
Changes since 1.44: +113 -113 lines
Diff to previous 1.44 (unified)

Adapt to the new version of sljit@r313.

Revision 1.44 / (download) - annotate - [select for diffs], Tue Dec 29 21:49:58 2015 UTC (8 years, 3 months ago) by alnsn
Branch: MAIN
CVS Tags: nick-nhusb-base-20160529, nick-nhusb-base-20160422, nick-nhusb-base-20160319
Changes since 1.43: +9 -16 lines
Diff to previous 1.43 (unified)

Replace the nsaveds() function with #define NSAVEDS 3. No functional change.

Patch from Michael McConville.

Revision 1.43 / (download) - annotate - [select for diffs], Sat Feb 14 21:32:46 2015 UTC (9 years, 2 months ago) by alnsn
Branch: MAIN
CVS Tags: nick-nhusb-base-20151226, nick-nhusb-base-20150921, nick-nhusb-base-20150606, nick-nhusb-base-20150406
Changes since 1.42: +4 -4 lines
Diff to previous 1.42 (unified)

Copyright year.

Revision 1.42 / (download) - annotate - [select for diffs], Sat Feb 14 21:17:05 2015 UTC (9 years, 2 months ago) by alnsn
Branch: MAIN
Changes since 1.41: +6 -5 lines
Diff to previous 1.41 (unified)

In some implementations pc->k is signed. Cast it to uint32_t before comparing.

Revision 1.41 / (download) - annotate - [select for diffs], Sat Feb 14 21:14:56 2015 UTC (9 years, 2 months ago) by alnsn
Branch: MAIN
Changes since 1.40: +8 -4 lines
Diff to previous 1.40 (unified)

Properly track initialisation of registers for BPF_JMP instructions.

Revision 1.40 / (download) - annotate - [select for diffs], Fri Feb 13 15:59:17 2015 UTC (9 years, 2 months ago) by alnsn
Branch: MAIN
Changes since 1.39: +23 -16 lines
Diff to previous 1.39 (unified)

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/.

Revision 1.39 / (download) - annotate - [select for diffs], Thu Feb 12 23:09:55 2015 UTC (9 years, 2 months ago) by alnsn
Branch: MAIN
Changes since 1.38: +26 -21 lines
Diff to previous 1.38 (unified)

Fix bugs found by afl fuzzer http://lcamtuf.coredump.cx/afl/.

Revision 1.38 / (download) - annotate - [select for diffs], Thu Jan 15 16:31:05 2015 UTC (9 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.37: +5 -5 lines
Diff to previous 1.37 (unified)

rename variable to avoid conflict with "div"

Revision 1.37 / (download) - annotate - [select for diffs], Mon Dec 8 00:44:45 2014 UTC (9 years, 4 months ago) by justin
Branch: MAIN
Changes since 1.36: +4 -4 lines
Diff to previous 1.36 (unified)

Help gcc by initialising variable

Revision 1.36 / (download) - annotate - [select for diffs], Thu Nov 20 20:31:22 2014 UTC (9 years, 5 months ago) by alnsn
Branch: MAIN
CVS Tags: nick-nhusb-base
Branch point for: nick-nhusb
Changes since 1.35: +19 -13 lines
Diff to previous 1.35 (unified)

Implement BPF_MOD.

Revision 1.35 / (download) - annotate - [select for diffs], Thu Nov 20 19:18:52 2014 UTC (9 years, 5 months ago) by alnsn
Branch: MAIN
Changes since 1.34: +42 -26 lines
Diff to previous 1.34 (unified)

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.

Revision 1.34 / (download) - annotate - [select for diffs], Thu Nov 20 14:35:01 2014 UTC (9 years, 5 months ago) by alnsn
Branch: MAIN
Changes since 1.33: +9 -8 lines
Diff to previous 1.33 (unified)

Follow argument convension of other emit_xxx() functions.

Revision 1.33 / (download) - annotate - [select for diffs], Wed Nov 19 19:34:43 2014 UTC (9 years, 5 months ago) by christos
Branch: MAIN
Changes since 1.32: +33 -15 lines
Diff to previous 1.32 (unified)

Add BPF_MOD/BPF_XOR (untested, needs work)

Revision 1.32 / (download) - annotate - [select for diffs], Sat Jul 26 11:23:46 2014 UTC (9 years, 8 months ago) by alnsn
Branch: MAIN
CVS Tags: tls-maxphys-base, tls-earlyentropy-base, netbsd-7-base
Branch point for: netbsd-7
Changes since 1.31: +88 -43 lines
Diff to previous 1.31 (unified)

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.

Revision 1.31 / (download) - annotate - [select for diffs], Thu Jul 24 22:54:38 2014 UTC (9 years, 8 months ago) by alnsn
Branch: MAIN
Changes since 1.30: +31 -21 lines
Diff to previous 1.30 (unified)

For P[X+0] load, don't emit wrap around check and copy X intead of emitting X+0.

Revision 1.30 / (download) - annotate - [select for diffs], Tue Jul 22 08:29:51 2014 UTC (9 years, 9 months ago) by alnsn
Branch: MAIN
Changes since 1.29: +16 -43 lines
Diff to previous 1.29 (unified)

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().

Revision 1.29 / (download) - annotate - [select for diffs], Tue Jul 22 08:20:08 2014 UTC (9 years, 9 months ago) by alnsn
Branch: MAIN
Changes since 1.28: +39 -41 lines
Diff to previous 1.28 (unified)

Don't use scratch registers for X and to restore A after BPF_COPX call.

Revision 1.28 / (download) - annotate - [select for diffs], Sun Jul 13 21:54:46 2014 UTC (9 years, 9 months ago) by alnsn
Branch: MAIN
Changes since 1.27: +74 -74 lines
Diff to previous 1.27 (unified)

Refactor BPF_COPX code. New version doesn't load buf and buflen after copx call.

Revision 1.27 / (download) - annotate - [select for diffs], Sun Jul 13 18:48:27 2014 UTC (9 years, 9 months ago) by alnsn
Branch: MAIN
Changes since 1.26: +63 -71 lines
Diff to previous 1.26 (unified)

Don't use BJ_TMP2REG for 32bit packet reads. Assign this register to (buf+X)
in BPF_LD+BPF_IND and save one instruction.

Revision 1.26 / (download) - annotate - [select for diffs], Sat Jul 12 20:14:18 2014 UTC (9 years, 9 months ago) by alnsn
Branch: MAIN
Changes since 1.25: +24 -25 lines
Diff to previous 1.25 (unified)

emit_xcall: check overflow by comparing X with (UINT32_MAX - pk->k), restore
the A register after checking that xcall succeeded.

Revision 1.25 / (download) - annotate - [select for diffs], Sat Jul 12 16:52:57 2014 UTC (9 years, 9 months ago) by alnsn
Branch: MAIN
Changes since 1.24: +4 -4 lines
Diff to previous 1.24 (unified)

Initialise status to avoid -Wuninitialized warning.

Revision 1.24 / (download) - annotate - [select for diffs], Sat Jul 12 16:13:57 2014 UTC (9 years, 9 months ago) by alnsn
Branch: MAIN
Changes since 1.23: +51 -45 lines
Diff to previous 1.23 (unified)

Some small changes: add missing error checks; move sjump initialisation away
from optimize(); +BJ_HINT_PKT, -BJ_HINT_IND; tweak comments.

Revision 1.23 / (download) - annotate - [select for diffs], Fri Jul 11 20:43:33 2014 UTC (9 years, 9 months ago) by alnsn
Branch: MAIN
Changes since 1.22: +56 -35 lines
Diff to previous 1.22 (unified)

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.

Revision 1.22 / (download) - annotate - [select for diffs], Tue Jul 8 11:30:31 2014 UTC (9 years, 9 months ago) by alnsn
Branch: MAIN
Changes since 1.21: +11 -3 lines
Diff to previous 1.21 (unified)

Most filter programs in the kernel need 3 scratch registers.

Revision 1.21 / (download) - annotate - [select for diffs], Sat Jul 5 11:13:13 2014 UTC (9 years, 9 months ago) by alnsn
Branch: MAIN
Changes since 1.20: +16 -16 lines
Diff to previous 1.20 (unified)

Review some SLJIT_MOV instructions with respect to width.

Revision 1.20 / (download) - annotate - [select for diffs], Fri Jul 4 21:32:08 2014 UTC (9 years, 9 months ago) by alnsn
Branch: MAIN
Changes since 1.19: +61 -60 lines
Diff to previous 1.19 (unified)

Add optimization hints. They replace nscratches and ncopfuncs and improve
readability.

Revision 1.19 / (download) - annotate - [select for diffs], Tue Jul 1 16:18:55 2014 UTC (9 years, 9 months ago) by alnsn
Branch: MAIN
Changes since 1.18: +197 -169 lines
Diff to previous 1.18 (unified)

Move the main loop in bpfjit_generate_code() to a new function and make few
small changes.

Revision 1.18 / (download) - annotate - [select for diffs], Wed Jun 25 13:53:40 2014 UTC (9 years, 9 months ago) by alnsn
Branch: MAIN
Changes since 1.17: +19 -11 lines
Diff to previous 1.17 (unified)

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.

Revision 1.17 / (download) - annotate - [select for diffs], Wed Jun 25 11:58:15 2014 UTC (9 years, 9 months ago) by alnsn
Branch: MAIN
Changes since 1.16: +4 -4 lines
Diff to previous 1.16 (unified)

New jitcode takes two arguments.

Revision 1.16 / (download) - annotate - [select for diffs], Wed Jun 25 11:13:28 2014 UTC (9 years, 9 months ago) by alnsn
Branch: MAIN
Changes since 1.15: +5 -5 lines
Diff to previous 1.15 (unified)

Use SLJIT_MOV_P to copy extmem pointer.

Revision 1.15 / (download) - annotate - [select for diffs], Wed Jun 25 01:21:36 2014 UTC (9 years, 9 months ago) by rmind
Branch: MAIN
Changes since 1.14: +4 -4 lines
Diff to previous 1.14 (unified)

bpfjit_generate_code: emit the instruction correctly.

Revision 1.14 / (download) - annotate - [select for diffs], Tue Jun 24 22:19:36 2014 UTC (9 years, 9 months ago) by rmind
Branch: MAIN
Changes since 1.13: +8 -8 lines
Diff to previous 1.13 (unified)

- Improve the comments in bpf.h and KNF a little.
- Rename bpf_ctx_t member noinit to preinited (reflects the meaning better).

Revision 1.13 / (download) - annotate - [select for diffs], Tue Jun 24 10:53:30 2014 UTC (9 years, 9 months ago) by alnsn
Branch: MAIN
Changes since 1.12: +371 -64 lines
Diff to previous 1.12 (unified)

Implement copfuncs and external memory in bpfjit.

Revision 1.12 / (download) - annotate - [select for diffs], Tue Jun 17 16:52:33 2014 UTC (9 years, 10 months ago) by alnsn
Branch: MAIN
Changes since 1.11: +26 -26 lines
Diff to previous 1.11 (unified)

Update code to the latest sljit version.

Revision 1.11 / (download) - annotate - [select for diffs], Fri May 23 22:04:09 2014 UTC (9 years, 10 months ago) by alnsn
Branch: MAIN
Changes since 1.10: +24 -4 lines
Diff to previous 1.10 (unified)

Enable ABC optimization when one branch returns 0.

Revision 1.10 / (download) - annotate - [select for diffs], Fri May 23 19:51:16 2014 UTC (9 years, 10 months ago) by alnsn
Branch: MAIN
Changes since 1.9: +7 -3 lines
Diff to previous 1.9 (unified)

Loads at offsets UINT32_MAX or greater are unreachable.

Revision 1.9 / (download) - annotate - [select for diffs], Fri May 23 19:11:22 2014 UTC (9 years, 10 months ago) by alnsn
Branch: MAIN
Changes since 1.8: +48 -25 lines
Diff to previous 1.8 (unified)

Implement unconditional jump to "return 0" for loads at UINT32_MAX+1 or greater.

Revision 1.8 / (download) - annotate - [select for diffs], Thu May 22 13:35:45 2014 UTC (9 years, 11 months ago) by alnsn
Branch: MAIN
Changes since 1.7: +26 -19 lines
Diff to previous 1.7 (unified)

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.

Revision 1.7 / (download) - annotate - [select for diffs], Thu May 15 22:20:08 2014 UTC (9 years, 11 months ago) by alnsn
Branch: MAIN
CVS Tags: rmind-smpnet-nbase, rmind-smpnet-base
Changes since 1.6: +581 -525 lines
Diff to previous 1.6 (unified)

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.

Revision 1.6 / (download) - annotate - [select for diffs], Sun Dec 15 21:18:01 2013 UTC (10 years, 4 months ago) by pooka
Branch: MAIN
CVS Tags: yamt-pagecache-base9, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3
Branch point for: tls-earlyentropy
Changes since 1.5: +4 -4 lines
Diff to previous 1.5 (unified)

XXXgcc Wuninitialized kludge

Revision 1.5 / (download) - annotate - [select for diffs], Fri Nov 15 13:56:21 2013 UTC (10 years, 5 months ago) by rmind
Branch: MAIN
Changes since 1.4: +5 -3 lines
Diff to previous 1.4 (unified)

Fix the bpfjit build.

Revision 1.4 / (download) - annotate - [select for diffs], Fri Nov 15 00:12:44 2013 UTC (10 years, 5 months ago) by rmind
Branch: MAIN
Changes since 1.3: +7 -8 lines
Diff to previous 1.3 (unified)

- 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.

Revision 1.3 / (download) - annotate - [select for diffs], Fri Sep 20 23:19:52 2013 UTC (10 years, 7 months ago) by rmind
Branch: MAIN
Changes since 1.2: +25 -40 lines
Diff to previous 1.2 (unified)

bpfjit: replace malloc with kmem, KNF a little, add RCS ID.

Revision 1.2 / (download) - annotate - [select for diffs], Sat Nov 10 22:12:31 2012 UTC (11 years, 5 months ago) by alnsn
Branch: MAIN
CVS Tags: yamt-pagecache-base8, yamt-pagecache-base7, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, khorben-n900, agc-symver-base, agc-symver
Branch point for: tls-maxphys, rmind-smpnet
Changes since 1.1: +14 -7 lines
Diff to previous 1.1 (unified)

Add RCSID and fix -Wsign-compare warnings.

Revision 1.1 / (download) - annotate - [select for diffs], Sat Oct 27 22:36:14 2012 UTC (11 years, 5 months ago) by alnsn
Branch: MAIN
CVS Tags: yamt-pagecache-base6
Branch point for: yamt-pagecache

Add bpfjit and enable it for amd64.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>