Re: [PATCH net-next 1/2] bpf: skip sockopt hooks without CONFIG_NET

From: Daniel Borkmann
Date: Mon Jul 08 2019 - 11:41:24 EST


On 07/08/2019 05:06 PM, Yonghong Song wrote:
> On 7/8/19 5:57 AM, Arnd Bergmann wrote:
>> When CONFIG_NET is disabled, we get a link error:
>>
>> kernel/bpf/cgroup.o: In function `__cgroup_bpf_run_filter_setsockopt':
>> cgroup.c:(.text+0x3010): undefined reference to `lock_sock_nested'
>> cgroup.c:(.text+0x3258): undefined reference to `release_sock'
>> kernel/bpf/cgroup.o: In function `__cgroup_bpf_run_filter_getsockopt':
>> cgroup.c:(.text+0x3568): undefined reference to `lock_sock_nested'
>> cgroup.c:(.text+0x3870): undefined reference to `release_sock'
>> kernel/bpf/cgroup.o: In function `cg_sockopt_func_proto':
>> cgroup.c:(.text+0x41d8): undefined reference to `bpf_sk_storage_delete_proto'
>>
>> None of this code is useful in this configuration anyway, so we can
>> simply hide it in an appropriate #ifdef.
>>
>> Fixes: 0d01da6afc54 ("bpf: implement getsockopt and setsockopt hooks")
>> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
>
> FYI.
>
> There is already a patch to fix the same issue,
> https://lore.kernel.org/bpf/e9e489fe-feec-a211-82aa-5df0c6a308d1@xxxxxxxxxx/T/#t
>
> which has been acked and not merged yet.

Done now, and I've also applied patch 2/2 from here, thanks.