FreeBSD Bugzilla – Attachment 200018 Details for
Bug 233414
[PowerPC64] OPTIONS DEBUG_MEMGUARD results in unbootable kernel
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
memguard hack
memguard_hack.diff (text/plain), 1.65 KB, created by
Mark Johnston
on 2018-12-11 02:35:17 UTC
(
hide
)
Description:
memguard hack
Filename:
MIME Type:
Creator:
Mark Johnston
Created:
2018-12-11 02:35:17 UTC
Size:
1.65 KB
patch
obsolete
>diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c >index ba5ec807404c..5b3f0d88890f 100644 >--- a/sys/vm/uma_core.c >+++ b/sys/vm/uma_core.c >@@ -362,13 +362,25 @@ bucket_init(void) > * to allocate the bucket. > */ > static struct uma_bucket_zone * >-bucket_zone_lookup(int entries) >+bucket_zone_lookup(uma_zone_t zone, int entries) > { > struct uma_bucket_zone *ubz; >+ uma_keg_t keg; > >- for (ubz = &bucket_zones[0]; ubz->ubz_entries != 0; ubz++) >- if (ubz->ubz_entries >= entries) >- return (ubz); >+ for (ubz = &bucket_zones[0]; ubz->ubz_entries != 0; ubz++) { >+ if (ubz->ubz_entries < entries) >+ continue; >+#ifdef DEBUG_MEMGUARD >+ if (zone != NULL && memguard_cmp_zone(ubz->ubz_zone) && >+ (keg = zone_first_keg(zone)) != NULL && >+ (keg->uk_flags & (UMA_ZONE_VM | UMA_ZFLAG_BUCKET)) != 0) { >+ if ((ubz + 1)->ubz_entries == 0) >+ return (ubz - 1); >+ continue; >+ } >+#endif >+ return (ubz); >+ } > ubz--; > return (ubz); > } >@@ -422,7 +434,7 @@ bucket_alloc(uma_zone_t zone, void *udata, int flags) > } > if ((uintptr_t)udata & UMA_ZFLAG_CACHEONLY) > flags |= M_NOVM; >- ubz = bucket_zone_lookup(zone->uz_count); >+ ubz = bucket_zone_lookup(zone, zone->uz_count); > if (ubz->ubz_zone == zone && (ubz + 1)->ubz_entries != 0) > ubz++; > bucket = uma_zalloc_arg(ubz->ubz_zone, udata, flags); >@@ -446,7 +458,7 @@ bucket_free(uma_zone_t zone, uma_bucket_t bucket, void *udata) > ("bucket_free: Freeing a non free bucket.")); > if ((zone->uz_flags & UMA_ZFLAG_BUCKET) == 0) > udata = (void *)(uintptr_t)zone->uz_flags; >- ubz = bucket_zone_lookup(bucket->ub_entries); >+ ubz = bucket_zone_lookup(NULL, bucket->ub_entries); > uma_zfree_arg(ubz->ubz_zone, bucket, udata); > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 233414
:
199759
|
200018
|
200057