Skip to content

Commit

Permalink
untag pointers before searching
Browse files Browse the repository at this point in the history
  • Loading branch information
struct committed Jan 20, 2024
1 parent b4e146b commit b14a84a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/iso_alloc_mem_tags.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ INTERNAL_HIDDEN uint8_t _iso_alloc_get_mem_tag(void *p, iso_alloc_zone_t *zone)
}

_mtp += (chunk_offset / zone->chunk_size);
;

return *_mtp;
#else
return 0;
Expand Down
6 changes: 6 additions & 0 deletions src/iso_alloc_search.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ INTERNAL_HIDDEN void *_iso_alloc_ptr_search(void *n, bool poison) {
uint8_t *end = NULL;
const size_t zones_used = _root->zones_used;

#if MEMORY_TAGGING || (ARM_MTE == 1)
/* It should be safe to clear these upper bits even
* if the pointer wasn't returned by IsoAlloc. */
n = (void *) ((uintptr_t) n & TAGGED_PTR_MASK);
#endif

for(int32_t i = 0; i < zones_used; i++) {
iso_alloc_zone_t *zone = &_root->zones[i];

Expand Down

0 comments on commit b14a84a

Please sign in to comment.