Kuniyuki Iwashima
15fba562f7
netfilter: arptables: Select NETFILTER_FAMILY_ARP when building arp_tables.c
...
syzkaller started to report a warning below [0] after consuming the
commit 4654467dc7e1 ("netfilter: arptables: allow xtables-nft only
builds").
The change accidentally removed the dependency on NETFILTER_FAMILY_ARP
from IP_NF_ARPTABLES.
If NF_TABLES_ARP is not enabled on Kconfig, NETFILTER_FAMILY_ARP will
be removed and some code necessary for arptables will not be compiled.
$ grep -E "(NETFILTER_FAMILY_ARP|IP_NF_ARPTABLES|NF_TABLES_ARP)" .config
CONFIG_NETFILTER_FAMILY_ARP=y
# CONFIG_NF_TABLES_ARP is not set
CONFIG_IP_NF_ARPTABLES=y
$ make olddefconfig
$ grep -E "(NETFILTER_FAMILY_ARP|IP_NF_ARPTABLES|NF_TABLES_ARP)" .config
# CONFIG_NF_TABLES_ARP is not set
CONFIG_IP_NF_ARPTABLES=y
So, when nf_register_net_hooks() is called for arptables, it will
trigger the splat below.
Now IP_NF_ARPTABLES is only enabled by IP_NF_ARPFILTER, so let's
restore the dependency on NETFILTER_FAMILY_ARP in IP_NF_ARPFILTER.
[0]:
WARNING: CPU: 0 PID: 242 at net/netfilter/core.c:316 nf_hook_entry_head+0x1e1/0x2c0 net/netfilter/core.c:316
Modules linked in:
CPU: 0 PID: 242 Comm: syz-executor.0 Not tainted 6.8.0-12821-g537c2e91d354 #10
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
RIP: 0010:nf_hook_entry_head+0x1e1/0x2c0 net/netfilter/core.c:316
Code: 83 fd 04 0f 87 bc 00 00 00 e8 5b 84 83 fd 4d 8d ac ec a8 0b 00 00 e8 4e 84 83 fd 4c 89 e8 5b 5d 41 5c 41 5d c3 e8 3f 84 83 fd <0f> 0b e8 38 84 83 fd 45 31 ed 5b 5d 4c 89 e8 41 5c 41 5d c3 e8 26
RSP: 0018:ffffc90000b8f6e8 EFLAGS: 00010293
RAX: 0000000000000000 RBX: 0000000000000003 RCX: ffffffff83c42164
RDX: ffff888106851180 RSI: ffffffff83c42321 RDI: 0000000000000005
RBP: 0000000000000000 R08: 0000000000000005 R09: 000000000000000a
R10: 0000000000000003 R11: ffff8881055c2f00 R12: ffff888112b78000
R13: 0000000000000000 R14: ffff8881055c2f00 R15: ffff8881055c2f00
FS: 00007f377bd78800(0000) GS:ffff88811b000000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000496068 CR3: 000000011298b003 CR4: 0000000000770ef0
PKRU: 55555554
Call Trace:
<TASK>
__nf_register_net_hook+0xcd/0x7a0 net/netfilter/core.c:428
nf_register_net_hook+0x116/0x170 net/netfilter/core.c:578
nf_register_net_hooks+0x5d/0xc0 net/netfilter/core.c:594
arpt_register_table+0x250/0x420 net/ipv4/netfilter/arp_tables.c:1553
arptable_filter_table_init+0x41/0x60 net/ipv4/netfilter/arptable_filter.c:39
xt_find_table_lock+0x2e9/0x4b0 net/netfilter/x_tables.c:1260
xt_request_find_table_lock+0x2b/0xe0 net/netfilter/x_tables.c:1285
get_info+0x169/0x5c0 net/ipv4/netfilter/arp_tables.c:808
do_arpt_get_ctl+0x3f9/0x830 net/ipv4/netfilter/arp_tables.c:1444
nf_getsockopt+0x76/0xd0 net/netfilter/nf_sockopt.c:116
ip_getsockopt+0x17d/0x1c0 net/ipv4/ip_sockglue.c:1777
tcp_getsockopt+0x99/0x100 net/ipv4/tcp.c:4373
do_sock_getsockopt+0x279/0x360 net/socket.c:2373
__sys_getsockopt+0x115/0x1e0 net/socket.c:2402
__do_sys_getsockopt net/socket.c:2412 [inline]
__se_sys_getsockopt net/socket.c:2409 [inline]
__x64_sys_getsockopt+0xbd/0x150 net/socket.c:2409
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0x4f/0x110 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x46/0x4e
RIP: 0033:0x7f377beca6fe
Code: 1f 44 00 00 48 8b 15 01 97 0a 00 f7 d8 64 89 02 b8 ff ff ff ff eb b8 0f 1f 44 00 00 f3 0f 1e fa 49 89 ca b8 37 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 0a c3 66 0f 1f 84 00 00 00 00 00 48 8b 15 c9
RSP: 002b:00000000005df728 EFLAGS: 00000246 ORIG_RAX: 0000000000000037
RAX: ffffffffffffffda RBX: 00000000004966e0 RCX: 00007f377beca6fe
RDX: 0000000000000060 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 000000000042938a R08: 00000000005df73c R09: 00000000005df800
R10: 00000000004966e8 R11: 0000000000000246 R12: 0000000000000003
R13: 0000000000496068 R14: 0000000000000003 R15: 00000000004bc9d8
</TASK>
Fixes: 4654467dc7e1 ("netfilter: arptables: allow xtables-nft only builds")
Reported-by: syzkaller <syzkaller@googlegroups.com>
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2024-03-28 03:54:02 +01:00
..
2024-03-28 03:54:02 +01:00
2024-03-07 21:12:43 -08:00
2024-02-09 14:12:02 -08:00
2024-02-20 10:50:19 +01:00
2024-01-31 20:40:56 -08:00
2024-02-28 19:37:34 -08:00
2024-02-12 17:33:05 -08:00
2024-03-07 20:48:22 -08:00
2023-10-06 07:30:40 +02:00
2024-03-18 11:53:46 +01:00
2024-03-07 20:48:22 -08:00
2024-01-03 16:42:48 -08:00
2023-10-18 18:11:31 -07:00
2024-02-26 11:46:13 +00:00
2024-01-31 20:40:56 -08:00
2024-03-05 13:30:11 +01:00
2023-05-26 10:30:14 +01:00
2023-05-26 10:30:14 +01:00
2024-03-06 13:07:39 -08:00
2024-03-05 13:30:11 +01:00
2023-10-06 08:31:53 +02:00
2024-02-28 19:36:39 -08:00
2024-03-05 18:35:12 -08:00
2024-01-23 15:13:55 +01:00
2022-10-31 20:14:27 -07:00
2024-03-14 10:57:02 +01:00
2024-03-12 18:56:15 -07:00
2024-01-31 16:39:42 -08:00
2023-10-13 09:58:45 -07:00
2023-08-15 15:26:18 -07:00
2024-02-15 16:20:04 -08:00
2023-09-01 08:11:51 +01:00
2024-03-18 12:29:53 +00:00
2024-03-06 12:37:06 +00:00
2024-02-03 12:43:19 +00:00
2024-03-11 20:38:36 -07:00
2024-02-15 16:20:04 -08:00
2022-09-29 07:18:00 +02:00
2023-05-22 11:17:55 +01:00
2024-02-15 16:20:04 -08:00
2024-03-11 09:53:22 +00:00
2023-10-27 10:35:44 +01:00
2024-01-04 10:23:10 -08:00
2023-01-23 21:37:25 -08:00
2023-10-06 08:31:53 +02:00
2024-03-11 20:35:20 -07:00
2023-10-16 21:05:33 -07:00
2024-02-28 19:36:39 -08:00
2024-01-23 15:13:54 +01:00
2024-03-19 13:45:58 +01:00
2024-02-28 19:36:39 -08:00
2024-03-19 19:35:59 -07:00
2023-12-08 10:44:42 -08:00
2024-02-20 11:40:15 +01:00
2024-01-31 20:40:56 -08:00
2023-10-18 18:09:31 -07:00
2022-10-16 15:27:07 -07:00
2024-03-04 10:03:57 -08:00
2024-01-31 20:40:56 -08:00
2024-01-31 20:40:56 -08:00
2024-01-23 15:13:54 +01:00
2023-08-16 11:09:18 +01:00
2024-02-28 10:39:22 +00:00
2024-02-28 10:39:22 +00:00
2023-10-23 09:35:01 +01:00
2023-10-03 10:05:22 +02:00
2024-03-12 18:56:16 -07:00
2024-03-07 21:12:42 -08:00
2023-12-12 15:56:02 -08:00
2022-12-20 03:13:45 +01:00
2023-10-17 17:25:42 -07:00
2024-01-01 14:42:05 +00:00
2023-11-16 23:35:12 +00:00
2023-01-19 09:26:16 -08:00
2024-03-11 10:37:40 +00:00
2024-02-09 14:12:02 -08:00
2023-03-03 17:25:15 +01:00
2024-01-23 15:13:54 +01:00
2023-06-24 15:50:13 -07:00
2024-03-07 21:12:43 -08:00
2024-02-09 14:12:02 -08:00
2023-10-03 11:39:34 +02:00
2024-03-11 09:56:03 +00:00
2023-09-14 16:16:36 +02:00
2024-03-04 08:47:06 +00:00
2023-08-29 17:39:15 -07:00
2024-02-09 14:12:02 -08:00