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]
Message-ID: <d4bed569-d448-8b59-0774-c036e4c9abe9@iogearbox.net>
Date:   Tue, 1 Mar 2022 17:28:19 +0100
From:   Daniel Borkmann <daniel@...earbox.net>
To:     Dongliang Mu <dzm91@...t.edu.cn>,
        Alexei Starovoitov <ast@...nel.org>,
        Andrii Nakryiko <andrii@...nel.org>,
        Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...nel.org>
Cc:     Dongliang Mu <mudongliangabcd@...il.com>,
        syzkaller <syzkaller@...glegroups.com>, netdev@...r.kernel.org,
        bpf@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] bpf: cgroup: remove WARN_ON at bpf_cgroup_link_release

On 2/27/22 2:40 PM, Dongliang Mu wrote:
> From: Dongliang Mu <mudongliangabcd@...il.com>
> 
> When syzkaller injects fault into memory allocation at
> bpf_prog_array_alloc, the kernel encounters a memory failure and
> returns non-zero, thus leading to one WARN_ON at
> bpf_cgroup_link_release. The stack trace is as follows:
> 
>   __kmalloc+0x7e/0x3d0
>   bpf_prog_array_alloc+0x4f/0x60
>   compute_effective_progs+0x132/0x580
>   ? __sanitizer_cov_trace_pc+0x1a/0x40
>   update_effective_progs+0x5e/0x260
>   __cgroup_bpf_detach+0x293/0x760
>   bpf_cgroup_link_release+0xad/0x400
>   bpf_link_free+0xca/0x190
>   bpf_link_put+0x161/0x1b0
>   bpf_link_release+0x33/0x40
>   __fput+0x286/0x9f0
> 
> Fix this by removing the WARN_ON for __cgroup_bpf_detach.
> 
> Reported-by: syzkaller <syzkaller@...glegroups.com>
> Signed-off-by: Dongliang Mu <mudongliangabcd@...il.com>
> ---
>   kernel/bpf/cgroup.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c
> index 514b4681a90a..fdbdcee6c9fa 100644
> --- a/kernel/bpf/cgroup.c
> +++ b/kernel/bpf/cgroup.c
> @@ -896,8 +896,8 @@ static void bpf_cgroup_link_release(struct bpf_link *link)
>   		return;
>   	}
>   
> -	WARN_ON(__cgroup_bpf_detach(cg_link->cgroup, NULL, cg_link,
> -				    cg_link->type));
> +	__cgroup_bpf_detach(cg_link->cgroup, NULL, cg_link,
> +				    cg_link->type);

"Fixing" by removing WARN_ON is just papering over the issue which in this case as
mentioned is allocation failure on detach/teardown when allocating and recomputing
effective prog arrays..

>   	cg = cg_link->cgroup;
>   	cg_link->cgroup = NULL;
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ