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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4Bza_8d_K22DFRzGHYAQdz_y1+9b_bfSc0t0EkdM4nyy7Hw@mail.gmail.com>
Date:   Mon, 25 Apr 2022 23:45:26 -0700
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Yafang Shao <laoar.shao@...il.com>
Cc:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>, Martin Lau <kafai@...com>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
        john fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...nel.org>,
        Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>
Subject: Re: [PATCH bpf-next 1/4] libbpf: Define DEFAULT_BPFFS

On Sat, Apr 23, 2022 at 7:01 AM Yafang Shao <laoar.shao@...il.com> wrote:
>
> Let's use a macro DEFAULT_BPFFS instead of the hard-coded "/sys/fs/bpf".
>
> Signed-off-by: Yafang Shao <laoar.shao@...il.com>
> ---
>  tools/lib/bpf/bpf_helpers.h | 2 +-
>  tools/lib/bpf/libbpf.c      | 2 +-
>  tools/lib/bpf/libbpf.h      | 6 ++++--
>  3 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/tools/lib/bpf/bpf_helpers.h b/tools/lib/bpf/bpf_helpers.h
> index 44df982d2a5c..9161ebcd3466 100644
> --- a/tools/lib/bpf/bpf_helpers.h
> +++ b/tools/lib/bpf/bpf_helpers.h
> @@ -137,7 +137,7 @@ struct bpf_map_def {
>
>  enum libbpf_pin_type {
>         LIBBPF_PIN_NONE,
> -       /* PIN_BY_NAME: pin maps by name (in /sys/fs/bpf by default) */
> +       /* PIN_BY_NAME: pin maps by name (in DEFAULT_BPFFS by default) */

how is this improving things? now I need to grep some more to find out
what's the value of DEFAULT_BPFFS is


>         LIBBPF_PIN_BY_NAME,
>  };
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index 9a213aaaac8a..13fcf91e9e0e 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -2180,7 +2180,7 @@ static int build_map_pin_path(struct bpf_map *map, const char *path)
>         int len;
>
>         if (!path)
> -               path = "/sys/fs/bpf";
> +               path = DEFAULT_BPFFS;
>
>         len = snprintf(buf, PATH_MAX, "%s/%s", path, bpf_map__name(map));
>         if (len < 0)
> diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
> index cdbfee60ea3e..3784867811a4 100644
> --- a/tools/lib/bpf/libbpf.h
> +++ b/tools/lib/bpf/libbpf.h
> @@ -28,6 +28,8 @@ LIBBPF_API __u32 libbpf_major_version(void);
>  LIBBPF_API __u32 libbpf_minor_version(void);
>  LIBBPF_API const char *libbpf_version_string(void);
>
> +#define DEFAULT_BPFFS "/sys/fs/bpf"
> +
>  enum libbpf_errno {
>         __LIBBPF_ERRNO__START = 4000,
>
> @@ -91,7 +93,7 @@ struct bpf_object_open_opts {
>         bool relaxed_core_relocs;
>         /* maps that set the 'pinning' attribute in their definition will have
>          * their pin_path attribute set to a file in this directory, and be
> -        * auto-pinned to that path on load; defaults to "/sys/fs/bpf".
> +        * auto-pinned to that path on load; defaults to DEFAULT_BPFFS.
>          */
>         const char *pin_root_path;
>
> @@ -190,7 +192,7 @@ bpf_object__open_xattr(struct bpf_object_open_attr *attr);
>
>  enum libbpf_pin_type {
>         LIBBPF_PIN_NONE,
> -       /* PIN_BY_NAME: pin maps by name (in /sys/fs/bpf by default) */
> +       /* PIN_BY_NAME: pin maps by name (in DEFAULT_BPFFS by default) */
>         LIBBPF_PIN_BY_NAME,
>  };
>
> --
> 2.17.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ