aboutsummaryrefslogtreecommitdiff
path: root/sys/vm/uma_core.c
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2022-10-19 18:27:49 +0000
committerMark Johnston <markj@FreeBSD.org>2022-10-19 18:36:36 +0000
commit2dba2288aa364c36c756770ac77590816b15d954 (patch)
tree36b383325bfeaa622dba33a67a9735d89bb67932 /sys/vm/uma_core.c
parente9adbcdf2e8000efaca404abcc904eec4eb4ae29 (diff)
downloadsrc-2dba2288aa364c36c756770ac77590816b15d954.tar.gz
src-2dba2288aa364c36c756770ac77590816b15d954.zip
uma: Never pass cache zones to memguard
Items allocated from cache zones cannot usefully be protected by memguard. PR: 267151 Reported and tested by: pho MFC after: 1 week
Diffstat (limited to 'sys/vm/uma_core.c')
-rw-r--r--sys/vm/uma_core.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c
index daa14cc3e3b3..ae34d8bf0997 100644
--- a/sys/vm/uma_core.c
+++ b/sys/vm/uma_core.c
@@ -3561,7 +3561,8 @@ uma_zalloc_debug(uma_zone_t zone, void **itemp, void *udata, int flags)
#endif
#ifdef DEBUG_MEMGUARD
- if ((zone->uz_flags & UMA_ZONE_SMR) == 0 && memguard_cmp_zone(zone)) {
+ if ((zone->uz_flags & (UMA_ZONE_SMR | UMA_ZFLAG_CACHE)) == 0 &&
+ memguard_cmp_zone(zone)) {
void *item;
item = memguard_alloc(zone->uz_size, flags);
if (item != NULL) {
@@ -3596,7 +3597,8 @@ uma_zfree_debug(uma_zone_t zone, void *item, void *udata)
("uma_zfree_debug: called with spinlock or critical section held"));
#ifdef DEBUG_MEMGUARD
- if ((zone->uz_flags & UMA_ZONE_SMR) == 0 && is_memguard_addr(item)) {
+ if ((zone->uz_flags & (UMA_ZONE_SMR | UMA_ZFLAG_CACHE)) == 0 &&
+ is_memguard_addr(item)) {
if (zone->uz_dtor != NULL)
zone->uz_dtor(item, zone->uz_size, udata);
if (zone->uz_fini != NULL)