On 10/30/24 4:15 AM, Xu Kuohai wrote:
From: Xu Kuohai <xukuohai@xxxxxxxxxx> Without kernel symbols for struct_ops trampoline, the unwinder may produce unexpected stacktraces. For example, the x86 ORC and FP unwinders check if an IP is in kernel text by verifying the presence of the IP's kernel symbol. When a struct_ops trampoline address is encountered, the unwinder stops due to the absence of symbol, resulting in an incomplete stacktrace that consists only of direct and indirect child functions called from the trampoline.
Please give some concrete examples here, e.g. stack trace before and after this patch, so it will be clear what is fixed.
The arm64 unwinder is another example. While the arm64 unwinder can proceed across a struct_ops trampoline address, the corresponding symbol name is displayed as "unknown", which is confusing. Thus, add kernel symbol for struct_ops trampoline. The name is bpf_trampoline_<PROG_NAME>, where PROG_NAME is the name of the struct_ops prog linked to the trampoline. Fixes: 85d33df357b6 ("bpf: Introduce BPF_MAP_TYPE_STRUCT_OPS") Signed-off-by: Xu Kuohai <xukuohai@xxxxxxxxxx>
There is a warning in kernel test bot, please fix it. Otherwise, the patch LGTM. I also tried with one struct_ops example and it does show full *good* stack with this patch, and without this patch, the backtrace stops right before trampoline symbols. Acked-by: Yonghong Song <yonghong.song@xxxxxxxxx>