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] [day] [month] [year] [list]
Date:	Thu, 31 Jul 2014 12:35:46 -0400 (EDT)
From:	Mikulas Patocka <mpatocka@...hat.com>
To:	device-mapper development <dm-devel@...hat.com>
cc:	Alasdair Kergon <agk@...hat.com>,
	Mike Snitzer <snitzer@...hat.com>,
	Vladimir Davydov <vdavydov@...allels.com>,
	linux-kernel@...r.kernel.org, linux-raid@...r.kernel.org,
	linux-mm@...ck.org, Dave Chinner <dchinner@...hat.com>,
	Greg Thelen <gthelen@...gle.com>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [dm-devel] [PATCH] dm bufio: fully initialize shrinker


On Thu, 31 Jul 2014, Greg Thelen wrote:

> 1d3d4437eae1 ("vmscan: per-node deferred work") added a flags field to
> struct shrinker assuming that all shrinkers were zero filled.  The dm
> bufio shrinker is not zero filled, which leaves arbitrary kmalloc() data
> in flags.  So far the only defined flags bit is SHRINKER_NUMA_AWARE.
> But there are proposed patches which add other bits to shrinker.flags
> (e.g. memcg awareness).
> 
> Rather than simply initializing the shrinker, this patch uses kzalloc()
> when allocating the dm_bufio_client to ensure that the embedded shrinker
> and any other similar structures are zeroed.
> 
> This fixes theoretical over aggressive shrinking of dm bufio objects.
> If the uninitialized dm_bufio_client.shrinker.flags contains
> SHRINKER_NUMA_AWARE then shrink_slab() would call the dm shrinker for
> each numa node rather than just once.  This has been broken since 3.12.
> 
> Signed-off-by: Greg Thelen <gthelen@...gle.com>

Acked-by: Mikulas Patocka <mpatocka@...hat.com>
Cc: stable@...r.kernel.org	#v3.12

> ---
>  drivers/md/dm-bufio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
> index 4e84095833db..d724459860d9 100644
> --- a/drivers/md/dm-bufio.c
> +++ b/drivers/md/dm-bufio.c
> @@ -1541,7 +1541,7 @@ struct dm_bufio_client *dm_bufio_client_create(struct block_device *bdev, unsign
>  	BUG_ON(block_size < 1 << SECTOR_SHIFT ||
>  	       (block_size & (block_size - 1)));
>  
> -	c = kmalloc(sizeof(*c), GFP_KERNEL);
> +	c = kzalloc(sizeof(*c), GFP_KERNEL);
>  	if (!c) {
>  		r = -ENOMEM;
>  		goto bad_client;
> -- 
> 2.0.0.526.g5318336
> 
> --
> dm-devel mailing list
> dm-devel@...hat.com
> https://www.redhat.com/mailman/listinfo/dm-devel
> 
--
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