Revision tags: release/13.5.0 |
|
#
c7f8ffc7 |
| 06-Mar-2025 |
Zhenlei Huang <zlei@FreeBSD.org> |
bpf: Use static initializers
MFC after: 1 week
|
Revision tags: release/14.2.0-p2, release/14.1.0-p8, release/13.4.0-p4 |
|
#
1ed9b381 |
| 04-Feb-2025 |
Zhenlei Huang <zlei@FreeBSD.org> |
ifnet: Detach BPF descriptors on interface vmove event
When an interface is moving to/from a vnet jail, it may still have BPF descriptors attached. The userland (e.g. tcpdump) does not get noticed t
ifnet: Detach BPF descriptors on interface vmove event
When an interface is moving to/from a vnet jail, it may still have BPF descriptors attached. The userland (e.g. tcpdump) does not get noticed that the interface is departing and still opens BPF descriptors thus may result in leaking sensitive traffic (e.g. an interface is moved back to parent jail but a user is still sniffing traffic over it in the child jail).
Detach BPF descriptors so that the userland will be signaled.
Reviewed by: ae MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D45727
show more ...
|
#
7def047a |
| 03-Feb-2025 |
Zhenlei Huang <zlei@FreeBSD.org> |
bpf: Fix potential race conditions
There're two possible race conditions,
1. Concurrent bpfattach() and bpf_setif(), i.e., BIOCSETIF ioctl, 2. Concurrent bpfdetach() and bpf_setif().
For the first
bpf: Fix potential race conditions
There're two possible race conditions,
1. Concurrent bpfattach() and bpf_setif(), i.e., BIOCSETIF ioctl, 2. Concurrent bpfdetach() and bpf_setif().
For the first case, userland may see BPF interface attached but it has not been in the attached interfaces list `bpf_iflist` yet. Well it will eventually be so this case does not matter.
For the second one, bpf_setif() may reference `dead_bpf_if` and the kernel will panic (spotted by change [1], without the change we will end up silently corrupted memory).
A simple fix could be that, we add additional check for `dead_bpf_if` in the function `bpf_setif()`. But that requires to extend protection of global lock (BPF_LOCK), i.e., BPF_LOCK should also protect the assignment of `ifp->if_bpf`. That simple fix works but is apparently not a good design. Since the attached interfaces list `bpf_iflist` is the single source of truth, we look through it rather than check against the interface's side, aka `ifp->if_bpf`.
This change has performance regression, that the cost of BPF interface attach operation (BIOCSETIF ioctl) goes back from O(1) to O(N) (where N is the number of BPF interfaces). Well we normally have sane amounts of interfaces, an O(N) should be affordable.
[1] 7a974a649848 bpf: Make dead_bpf_if const
Fixes: 16d878cc99ef Fix the following bpf(4) race condition ... MFC after: 4 days Differential Revision: https://reviews.freebsd.org/D45725
show more ...
|
Revision tags: release/14.1.0-p7, release/14.2.0-p1, release/13.4.0-p3, release/14.2.0 |
|
#
ef9ffb85 |
| 25-Nov-2024 |
Mark Johnston <markj@FreeBSD.org> |
kern: Make fileops and filterops tables const where possible
No functional change intended.
MFC after: 1 week
|
#
1baf6164 |
| 20-Sep-2024 |
Zhenlei Huang <zlei@FreeBSD.org> |
bpf: Some style and white space cleanup
MFC after: 3 days
|
Revision tags: release/13.4.0 |
|
#
343bf78e |
| 10-Sep-2024 |
Zhenlei Huang <zlei@FreeBSD.org> |
bpf: Update a comment
This comment was introduced by fix [1], later the fix was refined by change [2], and the context of the usage of `m_get2()` and `m_getjcl()` got lost, then the comment became o
bpf: Update a comment
This comment was introduced by fix [1], later the fix was refined by change [2], and the context of the usage of `m_get2()` and `m_getjcl()` got lost, then the comment became obscure.
Update to reflect the current behavior.
1. f13da24715a7 net/bpf: Fix writing of buffer bigger than PAGESIZE 2. a051ca72e281 Introduce m_get3()
Fixes: a051ca72e281 Introduce m_get3() MFC after: 3 days
show more ...
|
#
89204d9d |
| 07-Jun-2024 |
Zhenlei Huang <zlei@FreeBSD.org> |
bpf: Prefer the boolean form when calling bpf_peers_present()
No functional change intended.
Reviewed by: markj, kp, #network MFC with: 8f31b879ecaf Differential Revision: https://reviews.freebsd.o
bpf: Prefer the boolean form when calling bpf_peers_present()
No functional change intended.
Reviewed by: markj, kp, #network MFC with: 8f31b879ecaf Differential Revision: https://reviews.freebsd.org/D45509
show more ...
|
Revision tags: release/14.1.0, release/13.3.0 |
|
#
29363fb4 |
| 23-Nov-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl s
sys: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script.
Sponsored by: Netflix
show more ...
|
Revision tags: release/14.0.0 |
|
#
7a974a64 |
| 21-Oct-2023 |
Zhenlei Huang <zlei@FreeBSD.org> |
bpf: Make dead_bpf_if const
The dead_bpf_if is not subjected to be written. Make it const so that on destructive writing to it the kernel will panic instead of silent memory corruption.
No function
bpf: Make dead_bpf_if const
The dead_bpf_if is not subjected to be written. Make it const so that on destructive writing to it the kernel will panic instead of silent memory corruption.
No functional change intended.
Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D42189
show more ...
|
#
8f31b879 |
| 04-Oct-2023 |
Justin Hibbits <jhibbits@FreeBSD.org> |
bpf: Add IfAPI analogue for bpf_peers_present()
An interface's bpf could feasibly not exist, in which case bpf_peers_present() would panic from a NULL pointer dereference. Solve this by adding a ne
bpf: Add IfAPI analogue for bpf_peers_present()
An interface's bpf could feasibly not exist, in which case bpf_peers_present() would panic from a NULL pointer dereference. Solve this by adding a new IfAPI that could deal with a NULL bpf, if such could occur in the network stack.
Reviewed by: zlei Sponsored by: Juniper Networks, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D42082
show more ...
|
#
5e444dee |
| 13-Oct-2023 |
Justin Hibbits <jhibbits@FreeBSD.org> |
Revert "bpf: Add IfAPI analogue for bpf_peers_present()"
This reverts commit c81dd8e5fe72d0c7ec055c8621bb2da3a3627abf.
Commit message needs revised.
|
#
c81dd8e5 |
| 04-Oct-2023 |
Justin Hibbits <jhibbits@FreeBSD.org> |
bpf: Add IfAPI analogue for bpf_peers_present()
An interface's bpf could feasibly not exist, in which case bpf_peers_present() would panic from a NULL pointer dereference. Solve this by adding a ne
bpf: Add IfAPI analogue for bpf_peers_present()
An interface's bpf could feasibly not exist, in which case bpf_peers_present() would panic from a NULL pointer dereference. Solve this by adding a new IfAPI that includes a NULL check. Since this API is used in only a handful of locations, it reduces the the NULL check scope over inserting the check into bpf_peers_present().
Sponsored by: Juniper Networks, Inc. MFC after: 1 week
show more ...
|
#
685dc743 |
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
Revision tags: release/13.2.0 |
|
#
33755776 |
| 01-Mar-2023 |
Mateusz Guzik <mjg@FreeBSD.org> |
net: whack __mips__ leftovers
Sponsored by: Rubicon Communications, LLC ("Netgate")
|
#
9df6eeab |
| 08-Feb-2023 |
Zhenlei Huang <zlei@FreeBSD.org> |
bpf: Add missing NOP stubs
This fixes kernel build with nodevice bpf [1].
[1] https://lists.freebsd.org/archives/freebsd-current/2023-February/003178.html
Reported by: Gary Jennejohn <garyj@gmx.de
bpf: Add missing NOP stubs
This fixes kernel build with nodevice bpf [1].
[1] https://lists.freebsd.org/archives/freebsd-current/2023-February/003178.html
Reported by: Gary Jennejohn <garyj@gmx.de> Reviewed by: jhibbits Fixes: 950cc1f44fbd bpf: Add "_if" tap APIs Differential Revision: https://reviews.freebsd.org/D38432
show more ...
|
#
950cc1f4 |
| 12-Jan-2023 |
Justin Hibbits <jhibbits@FreeBSD.org> |
bpf: Add "_if" tap APIs
Summary: Hide more netstack by making the BPF_TAP macros real functions in the netstack. "struct ifnet" is used in the header instead of "if_t" to keep header pollution down
bpf: Add "_if" tap APIs
Summary: Hide more netstack by making the BPF_TAP macros real functions in the netstack. "struct ifnet" is used in the header instead of "if_t" to keep header pollution down.
Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D38103
show more ...
|
#
2c2b37ad |
| 13-Jan-2023 |
Justin Hibbits <jhibbits@FreeBSD.org> |
ifnet/API: Move struct ifnet definition to a <net/if_private.h>
Hide the ifnet structure definition, no user serviceable parts inside, it's a netstack implementation detail. Include it temporarily
ifnet/API: Move struct ifnet definition to a <net/if_private.h>
Hide the ifnet structure definition, no user serviceable parts inside, it's a netstack implementation detail. Include it temporarily in <net/if_var.h> until all drivers are updated to use the accessors exclusively.
Reviewed by: glebius Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D38046
show more ...
|
Revision tags: release/12.4.0 |
|
#
8288117a |
| 24-Nov-2022 |
Mateusz Guzik <mjg@FreeBSD.org> |
bpf: only access refcounts using dedicated primitives
Sponsored by: Rubicon Communications, LLC ("Netgate")
|
#
56cdab33 |
| 04-Oct-2022 |
Jung-uk Kim <jkim@FreeBSD.org> |
bpf: obtain timestamps from controller via pkthdr if available
r325506 (3cf8254f1ea9) extended struct pkthdr to add packet timestamp in mbuf(9) chain. For example, cxgbe(4) and mlx5en(4) support th
bpf: obtain timestamps from controller via pkthdr if available
r325506 (3cf8254f1ea9) extended struct pkthdr to add packet timestamp in mbuf(9) chain. For example, cxgbe(4) and mlx5en(4) support this feature. Use the timestamp for bpf(4) if it is available.
Reviewed by: hselasky, kib, np MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D36868
show more ...
|
#
220818ac |
| 05-Aug-2022 |
Mark Johnston <markj@FreeBSD.org> |
bpf: Fix BIOCPROMISC locking
BPF might put an interface in promiscuous mode when handling the BIOCSDLT ioctl. When this happens, a flag is set in the BPF descriptor so that the old interface can be
bpf: Fix BIOCPROMISC locking
BPF might put an interface in promiscuous mode when handling the BIOCSDLT ioctl. When this happens, a flag is set in the BPF descriptor so that the old interface can be restored when the BPF descriptor is destroyed.
The BIOCPROMISC ioctl can also be used to put a BPF descriptor's interface into promiscuous mode, but there was nothing synchronizing the flag. Fix this by modifying the ioctl handler to acquire the global BPF mutex, which is used to synchronize ifpromisc() calls elsewhere in BPF.
Reviewed by: kp, melifaro MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D36045
show more ...
|
#
60b4ad4b |
| 20-Jun-2022 |
Mark Johnston <markj@FreeBSD.org> |
bpf: Zero pad bytes preceding BPF headers
BPF headers are word-aligned when copied into the store buffer. Ensure that pad bytes following the preceding packet are cleared.
Reported by: KMSAN MFC a
bpf: Zero pad bytes preceding BPF headers
BPF headers are word-aligned when copied into the store buffer. Ensure that pad bytes following the preceding packet are cleared.
Reported by: KMSAN MFC after: 1 week Sponsored by: The FreeBSD Foundation
show more ...
|
Revision tags: release/13.1.0, release/12.3.0 |
|
#
426682b0 |
| 26-Oct-2021 |
Mark Johnston <markj@FreeBSD.org> |
bpf: Fix the write filter for detached descriptors
A BPF descriptor only has an associated interface descriptor once it is attached to an interface, e.g., with BIOCSETIF. Avoid dereferencing a NULL
bpf: Fix the write filter for detached descriptors
A BPF descriptor only has an associated interface descriptor once it is attached to an interface, e.g., with BIOCSETIF. Avoid dereferencing a NULL pointer in filt_bpfwrite() if the BPF descriptor is not attached.
Reviewed by: ae Reported by: syzbot+ae45d5166afe15a5a21d@syzkaller.appspotmail.com Fixes: ded77e0237a8 ("Allow the BPF to be select for write.") Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32561
show more ...
|
#
ded77e02 |
| 10-Oct-2021 |
Hartmut Brandt <harti@FreeBSD.org> |
Allow the BPF to be select for write. This is needed for boost:asio which otherwise fails to handle BPFs. Reviewed by: ae Differential Revision: https://reviews.freebsd.org/D31967
|
#
a051ca72 |
| 07-Aug-2021 |
Kristof Provost <kp@FreeBSD.org> |
Introduce m_get3()
Introduce m_get3() which is similar to m_get2(), but can allocate up to MJUM16BYTES bytes (m_get2() can only allocate up to MJUMPAGESIZE).
This simplifies the bpf improvement in
Introduce m_get3()
Introduce m_get3() which is similar to m_get2(), but can allocate up to MJUM16BYTES bytes (m_get2() can only allocate up to MJUMPAGESIZE).
This simplifies the bpf improvement in f13da24715.
Suggested by: glebius Differential Revision: https://reviews.freebsd.org/D31455
show more ...
|
#
9ef8cd0b |
| 22-Jul-2021 |
Kristof Provost <kp@FreeBSD.org> |
vlan: deduplicate bpf_setpcp() and pf_ieee8021q_setpcp()
These two fuctions were identical, so move them into the common vlan_set_pcp() function, exposed in the if_vlan_var.h header.
Reviewed by: d
vlan: deduplicate bpf_setpcp() and pf_ieee8021q_setpcp()
These two fuctions were identical, so move them into the common vlan_set_pcp() function, exposed in the if_vlan_var.h header.
Reviewed by: donner MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31275
show more ...
|