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:	Fri, 16 Oct 2015 13:58:55 +0200 (CEST)
From:	Jozsef Kadlecsik <kadlec@...ckhole.kfki.hu>
To:	Nikolay Borisov <kernel@...p.com>
cc:	eric.dumazet@...il.com, netfilter-devel@...r.kernel.org,
	Pablo Neira Ayuso <pablo@...filter.org>,
	David Miller <davem@...emloft.net>, netdev@...r.kernel.org,
	operations@...eground.com
Subject: Re: [PATCH v3] netfilter: ipset: Fix sleeping memory allocation in
 atomic context

On Fri, 16 Oct 2015, Nikolay Borisov wrote:

> Commit 00590fdd5be0 introduced RCU locking in list type and in
> doing so introduced a memory allocation in list_set_add, which 
> is done in an atomic context, due to the fact that ipset rcu 
> list modifications are serialised with a spin lock. The reason 
> why we can't use a mutex is that in addition to modifying the 
> list with ipset commands, it's also being modified when a
> particular ipset rule timeout expires aka garbage collection. 
> This gc is triggered from set_cleanup_entries, which in turn 
> is invoked from a timer thus requiring the lock to be bh-safe. 
> 
> Concretely the following call chain can lead to "sleeping function
> called in atomic context" splat: 
> call_ad -> list_set_uadt -> list_set_uadd -> kzalloc(, GFP_KERNEL).
> And since GFP_KERNEL allows initiating direct reclaim thus
> potentially sleeping in the allocation path.
> 
> To fix the issue change the allocation type to GFP_ATOMIC, to
> correctly reflect that it is occuring in an atomic context.
> 
> Fixes: 00590fdd5be0 ("netfilter: ipset: Introduce RCU locking in list type")
> 
> Acked-by: Jozsef Kadlecsik <kadlec@...ckhole.kfki.hu>
> Signed-off-by: Nikolay Borisov <kernel@...p.com>
> ---
> 
> Changes since v2:
>  * Massaged the changelog to reflect discussion 
>  on the mailing list
> 
> Changes since v1: 
>  * Added acked-by 
>  * Fixed patch header
> 
>  
> 
>  net/netfilter/ipset/ip_set_list_set.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

The patch is applied in the ipset package tree. Thanks!
 
Best regards,
Jozsef
-
E-mail  : kadlec@...ckhole.kfki.hu, kadlecsik.jozsef@...ner.mta.hu
PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences
          H-1525 Budapest 114, POB. 49, Hungary
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists