Thread (8 messages) 8 messages, 2 authors, 2021-01-12

Re: [PATCH bpf v2 2/3] bpf: local storage helpers should check nullness of owner ptr passed

From: Yonghong Song <hidden>
Date: 2021-01-12 07:26:52


On 1/11/21 1:23 PM, KP Singh 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

The report including the sample program and the steps for reproducing
the bug:

   https://lore.kernel.org/bpf/CANaYP3HWkH91SN=wTNO9FL_2ztHfqcXKX38SSE-JJ2voh+vssw@mail.gmail.com (local)

Fixes: 4cf1bc1f1045 ("bpf: Implement task local storage")
Fixes: 8ea636848aca ("bpf: Implement bpf_local_storage for inodes")
Reported-by: Gilad Reti <redacted>
Acked-by: Martin KaFai Lau <redacted>
Signed-off-by: KP Singh <kpsingh@kernel.org>
Acked-by: Yonghong Song <redacted>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help