Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.20.1707171156390.10415@nuc-kabylake>
Date: Mon, 17 Jul 2017 11:57:50 -0500 (CDT)
From: Christopher Lameter <cl@...ux.com>
To: Alexander Popov <alex.popov@...ux.com>
cc: Pekka Enberg <penberg@...nel.org>, David Rientjes <rientjes@...gle.com>, 
    Joonsoo Kim <iamjoonsoo.kim@....com>, 
    Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org, 
    linux-kernel@...r.kernel.org, kernel-hardening@...ts.openwall.com, 
    keescook@...omium.org
Subject: Re: [PATCH 1/1] mm/slub.c: add a naive detection of double free or
 corruption

On Mon, 17 Jul 2017, Alexander Popov wrote:

> Add an assertion similar to "fasttop" check in GNU C Library allocator:
> an object added to a singly linked freelist should not point to itself.
> That helps to detect some double free errors (e.g. CVE-2017-2636) without
> slub_debug and KASAN. Testing with hackbench doesn't show any noticeable
> performance penalty.

We are adding up "unnoticable performance penalties". This is used
int both the critical allocation and free paths. Could this be
VM_BUG_ON()?

>
> Signed-off-by: Alexander Popov <alex.popov@...ux.com>
> ---
>  mm/slub.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/mm/slub.c b/mm/slub.c
> index 1d3f983..a106939b 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -261,6 +261,7 @@ static inline void *get_freepointer_safe(struct kmem_cache *s, void *object)
>
>  static inline void set_freepointer(struct kmem_cache *s, void *object, void *fp)
>  {
> +	BUG_ON(object == fp); /* naive detection of double free or corruption */
>  	*(void **)(object + s->offset) = fp;
>  }
>
>

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.