Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Sep 2024 05:37:24 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 281471] ASLR: jemalloc RES memory keeps on increasing until process cores
Message-ID:  <bug-281471-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D281471

            Bug ID: 281471
           Summary: ASLR: jemalloc RES memory keeps on increasing until
                    process cores
           Product: Base System
           Version: Unspecified
          Hardware: arm64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: rupeshpilania@gmail.com

Hi Team,

I noticed Jemalloc doesn't bring down RES memory to original one even after
calling free and setting these flags.
MALLOC_CONF=3D"xmalloc:true,dirty_decay_ms:0,retain:false"=20
The only way to make it work is to disable aslr at kernel level along with
MALLOC_CONF=3D"xmalloc:true,dirty_decay_ms:0,retain:false"=20

Test Results:

ASLR Enabled:

cat /etc/sysctl.conf | grep aslr
kern.elf32.aslr.enable=3D1
kern.elf32.aslr.pie_enable=3D1
kern.elf64.aslr.enable=3D1
kern.elf64.aslr.pie_enable=3D1
13.2-RELEASE-p12 FreeBSD 13.2-RELEASE-p12 MESSAGING_GATEWAY amd64


C600V-DUT018:rtestuser 16] ./mem-fragment
Hello!  This program will fragment its process heap.  Run top -p 5364 to fo=
llow
along!
Press Enter to continue...

 PID USERNAME    THR PRI NICE   SIZE    RES STATE    C   TIME    WCPU COMMA=
ND
 5364 root          1  20    0    10M  2280K ttyin    6   0:00   0.00% mem-=
frag


500k 5KB chunks were just provisioned
Press Enter to continue...


  PID USERNAME    THR PRI NICE   SIZE    RES STATE    C   TIME    WCPU COMM=
AND
 5364 root          1  52    0  4898M  3034M ttyin    6   0:02   0.00% mem-=
frag

500k 5KB chunks were just provisioned
Press Enter to continue...

 PID USERNAME    THR PRI NICE   SIZE    RES STATE    C   TIME    WCPU COMMA=
ND
 5364 root          1  48    0  9816M  6064M ttyin    6   0:04   0.00% mem-=
frag

The first allocations were just free()'d.
Press Enter to continue...

  PID USERNAME    THR PRI NICE   SIZE    RES STATE    C   TIME    WCPU COMM=
AND
 5364 root          1  27    0  7266M  3541M ttyin    6   0:05   0.00% mem-=
frag

The 2nd allocations were just free()'d.
Press Enter to continue...

  PID USERNAME    THR PRI NICE   SIZE    RES STATE    C   TIME    WCPU COMM=
AND
 5364 root          1  28    0  4716M  1018M ttyin    6   0:05   0.00% mem-=
frag




ASLR Disabled:
cat /etc/sysctl.conf | grep aslr
kern.elf32.aslr.enable=3D0
kern.elf32.aslr.pie_enable=3D0
kern.elf64.aslr.enable=3D0
kern.elf64.aslr.pie_enable=3D0

C600V-DUT018:rtestuser 8] setenv MALLOC_CONF
"xmalloc:true,dirty_decay_ms:0,retain:false"

C600V-DUT018:rtestuser 10] ./mem-fragment
Hello!  This program will fragment its process heap.  Run top -p 3884 to fo=
llow
along!
Press Enter to continue...
 PID USERNAME    THR PRI NICE   SIZE    RES STATE    C   TIME    WCPU COMMA=
ND
 3884 root          1  20    0    16M  2152K ttyin    5   0:00   0.00% mem-=
frag
500k 5KB chunks were just provisioned
Press Enter to continue...
  PID USERNAME    THR PRI NICE   SIZE    RES STATE    C   TIME    WCPU COM
 3884 root          1  44    0  2592M  2072M ttyin    5   0:02   0.00% mem
500k 5KB chunks were just provisioned
Press Enter to continue...
 PID USERNAME    THR PRI NICE   SIZE    RES STATE    C   TIME    WCPU COM
 3884 root          1  45    0  5168M  4142M ttyin    5   0:03   0.00% mem
The first allocations were just free()'d.
Press Enter to continue...
 PID USERNAME    THR PRI NICE   SIZE    RES STATE    C   TIME    WCPU COM
 3884 root          1  25    0  2618M  2097M ttyin    5   0:04   0.00% mem
The 2nd allocations were just free()'d.
Press Enter to continue...
 PID USERNAME    THR PRI NICE   SIZE    RES STATE    C   TIME    WCPU COM
 3884 root          1  26    0    68M    52M ttyin    5   0:04   0.00% mem

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-281471-227>