Re: [RFC PATCH bpf-next 2/5] bpf: assign ID to vmlinux BTF and return extra info for BTF in GET_OBJ_INFO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 04, 2020 at 08:51:37PM -0800, Andrii Nakryiko wrote:
> @@ -215,6 +215,8 @@ struct btf {
>  	struct btf *base_btf;
>  	u32 start_id; /* first type ID in this BTF (0 for base BTF) */
>  	u32 start_str_off; /* first string offset (0 for base BTF) */
> +	char name[MODULE_NAME_LEN];
> +	bool kernel_btf;
>  };
>  
>  enum verifier_phase {
> @@ -4441,6 +4443,7 @@ struct btf *btf_parse_vmlinux(void)
>  
>  	btf->data = __start_BTF;
>  	btf->data_size = __stop_BTF - __start_BTF;
> +	btf->kernel_btf = true;

imo it's a bit weird for vmlinux's BTF to be flagged as 'kernel_btf'
and empty name, but kernel module's BTFs will not be marked as kernel,
but will have a name.
I think it's more natural to make vmlinux and module's BTF with kernel_btf=true flag
and give "vmlinux" name to base kernel BTF.
If somebody creates a kernel module with "vmlinux" name we will have a conflict,
but that name is for human pretty printing only anyway, so I think it's fine.



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux