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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 31 Oct 2021 12:54:04 +0000
From:   Matthew Wilcox <willy@...radead.org>
To:     Muchun Song <songmuchun@...edance.com>
Cc:     Yunfeng Ye <yeyunfeng@...wei.com>,
        Christoph Lameter <cl@...ux.com>,
        Pekka Enberg <penberg@...nel.org>,
        David Rientjes <rientjes@...gle.com>,
        Joonsoo Kim <iamjoonsoo.kim@....com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Vlastimil Babka <vbabka@...e.cz>,
        Linux Memory Management List <linux-mm@...ck.org>,
        LKML <linux-kernel@...r.kernel.org>, wuxu.wu@...wei.com,
        Hewenliang <hewenliang4@...wei.com>
Subject: Re: [PATCH] mm, slub: place the trace before freeing memory in
 kmem_cache_free()

On Sat, Oct 30, 2021 at 08:23:12PM +0800, Muchun Song wrote:
> On Sat, Oct 30, 2021 at 6:12 PM Yunfeng Ye <yeyunfeng@...wei.com> wrote:
> >
> > After the memory is freed, it may be allocated by other CPUs and has
> > been recorded by trace. So the timing sequence of the memory tracing is
> > inaccurate.
> >
> > For example, we expect the following timing sequeuce:
> >
> >     CPU 0                 CPU 1
> >
> >   (1) alloc xxxxxx
> >   (2) free  xxxxxx
> >                          (3) alloc xxxxxx
> >                          (4) free  xxxxxx
> >
> > However, the following timing sequence may occur:
> >
> >     CPU 0                 CPU 1
> >
> >   (1) alloc xxxxxx
> >                          (2) alloc xxxxxx
> >   (3) free  xxxxxx
> >                          (4) free  xxxxxx
> >
> > So place the trace before freeing memory in kmem_cache_free().
> 
> Could you tell me what problem you have encountered
> here?

It's confusing to see the memory allocated before it's freed.  If you're
unaware of this problem, you might think it was being used after free
because (1) happened a long time ago, so you see (2) immediately followed
by (3) and then see the memory being used.

The patch makes sense to me.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ