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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <063cb81c-a1b7-3893-792e-280adb6a0f33@gmail.com>
Date:   Mon, 26 Oct 2020 09:15:00 -0600
From:   David Ahern <dsahern@...il.com>
To:     Hangbin Liu <haliu@...hat.com>
Cc:     Toke Høiland-Jørgensen <toke@...hat.com>,
        Stephen Hemminger <stephen@...workplumber.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Alexei Starovoitov <ast@...nel.org>,
        Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
        David Miller <davem@...emloft.net>,
        Jesper Dangaard Brouer <brouer@...hat.com>,
        netdev@...r.kernel.org, bpf@...r.kernel.org,
        Jiri Benc <jbenc@...hat.com>,
        Andrii Nakryiko <andrii@...nel.org>
Subject: Re: [PATCH iproute2-next 3/5] lib: add libbpf support

On 10/26/20 2:56 AM, Hangbin Liu wrote:
> 
> Hi David,
> 
> On Sun, Oct 25, 2020 at 04:12:34PM -0600, David Ahern wrote:
>> On 10/25/20 9:13 AM, Toke Høiland-Jørgensen wrote:
>>> David Ahern <dsahern@...il.com> writes:
>>>
>>>> On 10/22/20 9:38 PM, Hangbin Liu wrote:
>>>>> Note: ip/ipvrf.c is not convert to use libbpf as it only encodes a few
>>>>> instructions and load directly.
>>>>
>>>> for completeness, libbpf should be able to load a program from a buffer
>>>> as well.
>>>
>>> It can, but the particular use in ipvrf is just loading half a dozen
>>> instructions defined inline in C - there's no object files, BTF or
>>> anything. So why bother with going through libbpf in this case? The
>>> actual attachment is using the existing code anyway...
>>>
>>
>> actually, it already does: bpf_load_program
> 
> Thanks for this info. Do you want to convert ipvrf.c to:
> 
> @@ -256,8 +262,13 @@ static int prog_load(int idx)
>  		BPF_EXIT_INSN(),
>  	};
>  
> +#ifdef HAVE_LIBBPF
> +	return bpf_load_program(BPF_PROG_TYPE_CGROUP_SOCK, prog, sizeof(prog),
> +				"GPL", 0, bpf_log_buf, sizeof(bpf_log_buf));
> +#else
>  	return bpf_prog_load_buf(BPF_PROG_TYPE_CGROUP_SOCK, prog, sizeof(prog),
>  			         "GPL", bpf_log_buf, sizeof(bpf_log_buf));
> +#endif
>  }
>  
>  static int vrf_configure_cgroup(const char *path, int ifindex)
> @@ -288,7 +299,11 @@ static int vrf_configure_cgroup(const char *path, int ifindex)
>  		goto out;
>  	}
>  
> +#ifdef HAVE_LIBBPF
> +	if (bpf_prog_attach(prog_fd, cg_fd, BPF_CGROUP_INET_SOCK_CREATE, 0)) {
> +#else
>  	if (bpf_prog_attach_fd(prog_fd, cg_fd, BPF_CGROUP_INET_SOCK_CREATE)) {
> +#endif
>  		fprintf(stderr, "Failed to attach prog to cgroup: '%s'\n",
>  			strerror(errno));
>  		goto out;
> 

works for me. The rename in patch 2 can be dropped as well correct?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ