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
Reviewed by: melifaro
Obtained from: Yandex LLC
MFC after: 1 week
Sponsored by: Yandex LLC
Differential Revision: https://reviews.freebsd.org/D31484

Details

Provenance
aeAuthored on Aug 17 2021, 8:08 AM
Reviewer
melifaro
Differential Revision
D31484: Fix data race in jump cache read/update
Parents
rG6ad816a99917: sdhci_xenon: remove redundant code in property parsing
Branches
Unknown
Tags
Unknown