lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180426125634.uybpbbk5puee7fsg@armageddon.cambridge.arm.com>
Date:   Thu, 26 Apr 2018 13:56:35 +0100
From:   Catalin Marinas <catalin.marinas@....com>
To:     Chunyu Hu <chuhu@...hat.com>
Cc:     Michal Hocko <mhocko@...nel.org>,
        Chunyu Hu <chuhu.ncepu@...il.com>,
        Dmitry Vyukov <dvyukov@...gle.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Linux-MM <linux-mm@...ck.org>
Subject: Re: [RFC] mm: kmemleak: replace __GFP_NOFAIL to GFP_NOWAIT in
 gfp_kmemleak_mask

On Thu, Apr 26, 2018 at 08:23:19AM -0400, Chunyu Hu wrote:
> kmemleak is using kmem_cache to record every pointers returned from kernel mem 
> allocation activities such as kmem_cache_alloc(). every time an object from
> slab allocator is returned, a following new kmemleak object is allocated.  
> 
> And when a slab object is freed, then the kmemleak object which contains
> the ptr will also be freed. 
> 
> and kmemleak scan thread will run in period to scan the kernel data, stack, 
> and per cpu areas to check that every pointers recorded by kmemleak has at least
> one reference in those areas beside the one recorded by kmemleak. If there
> is no place in the memory acreas recording the ptr, then it's possible a leak.
> 
> so once a kmemleak object allocation failed, it has to disable itself, otherwise
> it would lose track of some object pointers, and become less meaningful to 
> continue record and scan the kernel memory for the pointers. So disable
> it forever. so this is why kmemleak can't tolerate a slab alloc fail (from fault injection)
> 
> @Catalin,
> 
> Is this right? If something not so correct or precise, please correct me.

That's a good description, thanks.

> I'm thinking about, is it possible that make kmemleak don't disable itself
> when fail_page_alloc is enabled?  I can't think clearly what would happen
> if several memory allocation missed by kmelkeak trace, what's the bad result? 

Take for example a long linked list. If kmemleak doesn't track an object
in such list (because the metadata allocation failed), such list_head is
never scanned and the subsequent objects in the list (pointed at by
'next') will be reported as leaks. Kmemleak pretty much becomes unusable
with a high number of false positives.

-- 
Catalin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ