Summary: | Valgrind crash with "impossible happened" when running BPF CO-RE programs | ||
---|---|---|---|
Product: | [Developer tools] valgrind | Reporter: | Luka Oreskovic <luka.oreskovic> |
Component: | general | Assignee: | Mark Wielaard <mark> |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | andreas, mark, pjfloyd |
Priority: | NOR | ||
Version: | 3.15 SVN | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: |
The complete output generated when running "opensnoop" example with valgrind -v flag
Implement BPF_MAP_LOOKUP_AND_DELETE_ELEM and BPF_MAP_FREEZE |
Description
Luka Oreskovic
2020-09-03 15:10:52 UTC
eBPF command 22 is BPF_MAP_FREEZE. valgrind currently handle eBPF commands up to 20 (BPF_TASK_FD_QUERY), it doesn't yet handle some newer commands: BPF_MAP_LOOKUP_AND_DELETE_ELEM, /* 21 */ BPF_MAP_FREEZE, BPF_BTF_GET_NEXT_ID, BPF_MAP_LOOKUP_BATCH, BPF_MAP_LOOKUP_AND_DELETE_BATCH, BPF_MAP_UPDATE_BATCH, BPF_MAP_DELETE_BATCH, BPF_LINK_CREATE, BPF_LINK_UPDATE, BPF_LINK_GET_FD_BY_ID, BPF_LINK_GET_NEXT_ID, BPF_ENABLE_STATS, BPF_ITER_CREATE, BPF_LINK_DETACH, How to reproduce on Fedora 34: $ dnf install -y git clang llvm elfutils-libelf-devel zlib-devel valgrind $ git clone --recursive https://github.com/iovisor/bcc.git $ cd bcc/libbpf-tools && make $ valgrind ./opensnoop Created attachment 142314 [details]
Implement BPF_MAP_LOOKUP_AND_DELETE_ELEM and BPF_MAP_FREEZE
Implements BPF_MAP_LOOKUP_AND_DELETE_ELEM (command 20) and BPF_MAP_FREEZE (command 21) and produces a WARNING instead of a fatal error for unrecognized BPF commands.
This does not fully solve the issue with opensnoop, that will still report WARNINGS, but will no longer crash under valgrind:
==3618029== Command: ./opensnoop
==3618029==
--3618029-- WARNING: unhandled eBPF command 35
--3618029-- WARNING: unhandled eBPF command 35
--3618029-- WARNING: unhandled eBPF command 35
--3618029-- WARNING: unhandled eBPF command 35
--3618029-- WARNING: unhandled eBPF command 35
--3618029-- WARNING: unhandled eBPF command 35
--3618029-- WARNING: unhandled eBPF command 35
--3618029-- WARNING: unhandled eBPF command 35
--3618029-- WARNING: unhandled eBPF command 35
--3618029-- WARNING: unhandled eBPF command 35
--3618029-- WARNING: unhandled eBPF command 28
PID COMM FD ERR PATH
I am closing this now because the reported eBPF command has been implemented. But please feel free to open new bugs for other missing eBPF commands. commit ef95220ddae1af65c85d8d59a8f0dcbb9d7af90f Author: Mark Wielaard <mark@klomp.org> Date: Tue Oct 12 23:15:41 2021 +0200 Implement BPF_MAP_LOOKUP_AND_DELETE_ELEM and BPF_MAP_FREEZE Implement BPF_MAP_LOOKUP_AND_DELETE_ELEM (command 21) and BPF_MAP_FREEZE (command 22) and produce a WARNING instead of a fatal error for unrecognized BPF commands. https://bugs.kde.org/show_bug.cgi?id=426148 |