Eric Dumazet
fd851ba9ca
udp: harden copy_linear_skb()
...
syzkaller got crashes with CONFIG_HARDENED_USERCOPY=y configs.
Issue here is that recvfrom() can be used with user buffer of Z bytes,
and SO_PEEK_OFF of X bytes, from a skb with Y bytes, and following
condition :
Z < X < Y
kernel BUG at mm/usercopy.c:72!
invalid opcode: 0000 [#1 ] SMP KASAN
Dumping ftrace buffer:
(ftrace buffer empty)
Modules linked in:
CPU: 0 PID: 2917 Comm: syzkaller842281 Not tainted 4.13.0-rc3+ #16
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
task: ffff8801d2fa40c0 task.stack: ffff8801d1fe8000
RIP: 0010:report_usercopy mm/usercopy.c:64 [inline]
RIP: 0010:__check_object_size+0x3ad/0x500 mm/usercopy.c:264
RSP: 0018:ffff8801d1fef8a8 EFLAGS: 00010286
RAX: 0000000000000078 RBX: ffffffff847102c0 RCX: 0000000000000000
RDX: 0000000000000078 RSI: 1ffff1003a3fded5 RDI: ffffed003a3fdf09
RBP: ffff8801d1fef998 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffff8801d1ea480e
R13: fffffffffffffffa R14: ffffffff84710280 R15: dffffc0000000000
FS: 0000000001360880(0000) GS:ffff8801dc000000(0000)
knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000202ecfe4 CR3: 00000001d1ff8000 CR4: 00000000001406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
check_object_size include/linux/thread_info.h:108 [inline]
check_copy_size include/linux/thread_info.h:139 [inline]
copy_to_iter include/linux/uio.h:105 [inline]
copy_linear_skb include/net/udp.h:371 [inline]
udpv6_recvmsg+0x1040/0x1af0 net/ipv6/udp.c:395
inet_recvmsg+0x14c/0x5f0 net/ipv4/af_inet.c:793
sock_recvmsg_nosec net/socket.c:792 [inline]
sock_recvmsg+0xc9/0x110 net/socket.c:799
SYSC_recvfrom+0x2d6/0x570 net/socket.c:1788
SyS_recvfrom+0x40/0x50 net/socket.c:1760
entry_SYSCALL_64_fastpath+0x1f/0xbe
Fixes: b65ac44674dd ("udp: try to avoid 2 cache miss on dequeue")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-11 15:00:45 -07:00
..
2017-07-11 06:08:58 -04:00
2017-05-18 13:52:49 +02:00
2017-03-09 17:01:09 -08:00
2015-09-21 16:03:04 -07:00
2017-07-01 07:39:07 -07:00
2017-06-08 10:53:29 -04:00
2017-04-05 10:15:20 +02:00
2016-02-11 03:54:14 -05:00
2017-07-27 00:03:12 -07:00
2017-06-06 12:45:23 -04:00
2017-04-12 22:02:36 +02:00
2017-05-17 15:22:13 -04:00
2017-07-04 01:29:04 -07:00
2015-09-17 13:20:05 +02:00
2017-06-07 17:15:46 +01:00
2017-07-19 08:55:18 -07:00
2017-04-24 12:35:56 -04:00
2017-07-01 07:39:07 -07:00
2017-07-04 22:35:19 +01:00
2016-02-09 04:45:49 -05:00
2017-05-27 18:51:41 -04:00
2017-08-11 14:21:42 -07:00
2017-08-11 14:59:24 -07:00
2017-07-04 22:35:16 +01:00
2017-06-13 11:04:37 +02:00
2016-07-08 12:20:57 +02:00
2017-01-20 12:12:13 -05:00
2017-07-04 01:29:04 -07:00
2016-04-19 20:09:25 -04:00
2016-04-25 16:44:27 -04:00
2016-06-25 12:19:35 -04:00
2016-04-25 16:44:27 -04:00
2016-06-09 23:41:03 -07:00
2017-04-22 20:26:37 +03:00
2017-07-04 22:35:15 +01:00
2015-09-17 17:18:37 -07:00
2017-06-13 16:35:03 -04:00
2016-02-16 20:21:48 -05:00
2017-06-25 11:42:01 -04:00
2017-02-07 13:07:46 -05:00
2017-06-17 22:54:01 -04:00
2017-04-14 10:06:42 +02:00
2015-09-23 15:33:15 -07:00
2017-07-01 07:39:09 -07:00
2017-06-04 18:12:23 -04:00
2017-04-03 19:04:48 -07:00
2017-04-03 19:04:48 -07:00
2016-05-20 18:03:16 -04:00
2016-09-30 13:29:21 +02:00
2016-09-30 13:29:21 +02:00
2016-12-05 15:21:59 -05:00
2017-06-05 10:54:55 -04:00
2016-06-17 20:23:32 -07:00
2016-08-18 01:17:32 -04:00
2017-02-08 14:38:18 -05:00
2016-07-25 17:55:43 -07:00
2016-03-14 12:19:46 -04:00
2016-04-27 22:48:25 -04:00
2017-01-25 16:00:33 +01:00
2016-01-04 20:40:41 +01:00
2017-07-04 01:29:04 -07:00
2017-02-03 15:16:45 -05:00
2015-12-15 23:25:20 -05:00
2017-01-18 13:04:28 -05:00
2016-04-04 22:11:20 -04:00
2017-03-09 18:23:27 -08:00
2017-06-15 12:12:40 -04:00
2016-08-13 15:08:00 -07:00
2017-07-06 08:59:41 -07:00
2017-07-03 03:29:14 -07:00
2017-01-25 14:04:38 -05:00
2016-12-29 11:38:31 -05:00
2017-07-01 07:39:07 -07:00
2016-03-13 23:55:13 -04:00
2017-06-17 22:54:01 -04:00
2017-07-06 10:48:01 +01:00
2017-04-21 13:21:30 -04:00
2017-07-04 01:29:04 -07:00
2017-04-21 13:21:31 -04:00
2017-04-28 12:00:10 +02:00
2017-04-13 13:19:48 -04:00
2017-07-04 01:29:03 -07:00
2017-07-04 22:35:17 +01:00
2017-01-13 09:38:42 +01:00
2016-08-17 19:36:23 -04:00
2016-10-13 12:05:26 -04:00
2017-07-04 22:35:16 +01:00
2015-05-11 10:50:17 -04:00
2017-07-04 22:35:15 +01:00
2017-05-30 11:55:32 -04:00
2017-06-08 14:16:29 +02:00
2016-07-08 13:23:12 +02:00
2017-04-01 20:21:44 -07:00
2016-10-03 02:00:22 -04:00
2016-10-04 02:11:51 -04:00
2017-07-01 07:39:07 -07:00
2017-07-19 08:55:18 -07:00
2017-07-19 08:55:18 -07:00
2016-07-05 09:06:29 -07:00
2017-07-01 07:39:09 -07:00
2017-07-13 09:26:27 -07:00
2015-12-08 22:02:33 -05:00
2017-07-04 22:35:17 +01:00
2016-07-08 12:20:57 +02:00
2016-03-23 22:09:58 -04:00
2017-05-31 17:58:13 -04:00
2017-05-17 15:22:13 -04:00
2016-08-15 10:55:53 -07:00
2017-03-24 13:17:07 -07:00
2017-01-24 13:44:28 -05:00
2016-10-23 19:35:24 -04:00
2016-10-23 19:35:24 -04:00
2016-12-25 17:21:22 +01:00
2017-07-01 07:39:08 -07:00
2017-06-17 22:54:00 -04:00
2017-06-26 23:13:22 -04:00
2017-07-04 22:35:16 +01:00
2017-03-02 08:42:31 +01:00
2017-06-08 10:53:29 -04:00
2016-11-09 20:40:06 -05:00
2016-11-09 20:40:06 -05:00
2017-01-09 16:07:41 -05:00
2016-04-28 11:49:45 -04:00
2016-01-19 14:44:23 -05:00
2017-07-19 08:55:18 -07:00
2016-08-28 23:32:41 -04:00
2017-07-01 08:51:32 -07:00
2017-08-03 15:38:30 -07:00
2015-07-09 15:12:20 -07:00
2017-06-15 12:12:40 -04:00
2016-05-03 16:08:14 -04:00
2015-10-26 22:24:22 -07:00
2016-06-17 20:23:32 -07:00
2017-08-11 15:00:45 -07:00
2017-05-16 15:41:29 -04:00
2017-07-04 22:35:15 +01:00
2017-06-14 13:52:44 +02:00
2017-07-04 22:35:18 +01:00
2017-07-04 22:35:18 +01:00