mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yonghong Song <yhs@fb.com>
To: Aditya Pakki <pakki001@umn.edu>
Cc: "kjlu@umn.edu" <kjlu@umn.edu>,
	Alexei Starovoitov <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	Martin Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
	Andrii Nakryiko <andriin@fb.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] bpf: Replace BUG_ON when fp_old is NULL
Date: Sun, 15 Dec 2019 22:08:08 +0000	[thread overview]
Message-ID: <98c13b9c-a73a-6203-4ea1-6b1180d87d97@fb.com> (raw)
In-Reply-To: <20191215154432.22399-1-pakki001@umn.edu>



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@umn.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;
> 

  reply	other threads:[~2019-12-15 22:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-15 15:44 Aditya Pakki
2019-12-15 22:08 ` Yonghong Song [this message]
2019-12-16 11:17   ` Daniel Borkmann
2019-12-19 17:39     ` Aditya Pakki
2019-12-19 17:48       ` Daniel Borkmann
2019-12-16  4:49 ` Alexei Starovoitov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=98c13b9c-a73a-6203-4ea1-6b1180d87d97@fb.com \
    --to=yhs@fb.com \
    --cc=andriin@fb.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kafai@fb.com \
    --cc=kjlu@umn.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pakki001@umn.edu \
    --cc=songliubraving@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®