[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <98c13b9c-a73a-6203-4ea1-6b1180d87d97@fb.com>
Date: Sun, 15 Dec 2019 22:08:08 +0000
From: Yonghong Song <yhs@...com>
To: Aditya Pakki <pakki001@....edu>
CC: "kjlu@....edu" <kjlu@....edu>, Alexei Starovoitov <ast@...nel.org>,
"Daniel Borkmann" <daniel@...earbox.net>,
Martin Lau <kafai@...com>, Song Liu <songliubraving@...com>,
Andrii Nakryiko <andriin@...com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"bpf@...r.kernel.org" <bpf@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] bpf: Replace BUG_ON when fp_old is NULL
On 12/15/19 7:44 AM, Aditya Pakki wrote:
> If fp_old is NULL in bpf_prog_realloc, the program does an assertion
> and crashes. However, we can continue execution by returning NULL to
> the upper callers. The patch fixes this issue.
Could you share how to reproduce the assertion and crash? I would
like to understand the problem first before making changes in the code.
Thanks!
>
> Signed-off-by: Aditya Pakki <pakki001@....edu>
> ---
> kernel/bpf/core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
> index 49e32acad7d8..4b46654fb26b 100644
> --- a/kernel/bpf/core.c
> +++ b/kernel/bpf/core.c
> @@ -222,7 +222,8 @@ struct bpf_prog *bpf_prog_realloc(struct bpf_prog *fp_old, unsigned int size,
> u32 pages, delta;
> int ret;
>
> - BUG_ON(fp_old == NULL);
> + if (!fp_old)
> + return NULL;
>
> size = round_up(size, PAGE_SIZE);
> pages = size / PAGE_SIZE;
>
Powered by blists - more mailing lists