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]
Date:   Thu, 19 Jan 2017 15:56:48 -0800
From:   Joe Stringer <joe@....org>
To:     "Wangnan (F)" <wangnan0@...wei.com>
Cc:     LKML <linux-kernel@...r.kernel.org>, ast@...com,
        Daniel Borkmann <daniel@...earbox.net>,
        Arnaldo Carvalho de Melo <acme@...nel.org>
Subject: Re: [PATCH perf/core 6/6] tools lib bpf: Add bpf_object__pin()

On 19 January 2017 at 02:22, Wangnan (F) <wangnan0@...wei.com> wrote:
>
>
> On 2017/1/19 7:57, Joe Stringer wrote:
>>
>> Add a new API to pin a BPF object to the filesystem. The user can
>> specify a subdirectory under the BPF filesystem to pin these programs.
>>
>> For example, with the subdirectory 'foo', programs and maps are pinned:
>> /sys/fs/bpf/foo/progs/PROG_NAME
>> /sys/fs/bpf/foo/maps/MAP_NAME
>>
>> If the user has specified an alternative BPF filesystem mountpoint via
>> /proc/mounts, that will be read and used instead.
>>
>> Signed-off-by: Joe Stringer <joe@....org>
>> ---
>>   tools/lib/bpf/libbpf.c | 136
>> +++++++++++++++++++++++++++++++++++++++++++++++++
>>   tools/lib/bpf/libbpf.h |   1 +
>>   2 files changed, 137 insertions(+)
>>
>> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
>> index 6b651c19870d..181dca0bdacb 100644
>> --- a/tools/lib/bpf/libbpf.c
>> +++ b/tools/lib/bpf/libbpf.c
>> @@ -4,6 +4,7 @@
>>    * Copyright (C) 2013-2015 Alexei Starovoitov <ast@...nel.org>
>>    * Copyright (C) 2015 Wang Nan <wangnan0@...wei.com>
>>    * Copyright (C) 2015 Huawei Inc.
>> + * Copyright (C) 2016 Nicira, Inc.
>>    *
>>    * This program is free software; you can redistribute it and/or
>>    * modify it under the terms of the GNU Lesser General Public
>> @@ -31,7 +32,12 @@
>>   #include <linux/err.h>
>>   #include <linux/kernel.h>
>>   #include <linux/bpf.h>
>> +#include <linux/magic.h>
>>   #include <linux/list.h>
>> +#include <linux/limits.h>
>> +#include <sys/mount.h>
>> +#include <sys/stat.h>
>> +#include <sys/vfs.h>
>>   #include <libelf.h>
>>   #include <gelf.h>
>>   @@ -1231,6 +1237,136 @@ int bpf_object__load(struct bpf_object *obj)
>>         return err;
>>   }
>>   +#define stringize(x) #x
>> +
>> +static int mount_bpf(char *path)
>
>
> We can use tools/lib/api/fs/fs.c to help us mounting filesystems.
> Try not reinventing it.

libbpf is LGPL2.1 and libapi doesn't state a license.

Instead, maybe I'll just drop this piece - libbpf user can mount the
filesystem (using libapi or something else) and provide fully
qualified path to bpf_{map,program}__pin().

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ