Skip to content

Commit

Permalink
Detect cases where maps in symbol table and btf differ (microsoft#4193)
Browse files Browse the repository at this point in the history
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
  • Loading branch information
Alan-Jowett authored Feb 10, 2025
1 parent f1bc643 commit 0b8b2be
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libs/api/Verifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,11 @@ _parse_btf_map_info_and_populate_cache(const ELFIO::elfio& reader, const vector<

// For each map in map_names, find the corresponding map descriptor and cache the map handle.
for (auto& entry : map_names) {
uint32_t idx = (uint32_t)btf_map_name_to_index[entry.map_name];
auto btf_entry = btf_map_name_to_index.find(entry.map_name);
if (btf_entry == btf_map_name_to_index.end()) {
throw std::runtime_error(string("Map ") + entry.map_name + " not found.");
}
uint32_t idx = (uint32_t)btf_entry->second;
auto& btf_map_descriptor = btf_map_descriptors[idx];
// We temporarily stored BTF type ids in the descriptor's fd fields.
int btf_type_id = btf_map_descriptor.original_fd;
Expand Down

0 comments on commit 0b8b2be

Please sign in to comment.