lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAEf4BzZTdk=XhipybR3-y2G6OCLdn2diiwcricO2wcXTcwu6HQ@mail.gmail.com>
Date:   Mon, 25 Feb 2019 11:47:19 -0800
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Alexei Starovoitov <ast@...nel.org>
Cc:     davem@...emloft.net, Daniel Borkmann <daniel@...earbox.net>,
        edumazet@...gle.com, netdev@...r.kernel.org, bpf@...r.kernel.org,
        Kernel Team <kernel-team@...com>
Subject: Re: [PATCH v2 bpf-next 2/4] bpf: expose program stats via bpf_prog_info

On Sat, Feb 23, 2019 at 9:44 AM Alexei Starovoitov <ast@...nel.org> wrote:
>
> Return bpf program runtime and runcnt via bpf_prog_info
>
> Signed-off-by: Alexei Starovoitov <ast@...nel.org>
> ---
>  include/uapi/linux/bpf.h | 2 ++
>  kernel/bpf/syscall.c     | 5 +++++
>  2 files changed, 7 insertions(+)
>
> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> index bcdd2474eee7..d2cb85d85b39 100644
> --- a/include/uapi/linux/bpf.h
> +++ b/include/uapi/linux/bpf.h
> @@ -2813,6 +2813,8 @@ struct bpf_prog_info {
>         __u32 jited_line_info_rec_size;
>         __u32 nr_prog_tags;
>         __aligned_u64 prog_tags;
> +       __u64 runtime;
> +       __u64 runcnt;
>  } __attribute__((aligned(8)));
>
>  struct bpf_map_info {
> diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
> index 9a8c990c5df4..3405e0a4cf77 100644
> --- a/kernel/bpf/syscall.c
> +++ b/kernel/bpf/syscall.c
> @@ -2152,6 +2152,7 @@ static int bpf_prog_get_info_by_fd(struct bpf_prog *prog,
>         struct bpf_prog_info __user *uinfo = u64_to_user_ptr(attr->info.info);
>         struct bpf_prog_info info = {};
>         u32 info_len = attr->info.info_len;
> +       struct bpf_prog_stats stats;
>         char __user *uinsns;
>         u32 ulen;
>         int err;
> @@ -2191,6 +2192,10 @@ static int bpf_prog_get_info_by_fd(struct bpf_prog *prog,
>         if (err)
>                 return err;
>
> +       bpf_prog_get_stats(prog, &stats);
> +       info.runtime = stats.nsecs;
> +       info.runcnt = stats.cnt;
> +

lgtm, but see naming discussion in other thread.

Acked-by: Andrii Nakryiko <andriin@...com>

>         if (!capable(CAP_SYS_ADMIN)) {
>                 info.jited_prog_len = 0;
>                 info.xlated_prog_len = 0;
> --
> 2.20.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ