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:	Thu, 11 Dec 2008 23:22:50 +0200
From:	Pekka Enberg <penberg@...helsinki.fi>
To:	Catalin Marinas <catalin.marinas@....com>
CC:	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 03/15] kmemleak: Add the slab memory allocation/freeing
 hooks

Hi Catalin,

Catalin Marinas wrote:
> @@ -2610,6 +2611,13 @@ static struct slab *alloc_slabmgmt(struct kmem_cache *cachep, void *objp,
>  		/* Slab management obj is off-slab. */
>  		slabp = kmem_cache_alloc_node(cachep->slabp_cache,
>  					      local_flags & ~GFP_THISNODE, nodeid);
> +		/*
> +		 * Only scan the list member to avoid false negatives
> +		 * (especially caused by the s_mem pointer)
> +		 */

Heh, I run into this part again and as I have a long term memory of a 
goldfish I had to look up the discussion we had. So may I suggest you 
change the comment to:

/*
  * If the first object in the slab is leaked (it's allocated but no
  * one has a reference to it), we want to make sure kmemleak does not
  * treat the ->s_mem pointer as a reference to the object. Otherwise
  * we will not report the leak.
  */

> +		memleak_scan_area(slabp, offsetof(struct slab, list),
> +				  sizeof(struct list_head),
> +				  local_flags & ~GFP_THISNODE);
>  		if (!slabp)
>  			return NULL;
>  	} else {
> @@ -3195,6 +3203,8 @@ static inline void *____cache_alloc(struct kmem_cache *cachep, gfp_t flags)
>  		STATS_INC_ALLOCMISS(cachep);
>  		objp = cache_alloc_refill(cachep, flags);
>  	}
> +	/* avoid false negatives */
> +	memleak_erase(&ac->entry[ac->avail]);

For this, maybe something like this:

/*
  * To avoid a false negative, if an object that is in one of the
  * per-CPU caches is leaked, we need to make sure kmemleak doesn't
  * treat the array pointers as a reference to the object.
  */

>  	return objp;
>  }
>  

Do you take care of the per-node lists as well?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ