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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1516722649.3478.15.camel@gmail.com>
Date:   Tue, 23 Jan 2018 07:50:49 -0800
From:   Eric Dumazet <eric.dumazet@...il.com>
To:     Yonghong Song <yhs@...com>, ast@...com, daniel@...earbox.net,
        netdev@...r.kernel.org
Cc:     kernel-team@...com
Subject: Re: [PATCH bpf-next] bpf: fix incorrect kmalloc usage in lpm_trie
 MAP_GET_NEXT_KEY rcu region

On Mon, 2018-01-22 at 22:53 -0800, Yonghong Song wrote:
> In commit b471f2f1de8b ("bpf: implement MAP_GET_NEXT_KEY command for LPM_TRIE map"),
> the implemented MAP_GET_NEXT_KEY callback function is guarded with rcu read lock.
> In the function body, "kmalloc(size, GFP_USER | __GFP_NOWARN)" is used which may
> sleep and violate rcu read lock region requirements. This patch fixed the issue
> by using GFP_ATOMIC instead to avoid blocking kmalloc. Tested with
> CONFIG_DEBUG_ATOMIC_SLEEP=y as suggested by Eric Dumazet.
> 
> Fixes: b471f2f1de8b ("bpf: implement MAP_GET_NEXT_KEY command for LPM_TRIE map")
> Signed-off-by: Yonghong Song <yhs@...com>


Reported-by: syzbot <syzkaller@...glegroups.com>
Reviewed-by: Eric Dumazet <edumazet@...gle.com>

Thanks.

> ---
>  kernel/bpf/lpm_trie.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/bpf/lpm_trie.c b/kernel/bpf/lpm_trie.c
> index d7ea962..8f083ea 100644
> --- a/kernel/bpf/lpm_trie.c
> +++ b/kernel/bpf/lpm_trie.c
> @@ -624,7 +624,7 @@ static int trie_get_next_key(struct bpf_map *map, void *_key, void *_next_key)
>  	}
>  
>  	node_stack = kmalloc(trie->max_prefixlen * sizeof(struct lpm_trie_node *),
> -			     GFP_USER | __GFP_NOWARN);
> +			     GFP_ATOMIC | __GFP_NOWARN);
>  	if (!node_stack)
>  		return -ENOMEM;
>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ