Go to file
Hou Tao 3af43ba4c6 bpf: Pass map file to .map_update_batch directly
Currently bpf_map_do_batch() first invokes fdget(batch.map_fd) to get
the target map file, then it invokes generic_map_update_batch() to do
batch update. generic_map_update_batch() will get the target map file
by using fdget(batch.map_fd) again and pass it to bpf_map_update_value().

The problem is map file returned by the second fdget() may be NULL or a
totally different file compared by map file in bpf_map_do_batch(). The
reason is that the first fdget() only guarantees the liveness of struct
file instead of file descriptor and the file description may be released
by concurrent close() through pick_file().

It doesn't incur any problem as for now, because maps with batch update
support don't use map file in .map_fd_get_ptr() ops. But it is better to
fix the potential access of an invalid map file.

Using __bpf_map_get() again in generic_map_update_batch() can not fix
the problem, because batch.map_fd may be closed and reopened, and the
returned map file may be different with map file got in
bpf_map_do_batch(), so just passing the map file directly to
.map_update_batch() in bpf_map_do_batch().

Signed-off-by: Hou Tao <houtao1@huawei.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20221116075059.1551277-1-houtao@huaweicloud.com
2022-11-17 17:12:35 +01:00
Documentation bpf/docs: Include blank lines between bullet points in bpf_devel_QA.rst 2022-11-17 16:26:42 +01:00
LICENSES
arch net: remove skb->vlan_present 2022-11-11 18:18:05 -08:00
block
certs
crypto
drivers mlx5-updates-2022-11-12 2022-11-14 11:35:28 +00:00
fs
include bpf: Pass map file to .map_update_batch directly 2022-11-17 17:12:35 +01:00
init
io_uring
ipc
kernel bpf: Pass map file to .map_update_batch directly 2022-11-17 17:12:35 +01:00
lib net: remove skb->vlan_present 2022-11-11 18:18:05 -08:00
mm
net bpf: Expand map key argument of bpf_redirect_map to u64 2022-11-15 09:00:27 -08:00
rust
samples
scripts Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-11-10 17:43:53 -08:00
security
sound
tools selftests/bpf: fix memory leak of lsm_cgroup 2022-11-16 23:00:56 -08:00
usr
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
.rustfmt.toml
COPYING
CREDITS MAINTAINERS: Move Vivien to CREDITS 2022-11-10 13:53:53 -08:00
Kbuild
Kconfig
MAINTAINERS MAINTAINERS: update MEDIATEK ETHERNET entry 2022-11-11 08:09:32 +00:00
Makefile
README

README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.