lkml.org 
[lkml]   [2019]   [Dec]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH bpf-next v1 04/13] bpf: lsm: Allow btf_id based attachment for LSM hooks
On Fri, Dec 20, 2019 at 7:42 AM KP Singh <kpsingh@chromium.org> wrote:
>
> From: KP Singh <kpsingh@google.com>
>
> Refactor and re-use most of the logic for BPF_PROG_TYPE_TRACING with a few
> changes.
>
> - The LSM hook BTF types are prefixed with "lsm_btf_"

btf_trace_ and btf_struct_ops all have btf_ first, let's keep this consistent.

> - These types do not need the first (void *) pointer argument. The verifier
> only looks for this argument if prod->aux->attach_btf_trace is set.
>
> Signed-off-by: KP Singh <kpsingh@google.com>
> ---
> kernel/bpf/syscall.c | 1 +
> kernel/bpf/verifier.c | 83 ++++++++++++++++++++++++++++++++++++++++---
> 2 files changed, 80 insertions(+), 4 deletions(-)
>

[...]

> +
> + t = btf_type_by_id(btf_vmlinux, btf_id);
> + if (!t) {
> + verbose(env, "attach_btf_id %u is invalid\n", btf_id);
> + return -EINVAL;
> + }
> +
> + tname = btf_name_by_offset(btf_vmlinux, t->name_off);
> + if (!tname) {

it can be empty, so better: !tname || !tname[0]

> + verbose(env, "attach_btf_id %u doesn't have a name\n", btf_id);
> + return -EINVAL;
> + }
> +

[...]

\
 
 \ /
  Last update: 2019-12-24 00:55    [W:0.320 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site