}
END_BPF_CMD_DECODER(RVAL_DECODED)
+BEGIN_BPF_CMD_DECODER(BPF_BTF_LOAD)
+{
+ tprints("{btf=");
+ print_big_u64_addr(attr.btf);
+ printstrn(tcp, attr.btf, attr.btf_size);
+ PRINT_FIELD_ADDR64(", ", attr, btf_log_buf);
+ PRINT_FIELD_U(", ", attr, btf_size);
+ PRINT_FIELD_U(", ", attr, btf_log_size);
+ PRINT_FIELD_U(", ", attr, btf_log_level);
+}
+END_BPF_CMD_DECODER(RVAL_DECODED | RVAL_FD)
+
SYS_FUNC(bpf)
{
static const bpf_cmd_decoder_t bpf_cmd_decoders[] = {
BPF_CMD_ENTRY(BPF_OBJ_GET_INFO_BY_FD),
BPF_CMD_ENTRY(BPF_PROG_QUERY),
BPF_CMD_ENTRY(BPF_RAW_TRACEPOINT_OPEN),
+ BPF_CMD_ENTRY(BPF_BTF_LOAD),
};
const unsigned int cmd = tcp->u_arg[0];
offsetofend(struct BPF_RAW_TRACEPOINT_OPEN_struct, prog_fd)
# define expected_BPF_RAW_TRACEPOINT_OPEN_struct_size 12
+struct BPF_BTF_LOAD_struct {
+ uint64_t ATTRIBUTE_ALIGNED(8) btf;
+ uint64_t ATTRIBUTE_ALIGNED(8) btf_log_buf;
+ uint32_t btf_size;
+ uint32_t btf_log_size;
+ uint32_t btf_log_level;
+};
+
+# define BPF_BTF_LOAD_struct_size \
+ offsetofend(struct BPF_BTF_LOAD_struct, btf_log_level)
+# define expected_BPF_BTF_LOAD_struct_size 28
+
struct bpf_map_info_struct {
uint32_t type;
uint32_t id;
BPF_ATTR_DATA_FIELD(BPF_OBJ_GET_INFO_BY_FD);
BPF_ATTR_DATA_FIELD(BPF_PROG_QUERY);
BPF_ATTR_DATA_FIELD(BPF_RAW_TRACEPOINT_OPEN);
+ BPF_ATTR_DATA_FIELD(BPF_BTF_LOAD);
char char_data[256];
};
}
};
+static void
+init_BPF_BTF_LOAD_attr(struct bpf_attr_check *check)
+{
+ static const char sample_btf_data[] = "bPf\0daTum";
+
+ static char *btf_data;
+ if (!btf_data)
+ btf_data = tail_memdup(sample_btf_data,
+ sizeof(sample_btf_data) - 1);
+
+ struct BPF_BTF_LOAD_struct *attr = &check->data.BPF_BTF_LOAD_data;
+ attr->btf = (uintptr_t) btf_data;
+}
+
+static struct bpf_attr_check BPF_BTF_LOAD_checks[] = {
+ {
+ .data = { .BPF_BTF_LOAD_data = { .btf = 0 } },
+ .size = offsetofend(struct BPF_BTF_LOAD_struct, btf),
+ .str = "btf=NULL, btf_log_buf=NULL, btf_size=0"
+ ", btf_log_size=0, btf_log_level=0"
+ },
+ { /* 1 */
+ .data = { .BPF_BTF_LOAD_data = {
+ .btf_log_buf = 0xfacefeeddeadbeefULL,
+ .btf_size = 9,
+ .btf_log_size = -1U,
+ .btf_log_level = 42
+ } },
+ .size = offsetofend(struct BPF_BTF_LOAD_struct, btf_log_level),
+ .init_fn = init_BPF_BTF_LOAD_attr,
+ .str = "btf=\"bPf\\0daTum\""
+ ", btf_log_buf=0xfacefeeddeadbeef"
+ ", btf_size=9"
+ ", btf_log_size=4294967295"
+ ", btf_log_level=42"
+ }
+};
+
#define CHK(cmd_) \
{ \
CHK(BPF_OBJ_GET_INFO_BY_FD),
CHK(BPF_PROG_QUERY),
CHK(BPF_RAW_TRACEPOINT_OPEN),
+ CHK(BPF_BTF_LOAD),
};
page_size = get_page_size();