public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/nsz/mtag] malloc: Avoid taggig mmaped memory on free
@ 2021-03-19 11:57 Szabolcs Nagy
  0 siblings, 0 replies; 4+ messages in thread
From: Szabolcs Nagy @ 2021-03-19 11:57 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=7307a417dfc26aa032d66ce9ae41b0ef78577366

commit 7307a417dfc26aa032d66ce9ae41b0ef78577366
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date:   Thu Feb 4 11:52:14 2021 +0000

    malloc: Avoid taggig mmaped memory on free
    
    Either the memory belongs to the dumped area, in which case we don't
    want to tag (the dumped area has the same tag as malloc internal data
    so tagging is unnecessary, but chunks there may not have the right
    alignment for the tag granule), or the memory will be unmapped
    immediately (and thus tagging is not useful).
    
    Reviewed-by: DJ Delorie <dj@redhat.com>

Diff:
---
 malloc/malloc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/malloc/malloc.c b/malloc/malloc.c
index 61c25d0f93..ecb87350b0 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -3284,9 +3284,6 @@ __libc_free (void *mem)
 
   p = mem2chunk (mem);
 
-  /* Mark the chunk as belonging to the library again.  */
-  (void)TAG_REGION (chunk2rawmem (p), CHUNK_AVAILABLE_SIZE (p) - CHUNK_HDR_SZ);
-
   if (chunk_is_mmapped (p))                       /* release mmapped memory. */
     {
       /* See if the dynamic brk/mmap threshold needs adjusting.
@@ -3307,6 +3304,10 @@ __libc_free (void *mem)
     {
       MAYBE_INIT_TCACHE ();
 
+      /* Mark the chunk as belonging to the library again.  */
+      (void)TAG_REGION (chunk2rawmem (p),
+			CHUNK_AVAILABLE_SIZE (p) - CHUNK_HDR_SZ);
+
       ar_ptr = arena_for_chunk (p);
       _int_free (ar_ptr, p, 0);
     }


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [glibc/nsz/mtag] malloc: Avoid taggig mmaped memory on free
@ 2021-03-11 17:40 Szabolcs Nagy
  0 siblings, 0 replies; 4+ messages in thread
From: Szabolcs Nagy @ 2021-03-11 17:40 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=d9ba54fe178563174ff409481553f67b2e65296e

commit d9ba54fe178563174ff409481553f67b2e65296e
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date:   Thu Feb 4 11:52:14 2021 +0000

    malloc: Avoid taggig mmaped memory on free
    
    Either the memory belongs to the dumped area, in which case we don't
    want to tag (the dumped area has the same tag as malloc internal data
    so tagging is unnecessary, but chunks there may not have the right
    alignment for the tag granule), or the memory will be unmapped
    immediately (and thus tagging is not useful).
    
    Reviewed-by: DJ Delorie <dj@redhat.com>

Diff:
---
 malloc/malloc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/malloc/malloc.c b/malloc/malloc.c
index 61c25d0f93..ecb87350b0 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -3284,9 +3284,6 @@ __libc_free (void *mem)
 
   p = mem2chunk (mem);
 
-  /* Mark the chunk as belonging to the library again.  */
-  (void)TAG_REGION (chunk2rawmem (p), CHUNK_AVAILABLE_SIZE (p) - CHUNK_HDR_SZ);
-
   if (chunk_is_mmapped (p))                       /* release mmapped memory. */
     {
       /* See if the dynamic brk/mmap threshold needs adjusting.
@@ -3307,6 +3304,10 @@ __libc_free (void *mem)
     {
       MAYBE_INIT_TCACHE ();
 
+      /* Mark the chunk as belonging to the library again.  */
+      (void)TAG_REGION (chunk2rawmem (p),
+			CHUNK_AVAILABLE_SIZE (p) - CHUNK_HDR_SZ);
+
       ar_ptr = arena_for_chunk (p);
       _int_free (ar_ptr, p, 0);
     }


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [glibc/nsz/mtag] malloc: Avoid taggig mmaped memory on free
@ 2021-03-11 17:38 Szabolcs Nagy
  0 siblings, 0 replies; 4+ messages in thread
From: Szabolcs Nagy @ 2021-03-11 17:38 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=d9ba54fe178563174ff409481553f67b2e65296e

commit d9ba54fe178563174ff409481553f67b2e65296e
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date:   Thu Feb 4 11:52:14 2021 +0000

    malloc: Avoid taggig mmaped memory on free
    
    Either the memory belongs to the dumped area, in which case we don't
    want to tag (the dumped area has the same tag as malloc internal data
    so tagging is unnecessary, but chunks there may not have the right
    alignment for the tag granule), or the memory will be unmapped
    immediately (and thus tagging is not useful).
    
    Reviewed-by: DJ Delorie <dj@redhat.com>

Diff:
---
 malloc/malloc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/malloc/malloc.c b/malloc/malloc.c
index 61c25d0f93..ecb87350b0 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -3284,9 +3284,6 @@ __libc_free (void *mem)
 
   p = mem2chunk (mem);
 
-  /* Mark the chunk as belonging to the library again.  */
-  (void)TAG_REGION (chunk2rawmem (p), CHUNK_AVAILABLE_SIZE (p) - CHUNK_HDR_SZ);
-
   if (chunk_is_mmapped (p))                       /* release mmapped memory. */
     {
       /* See if the dynamic brk/mmap threshold needs adjusting.
@@ -3307,6 +3304,10 @@ __libc_free (void *mem)
     {
       MAYBE_INIT_TCACHE ();
 
+      /* Mark the chunk as belonging to the library again.  */
+      (void)TAG_REGION (chunk2rawmem (p),
+			CHUNK_AVAILABLE_SIZE (p) - CHUNK_HDR_SZ);
+
       ar_ptr = arena_for_chunk (p);
       _int_free (ar_ptr, p, 0);
     }


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [glibc/nsz/mtag] malloc: Avoid taggig mmaped memory on free
@ 2021-03-04 16:25 Szabolcs Nagy
  0 siblings, 0 replies; 4+ messages in thread
From: Szabolcs Nagy @ 2021-03-04 16:25 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=3387a579c77328cd5e793da028dd432c9a01e8b1

commit 3387a579c77328cd5e793da028dd432c9a01e8b1
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date:   Thu Feb 4 11:52:14 2021 +0000

    malloc: Avoid taggig mmaped memory on free
    
    Either the memory belongs to the dumped area, in which case we don't
    want to tag (the dumped area has the same tag as malloc internal data
    so tagging is unnecessary, but chunks there may not have the right
    alignment for the tag granule), or the memory will be unmapped
    immediately (and thus tagging is not useful).

Diff:
---
 malloc/malloc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/malloc/malloc.c b/malloc/malloc.c
index 4538a01614..b4c800bd7f 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -3284,9 +3284,6 @@ __libc_free (void *mem)
 
   p = mem2chunk (mem);
 
-  /* Mark the chunk as belonging to the library again.  */
-  (void)TAG_REGION (chunk2rawmem (p), CHUNK_AVAILABLE_SIZE (p) - CHUNK_HDR_SZ);
-
   if (chunk_is_mmapped (p))                       /* release mmapped memory. */
     {
       /* See if the dynamic brk/mmap threshold needs adjusting.
@@ -3307,6 +3304,10 @@ __libc_free (void *mem)
     {
       MAYBE_INIT_TCACHE ();
 
+      /* Mark the chunk as belonging to the library again.  */
+      (void)TAG_REGION (chunk2rawmem (p),
+			CHUNK_AVAILABLE_SIZE (p) - CHUNK_HDR_SZ);
+
       ar_ptr = arena_for_chunk (p);
       _int_free (ar_ptr, p, 0);
     }


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-19 11:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-19 11:57 [glibc/nsz/mtag] malloc: Avoid taggig mmaped memory on free Szabolcs Nagy
  -- strict thread matches above, loose matches on Subject: below --
2021-03-11 17:40 Szabolcs Nagy
2021-03-11 17:38 Szabolcs Nagy
2021-03-04 16:25 Szabolcs Nagy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).