From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1B69C388E813; Tue, 16 Jun 2020 17:56:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1B69C388E813 From: "agentzh at gmail dot com" To: systemtap@sourceware.org Subject: [Bug runtime/26123] New: Use of VMA tracker would leak kernel slab memory for modern kernels without CONFIG_UTRACE Date: Tue, 16 Jun 2020 17:56:05 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: systemtap X-Bugzilla-Component: runtime X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: agentzh at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: systemtap at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: systemtap@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Systemtap mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jun 2020 17:56:06 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D26123 Bug ID: 26123 Summary: Use of VMA tracker would leak kernel slab memory for modern kernels without CONFIG_UTRACE Product: systemtap Version: unspecified Status: UNCONFIRMED Severity: normal Priority: P2 Component: runtime Assignee: systemtap at sourceware dot org Reporter: agentzh at gmail dot com Target Milestone: --- In the systemtap runtime, the stap_destroy_vma_map() function is never call= ed by _stp_vma_done() for modern kernels without `CONFIG_UTRACE` because the former is guarded by the `CONFIG_UTRACE` macro. Thus the kernel slab memory allocated in _stp_vma_init() through stap_initialize_vma_map() is never released. The `stap_initialize_vma_map()` call is guarded, correctly, by the `HAVE_TASK_FINDER` macro. Even simplest .stp scripts involved with vma would reproduce the leak. We s= aw giga bytes of Slab memory leaked in `/proc/meminfo` for boxes with a lot of stap scripts runs. And stap's own `-DDEBUG_MEM` facility can successfully c= atch the leak with the following dmesg output, for example: ``` [253908.065199] SYSTEMTAP ERROR: Memory ffff8cbb75523320 len=3D112 allocati= on type: kmalloc. Not freed. [253908.065203] SYSTEMTAP ERROR: Memory ffff8cbb75522f20 len=3D112 allocati= on type: kmalloc. Not freed. [253908.065204] SYSTEMTAP ERROR: Memory ffff8cbb75523220 len=3D112 allocati= on type: kmalloc. Not freed. [253908.065205] SYSTEMTAP ERROR: Memory ffff8cbb75523720 len=3D112 allocati= on type: kmalloc. Not freed. [253908.065206] SYSTEMTAP ERROR: Memory ffff8cbb75522c20 len=3D112 allocati= on type: kmalloc. Not freed. [253908.065207] SYSTEMTAP ERROR: Memory ffff8cbb75522220 len=3D112 allocati= on type: kmalloc. Not freed. [253908.065208] SYSTEMTAP ERROR: Memory ffff8cbb75522520 len=3D112 allocati= on type: kmalloc. Not freed. [253908.065209] SYSTEMTAP ERROR: Memory ffff8cbb75522120 len=3D112 allocati= on type: kmalloc. Not freed. [253908.065210] SYSTEMTAP ERROR: Memory ffff8cbb75523520 len=3D112 allocati= on type: kmalloc. Not freed. [253908.065210] SYSTEMTAP ERROR: Memory ffff8cbb75523f20 len=3D112 allocati= on type: kmalloc. Not freed. [253908.065211] SYSTEMTAP ERROR: Memory ffff8cbb75522620 len=3D112 allocati= on type: kmalloc. Not freed. [253908.065212] SYSTEMTAP ERROR: Memory ffff8cbb75523820 len=3D112 allocati= on type: kmalloc. Not freed. [253908.065213] SYSTEMTAP ERROR: Memory ffff8cbb75522820 len=3D112 allocati= on type: kmalloc. Not freed. [253908.065265] SYSTEMTAP ERROR: Memory ffff8cbb75522720 len=3D112 allocati= on type: kmalloc. Not freed. [253908.065266] SYSTEMTAP ERROR: Memory ffff8cbb75523b20 len=3D112 allocati= on type: kmalloc. Not freed. [253908.065267] SYSTEMTAP ERROR: Memory ffff8cb9ec1dff20 len=3D128 allocati= on type: kmalloc. Not freed. ``` I'll commit a patch today to address this issue. --=20 You are receiving this mail because: You are the assignee for the bug.=