]> git.ipfire.org Git - thirdparty/glibc.git/commit
cheri: malloc: exact capability check in free/realloc arm/morello/main
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Tue, 4 Apr 2023 15:39:34 +0000 (16:39 +0100)
committerSzabolcs Nagy <szabolcs.nagy@arm.com>
Wed, 5 Apr 2023 14:29:59 +0000 (15:29 +0100)
commit33cb9de5cba0e3b428a2bab4bd8368bf55806430
tree63884e6c4509f00baf13066ac12efcd6cf29b85c
parent47e61ba7720c1c646077318e079dcb75224b1001
cheri: malloc: exact capability check in free/realloc

Capability narrowing uses a lookup table from an address to the
internally used wide capability. Keep the narrow capability in the
table instead of just the address and check it. This allows free
and realloc to check their input and only accept capabilities
exactly matching what was returned by malloc.

When a user adds restrictions on top of malloc returned capabilities
(e.g. narrower bounds), realloc could bypass those restrictions when
it simply looked up the internal wide capability for the address.
malloc/malloc.c
sysdeps/aarch64/morello/libc-cap.h
sysdeps/generic/libc-cap.h