All of lore.kernel.org
 help / color / mirror / Atom feed
From: KP Singh <kpsingh@kernel.org>
To: Daniel Borkmann <daniel@iogearbox.net>
Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>,
	bpf <bpf@vger.kernel.org>, Gilad Reti <gilad.reti@gmail.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <kafai@fb.com>
Subject: Re: [PATCH bpf] bpf: local storage helpers should check nullness of owner ptr passed
Date: Mon, 11 Jan 2021 18:19:31 +0100	[thread overview]
Message-ID: <CACYkzJ4_J=A9mDnaxZhNtDYSawW8g5cqfKHHVQjD-MmF89Q=nw@mail.gmail.com> (raw)
In-Reply-To: <281d55ae-984d-5a40-e0be-3a3480564379@iogearbox.net>

On Mon, Jan 11, 2021 at 3:07 PM Daniel Borkmann <daniel@iogearbox.net> wrote:
>
> On 1/7/21 9:25 PM, KP Singh wrote:
> > On Thu, Jan 7, 2021 at 8:15 PM Andrii Nakryiko
> > <andrii.nakryiko@gmail.com> wrote:
> >> On Thu, Jan 7, 2021 at 11:07 AM Andrii Nakryiko
> >> <andrii.nakryiko@gmail.com> wrote:
> >>> On Thu, Jan 7, 2021 at 9:37 AM KP Singh <kpsingh@kernel.org> wrote:
> >>>>
> >>>> The verifier allows ARG_PTR_TO_BTF_ID helper arguments to be NULL, so
> >>>> helper implementations need to check this before dereferencing them.
> >>>> This was already fixed for the socket storage helpers but not for task
> >>>> and inode.
> >>>>
> >>>> The issue can be reproduced by attaching an LSM program to
> >>>> inode_rename hook (called when moving files) which tries to get the
> >>>> inode of the new file without checking for its nullness and then trying
> >>>> to move an existing file to a new path:
> >>>>
> >>>>    mv existing_file new_file_does_not_exist
> >>>
> >>> Seems like it's simple to write a selftest for this then?
> >
> > Sure, I will send in a separate patch for selftest and also for the typo.
>
> If it's small or trivial to add a selftest for the fix, I'd suggest to add it
> as part of this series for 'ease of logistics' as it would otherwise be a bit
> odd to i) either have a stand-alone patch against bpf tree with just a selftest
> or ii) having to wait until bpf syncs into bpf-next and then send one against
> bpf-next where for the latter there's risk that it gets forgotten in meantime
> as it might take a while.

Sounds good, I completely missed the fact the fix would take some time to
sync from bpf to bpf-next and until then the selftest will keep crashing.

I updated the selftest and will send in a v2 and while we are at it,
will also fix
the typo Andrii found.

- KP

>
> Thanks,
> Daniel

  reply	other threads:[~2021-01-11 17:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-07 17:37 [PATCH bpf] bpf: local storage helpers should check nullness of owner ptr passed KP Singh
2021-01-07 19:07 ` Andrii Nakryiko
2021-01-07 19:15   ` Andrii Nakryiko
2021-01-07 20:25     ` KP Singh
2021-01-11 14:06       ` Daniel Borkmann
2021-01-11 17:19         ` KP Singh [this message]
2021-01-07 19:11 ` Martin KaFai Lau

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='CACYkzJ4_J=A9mDnaxZhNtDYSawW8g5cqfKHHVQjD-MmF89Q=nw@mail.gmail.com' \
    --to=kpsingh@kernel.org \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=gilad.reti@gmail.com \
    --cc=kafai@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.