https://github.com/cilium/cilium
Revision 88b36ac410285783adb6110d07266fa177e0d946 authored by Joe Stringer on 07 August 2023, 20:25:21 UTC, committed by Joe Stringer on 08 August 2023, 00:41:37 UTC
Commit c96b9d81a8a6 ("ipcache: Remove superfluous if condition")
triggers a double-free for cases a where there is a mix of users for
older and newer internal ipcache APIs. In this scenario, the older
ipcache APIs are used to inject entries into the ipcache, then
InjectLabels() attempts to allocate a new security identity reference
for the same CIDR and assumes that it already holds a reference to the
corresponding identity and releases its own reference. If the other
module ever releases its reference, then that results in freeing of the
identity regardless of its continued expected usage by users of the
newer ipcache APIs. This leads to policy recalculation that removes any
datapath allow rules for the corresponding CIDRs, ultimately resulting
in packet loss for the impacted CIDRs.

One such example involves CIDR identity restore startup logic in the
daemon. That path allocates identities then injects them into the
ipcache using older APIs. If any such CIDRs are used by network
policies, then the network policies subsystem will insert the CIDR into
the ipcache using newer ipcache APIs, which will then trigger this
double-free.

Fixes: c96b9d81a8a6 ("ipcache: Remove superfluous if condition")
Reported-by: Boris Petrovic <carnerito.b@gmail.com>
Reported-by: Kim-Eirik Karlsen <kim.eirik@gmail.com>
Reported-by: Jason Witkowski <jason@witkow.ski>
Signed-off-by: Joe Stringer <joe@cilium.io>
1 parent 2bb3bbe
History
Tip revision: 88b36ac410285783adb6110d07266fa177e0d946 authored by Joe Stringer on 07 August 2023, 20:25:21 UTC
ipcache: Fix refcounting with mix of APIs
Tip revision: 88b36ac
File Mode Size
.devcontainer
.github
.nvim
.travis
.vscode
Documentation
api
bpf
bugtool
cilium
cilium-health
clustermesh-apiserver
contrib
daemon
envoy
examples
hack
hubble-relay
images
install
jenkinsfiles
kvstoremesh
operator
pkg
plugins
test
tools
vendor
.authors.aux -rw-r--r-- 416 bytes
.clang-format -rw-r--r-- 3.9 KB
.clomonitor.yml -rw-r--r-- 984 bytes
.gitattributes -rw-r--r-- 887 bytes
.gitignore -rw-r--r-- 1.8 KB
.golangci.yaml -rw-r--r-- 3.6 KB
.mailmap -rw-r--r-- 6.5 KB
.travis.yml -rw-r--r-- 506 bytes
AUTHORS -rw-r--r-- 41.5 KB
CHANGELOG.md -rw-r--r-- 112.0 KB
CODEOWNERS -rw-r--r-- 11.2 KB
CODE_OF_CONDUCT.md -rw-r--r-- 2.2 KB
CONTRIBUTING.md -rw-r--r-- 691 bytes
FURTHER_READINGS.rst -rw-r--r-- 6.4 KB
LICENSE -rw-r--r-- 11.1 KB
MAINTAINERS.md -rw-r--r-- 4.3 KB
Makefile -rw-r--r-- 34.9 KB
Makefile.defs -rw-r--r-- 6.9 KB
Makefile.docker -rw-r--r-- 7.3 KB
Makefile.quiet -rw-r--r-- 818 bytes
README.rst -rw-r--r-- 19.4 KB
SECURITY.md -rw-r--r-- 1.0 KB
USERS.md -rw-r--r-- 28.5 KB
VERSION -rw-r--r-- 7 bytes
Vagrantfile -rw-r--r-- 14.9 KB
go.mod -rw-r--r-- 12.2 KB
go.sum -rw-r--r-- 152.7 KB
netlify.toml -rw-r--r-- 92 bytes
vagrant_box_defaults.rb -rw-r--r-- 334 bytes

README.rst

back to top