Yuntao Wang
e804587ecd
bpf: Fix incorrect memory charge cost calculation in stack_map_alloc()
...
commit b45043192b3e481304062938a6561da2ceea46a6 upstream.
This is a backport of the original upstream patch for 5.4/5.10.
The original upstream patch has been applied to 5.4/5.10 branches, which
simply removed the line:
cost += n_buckets * (value_size + sizeof(struct stack_map_bucket));
This is correct for upstream branch but incorrect for 5.4/5.10 branches,
as the 5.4/5.10 branches do not have the commit 370868107bf6 ("bpf:
Eliminate rlimit-based memory accounting for stackmap maps"), so the
bpf_map_charge_init() function has not been removed.
Currently the bpf_map_charge_init() function in 5.4/5.10 branches takes a
wrong memory charge cost, the
attr->max_entries * (sizeof(struct stack_map_bucket) + (u64)value_size))
part is missing, let's fix it.
Cc: <[email protected] > # 5.4.y
Cc: <[email protected] > # 5.10.y
Signed-off-by: Yuntao Wang <[email protected] >
Signed-off-by: Greg Kroah-Hartman <[email protected] >
2022-06-22 14:11:02 +02:00
..
arraymap.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
2019-06-17 20:20:36 -07:00
bpf_lru_list.c
bpf_lru_list: Read double-checked variable once without lock
2021-03-04 10:26:16 +01:00
bpf_lru_list.h
treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206
2019-05-30 11:29:53 -07:00
btf.c
bpf: Explicitly memset some bpf info structures declared on the stack
2020-04-02 15:11:01 +02:00
cgroup.c
bpf, cgroup: Fix problematic bounds check
2021-02-10 09:25:27 +01:00
core.c
bpf: Prevent increasing bpf_jit_limit above max
2021-11-17 09:48:20 +01:00
cpumap.c
cpumap: Avoid warning when CONFIG_DEBUG_PER_CPU_MAPS is enabled
2020-05-02 08:48:51 +02:00
devmap.c
bpf: Fix integer overflow in argument calculation for bpf_map_area_alloc
2021-12-17 10:12:24 +01:00
disasm.c
bpf: Introduce BPF nospec instruction for mitigating Spectre v4
2021-09-15 09:47:38 +02:00
disasm.h
treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 295
2019-06-05 17:36:38 +02:00
hashtab.c
bpf: Zero-fill re-used per-cpu map element
2020-11-18 19:20:26 +01:00
helpers.c
bpf: Fix helper bpf_map_peek_elem_proto pointing to wrong callback
2021-01-23 15:57:56 +01:00
inode.c
bpf: Fix a rcu warning for bpffs map pretty-print
2020-10-01 13:18:19 +02:00
local_storage.c
bpf: move memory size checks to bpf_map_charge_init()
2019-05-31 16:52:56 -07:00
lpm_trie.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
2019-06-22 08:59:24 -04:00
Makefile
bpf: Don't rely on GCC __attribute__((optimize)) to disable GCSE
2020-11-18 19:20:26 +01:00
map_in_map.c
treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206
2019-05-30 11:29:53 -07:00
map_in_map.h
treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206
2019-05-30 11:29:53 -07:00
offload.c
bpf, offload: Replace bitwise AND by logical AND in bpf_prog_offload_info_fill
2020-02-28 17:22:27 +01:00
percpu_freelist.c
treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206
2019-05-30 11:29:53 -07:00
percpu_freelist.h
treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206
2019-05-30 11:29:53 -07:00
queue_stack_maps.c
bpf: move memory size checks to bpf_map_charge_init()
2019-05-31 16:52:56 -07:00
reuseport_array.c
bpf: move memory size checks to bpf_map_charge_init()
2019-05-31 16:52:56 -07:00
stackmap.c
bpf: Fix incorrect memory charge cost calculation in stack_map_alloc()
2022-06-22 14:11:02 +02:00
syscall.c
bpf: Add kconfig knob for disabling unpriv bpf by default
2022-02-16 12:52:49 +01:00
sysfs_btf.c
bpf: Fix sysfs export of empty BTF section
2020-10-14 10:32:58 +02:00
tnum.c
bpf: Fix incorrect verifier simulation of ARSH under ALU32
2020-01-23 08:22:44 +01:00
verifier.c
bpf: Fix the off-by-two error in range markings
2021-12-14 14:48:59 +01:00
xskmap.c
bpf/xskmap: Return ERR_PTR for failure case instead of NULL.
2019-09-25 22:14:16 +02:00