diff mbox series

[04/16] malloc: Simplify __mtag_tag_new_usable

Message ID c8211eaef6835ff3560077f3ee0cfe444e38aaf6.1614874816.git.szabolcs.nagy@arm.com
State Committed
Commit 91e5c439d3130a3c5ff3a3b72adedd50f3f72f76
Headers show
Series memory tagging improvements | expand

Commit Message

Szabolcs Nagy March 4, 2021, 4:31 p.m. UTC
The chunk cannot be a dumped one here.  The only non-obvious cases
are free and realloc which may be called on a dumped area chunk,
but in both cases it can be verified that tagging is already
avoided for dumped area chunks.
 malloc/arena.c | 5 -----
 1 file changed, 5 deletions(-)


Szabolcs Nagy March 5, 2021, 12:24 p.m. UTC | #1
The 03/04/2021 19:20, DJ Delorie wrote:
> Szabolcs Nagy <szabolcs.nagy@arm.com> writes:
> > The chunk cannot be a dumped one here.
> What about the realloc-expand case in malloc.c:4819 ?

that's in _int_realloc and it seems _int_realloc
is never called on dumped chunks (nor mmapped
chunks in more general)

(there is some inconsistency here about what
kind of chunks may end up in _int_realloc vs
_int_free, e.g. the former may be tagged and
never mmapped, the latter is always untagged
but may be mmapped, but neither can be dumped.
these constraints are currently not documented)
diff mbox series


diff --git a/malloc/arena.c b/malloc/arena.c
index bf17be27d4..0777dc70c6 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -298,11 +298,6 @@  __mtag_tag_new_usable (void *ptr)
   if (ptr)
       mchunkptr cp = mem2chunk(ptr);
-      /* This likely will never happen, but we can't handle retagging
-	 chunks from the dumped main arena.  So just return the
-	 existing pointer.  */
-      if (DUMPED_MAIN_ARENA_CHUNK (cp))
-	return ptr;
       ptr = __libc_mtag_tag_region (__libc_mtag_new_tag (ptr),