CVS commit: src

"Alexander Nasonov" <[email protected]>
Newsgroups gmane.os.netbsd.devel.cvs
Message-ID <[email protected]>
Module Name:	src
Committed By:	alnsn
Date:		Sun Jul  5 17:29:14 UTC 2026

Modified Files:
	src/sys/net: bpfjit.c
	src/tests/lib/libbpfjit: t_bpfjit.c
	src/tests/net/bpfjit: t_bpfjit.c

Log Message:
Increase size of bpfjit interal stack, follow bpf_validate() closely.

Increase a size of M[] array allocated on the stack by bpfjit.

When bpf_validate() fails, bpfjit now fails too:
 - Fail to validate/compile BVF_DIV+BPF_K and BPF_MOD+BPF_K with K=0.
 - Fail unless the last instruction is BPF_RET+BPF_A or BPF_RET+BPF_K.

If a program contains additional BPF_RET instructions, it is accepted
by bpf_validate() and it compiles fine by bpfjit but both bpf_filter()
and bpfjit reject it (return 0) at runtime.

Adjust existing bpfjit test to follow the changes, add new tests.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/net/bpfjit.c
cvs rdiff -u -r1.15 -r1.16 src/tests/lib/libbpfjit/t_bpfjit.c
cvs rdiff -u -r1.12 -r1.13 src/tests/net/bpfjit/t_bpfjit.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.