Fix kconfig symbol address

pull/1017/merge^2
Davide Bertola 4 months ago
parent 41a2461756
commit a723cfa22d

@ -889,8 +889,8 @@ impl Object {
section_data.resize((symbol.address - offset) as usize, 0);
self.symbol_offset_by_name.insert(name, symbol.address);
offset = symbol.address + section_data.len() as u64;
section_data.extend(data);
offset = symbol.address + data.len() as u64;
} else {
return Err(BtfError::ExternalSymbolNotFound { symbol_name: name });
}

@ -3,11 +3,24 @@
#include <bpf/bpf_helpers.h>
// clang-format on
// CONFIG_BPF=y => 1
extern unsigned int CONFIG_BPF __kconfig;
// CONFIG_PANIC_TIMEOUT=0 => 0
extern unsigned int CONFIG_PANIC_TIMEOUT __kconfig;
// CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=120
extern unsigned int CONFIG_DEFAULT_HUNG_TASK_TIMEOUT __kconfig;
SEC("xdp")
int kconfig(struct xdp_md *ctx) {
if (!CONFIG_BPF) {
if (CONFIG_BPF != 1) {
return XDP_DROP;
}
if (CONFIG_PANIC_TIMEOUT != 0) {
return XDP_DROP;
}
if (CONFIG_DEFAULT_HUNG_TASK_TIMEOUT != 120) {
return XDP_DROP;
}

Loading…
Cancel
Save