From: Kumar Kartikeya Dwivedi Date: Mon, 8 Jun 2026 11:31:52 +0000 (+0200) Subject: Merge branch 'keep-dynamic-inner-array-lookups-nullable' X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=af5cb68eed4030823c0940ad4b7e3d3b6a316b45;p=thirdparty%2Flinux.git Merge branch 'keep-dynamic-inner-array-lookups-nullable' Nuoqi Gui says: ==================== Keep dynamic inner array lookups nullable An ARRAY_OF_MAPS can use an array created with BPF_F_INNER_MAP as its inner map template. The flag allows a concrete inner array with a different max_entries value to replace the template. The verifier currently uses the template's max_entries to elide nullness for a constant-key lookup through the inner map pointer. At runtime, the lookup uses the concrete inner array's max_entries instead. The verifier can therefore accept an unchecked dereference even though the runtime helper returns NULL. Patch 1 keeps lookups through BPF_F_INNER_MAP array templates nullable. Patch 2 adds a verifier regression test for the unchecked dereference. Before the fix, the regression program is accepted and the runtime reproducer triggers a NULL dereference. With the fix, both programs are rejected with an invalid map_value_or_null access. Tested by compiling kernel/bpf/verifier.o and verifier_map_in_map.bpf.o, and by running the regression program and runtime reproducer in QEMU before and after the fix. Signed-off-by: Nuoqi Gui Acked-by: Jiri Olsa --- v1->v2: - Update the can_elide_value_nullness() comment to match the changed parameter (const struct bpf_map *map). v1: https://patch.msgid.link/20260604151153.2488051-1-gnq25@mails.tsinghua.edu.cn To: Alexei Starovoitov To: Daniel Borkmann To: Andrii Nakryiko Cc: Daniel Xu Cc: Eduard Zingerman Cc: John Fastabend Cc: Martin KaFai Lau Cc: Kumar Kartikeya Dwivedi Cc: Song Liu Cc: Yonghong Song Cc: Jiri Olsa Cc: Shuah Khan Cc: Ihor Solodrai Cc: bpf@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-kselftest@vger.kernel.org --- ==================== Link: https://patch.msgid.link/20260607-f01-v2-v2-0-da48453146e8@mails.tsinghua.edu.cn Signed-off-by: Kumar Kartikeya Dwivedi --- af5cb68eed4030823c0940ad4b7e3d3b6a316b45