History

bpf: fix partial copy of map_ptr when dst is scalar

ALU operations on pointers such as scalar_reg += map_value_ptr are handled in adjust_ptr_min_max_vals(). Problem is however that map_ptr and range in the register state share a union, so transferring state through dst_reg->range = ptr_reg->range is just buggy as any new map_ptr in the dst_reg is then truncated (or null) for subsequent checks. Fix this by adding a raw member and use it for copying state over to dst_reg.

Daniel Borkmann committed 8 years ago

Commit 09625901 parent 36153532 files · +9 −4Browse files

Showing the changes to include/linux (1 of 2 files). Show all

Unified · Split

include/linux/bpf_verifier.h+3−0
@@ -51,6 +51,9 @@ struct bpf_reg_state { · 50 unmodified lines
5151 * PTR_TO_MAP_VALUE_OR_NULL
5252 */
5353 struct bpf_map *map_ptr;
54+
55+ /* Max size from any of the above. */
56+ unsigned long raw;
5457 };
5558 /* Fixed part of pointer offset, pointer types only */
5659 s32 off;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t