HomeFreeBSD

ipfw: fix possible data race between jump cache reading and updating.

Description

ipfw: fix possible data race between jump cache reading and updating.

Jump cache is used to reduce the cost of rule lookup for O_SKIPTO and
O_CALLRETURN actions. It uses rules chain id to check correctness of
cached value. But due to the possible race, there is the chance that
one thread can read invalid value. In some cases this can lead to out
of bounds access and panic.

Use thread fence operations to constrain the reordering of accesses.
Also rename jump_fast and jump_linear functions to jump_cached and
jump_lookup_pos respectively.

Submitted by: Arseny Smalyuk
Obtained from: Yandex LLC
Sponsored by: Yandex LLC
Differential Revision: https://reviews.freebsd.org/D31484

(cherry picked from commit 322e5efda8578bb9c0a0ab0ef785cd1e1c222c85)

Details

Provenance
aeAuthored on Aug 17 2021, 8:08 AM
Differential Revision
D31484: Fix data race in jump cache read/update
Parents
rGc2a591055248: netinet tests: delete an interface with pending lookups
Branches
Unknown
Tags
Unknown