Jeongjun Park bb6705c3f9 bpf: add check for invalid name in btf_name_valid_section()
If the length of the name string is 1 and the value of name[0] is NULL
byte, an OOB vulnerability occurs in btf_name_valid_section() and the
return value is true, so the invalid name passes the check.

To solve this, you need to check if the first position is NULL byte and
if the first character is printable.

Suggested-by: Eduard Zingerman <eddyz87@gmail.com>
Fixes: bd70a8fb7ca4 ("bpf: Allow all printable characters in BTF DATASEC names")
Signed-off-by: Jeongjun Park <aha310510@gmail.com>
Link: https://lore.kernel.org/r/20240831054702.364455-1-aha310510@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
2024-09-04 11:56:34 -07:00
..
2024-06-18 17:19:46 +02:00
2024-07-09 17:01:46 +02:00
2024-07-09 17:01:46 +02:00
2023-12-06 17:17:20 -08:00
2022-05-10 11:20:45 -07:00
2023-04-29 10:05:22 -07:00
2024-07-10 12:14:54 -07:00
2023-10-23 15:01:53 -07:00
2024-05-14 19:42:24 -07:00