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: <9883d0ca-df89-5bca-aa94-67fb4e620ac2@iogearbox.net>
Date:   Tue, 10 Aug 2021 13:51:18 +0200
From:   Daniel Borkmann <daniel@...earbox.net>
To:     Andrii Nakryiko <andrii.nakryiko@...il.com>,
        Dave Marchevsky <davemarchevsky@...com>
Cc:     bpf <bpf@...r.kernel.org>, Networking <netdev@...r.kernel.org>,
        Alexei Starovoitov <ast@...nel.org>,
        Andrii Nakryiko <andrii@...nel.org>,
        Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...nel.org>
Subject: Re: [PATCH bpf-next 1/1] bpf: migrate cgroup_bpf to internal
 cgroup_bpf_attach_type enum

On 8/2/21 11:35 PM, Andrii Nakryiko wrote:
> On Sat, Jul 31, 2021 at 4:33 PM Dave Marchevsky <davemarchevsky@...com> wrote:
[...]
> 
>>   #define BPF_CGROUP_RUN_PROG_INET_SOCK(sk)                                     \
>> -       BPF_CGROUP_RUN_SK_PROG(sk, BPF_CGROUP_INET_SOCK_CREATE)
>> +       BPF_CGROUP_RUN_SK_PROG(sk, CG_BPF_CGROUP_INET_SOCK_CREATE)
>>
>>   #define BPF_CGROUP_RUN_PROG_INET_SOCK_RELEASE(sk)                             \
>> -       BPF_CGROUP_RUN_SK_PROG(sk, BPF_CGROUP_INET_SOCK_RELEASE)
>> +       BPF_CGROUP_RUN_SK_PROG(sk, CG_BPF_CGROUP_INET_SOCK_RELEASE)
>>
>>   #define BPF_CGROUP_RUN_PROG_INET4_POST_BIND(sk)                                       \
>> -       BPF_CGROUP_RUN_SK_PROG(sk, BPF_CGROUP_INET4_POST_BIND)
>> +       BPF_CGROUP_RUN_SK_PROG(sk, CG_BPF_CGROUP_INET4_POST_BIND)
>>
>>   #define BPF_CGROUP_RUN_PROG_INET6_POST_BIND(sk)                                       \
>> -       BPF_CGROUP_RUN_SK_PROG(sk, BPF_CGROUP_INET6_POST_BIND)
>> +       BPF_CGROUP_RUN_SK_PROG(sk, CG_BPF_CGROUP_INET6_POST_BIND)
>>
> 
> all these macros are candidate for a rewrite to proper (always
> inlined) functions, similarly to what I did in [0]. It would make it
> much harder to accidentally use wrong constant and will make typing
> explicit. But let's see how that change goes first.

Fully agree, this has grown into a horrible mess over time, would be nice
to have this refactored and cleaned up. :/

>    [0] https://patchwork.kernel.org/project/netdevbpf/patch/20210730053413.1090371-3-andrii@kernel.org/
> 
>> -#define BPF_CGROUP_RUN_SA_PROG(sk, uaddr, type)                                       \
>> +#define BPF_CGROUP_RUN_SA_PROG(sk, uaddr, atype)                                      \
>>   ({                                                                            \
>>          u32 __unused_flags;                                                    \
>>          int __ret = 0;                                                         \
>> -       if (cgroup_bpf_enabled(type))                                          \
>> -               __ret = __cgroup_bpf_run_filter_sock_addr(sk, uaddr, type,     \
>> +       if (cgroup_bpf_enabled(atype))                                         \
>> +               __ret = __cgroup_bpf_run_filter_sock_addr(sk, uaddr, atype,     \
>>                                                            NULL,                \
>>                                                            &__unused_flags);    \
>>          __ret;                                                                 \
>>   })
>>
> 
> [...]
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ