Eric Dumazet
850a2f987c
BACKPORT: net/packet: fix slab-out-of-bounds access in packet_recvmsg()
[ Upstream commit c700525fcc06b05adfea78039de02628af79e07a ]
syzbot found that when an AF_PACKET socket is using PACKET_COPY_THRESH
and mmap operations, tpacket_rcv() is queueing skbs with
garbage in skb->cb[], triggering a too big copy [1]
Presumably, users of af_packet using mmap() already gets correct
metadata from the mapped buffer, we can simply make sure
to clear 12 bytes that might be copied to user space later.
BUG: KASAN: stack-out-of-bounds in memcpy include/linux/fortify-string.h:225 [inline]
BUG: KASAN: stack-out-of-bounds in packet_recvmsg+0x56c/0x1150 net/packet/af_packet.c:3489
Write of size 165 at addr ffffc9000385fb78 by task syz-executor233/3631
CPU: 0 PID: 3631 Comm: syz-executor233 Not tainted 5.17.0-rc7-syzkaller-02396-g0b3660695e80 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
print_address_description.constprop.0.cold+0xf/0x336 mm/kasan/report.c:255
__kasan_report mm/kasan/report.c:442 [inline]
kasan_report.cold+0x83/0xdf mm/kasan/report.c:459
check_region_inline mm/kasan/generic.c:183 [inline]
kasan_check_range+0x13d/0x180 mm/kasan/generic.c:189
memcpy+0x39/0x60 mm/kasan/shadow.c:66
memcpy include/linux/fortify-string.h:225 [inline]
packet_recvmsg+0x56c/0x1150 net/packet/af_packet.c:3489
sock_recvmsg_nosec net/socket.c:948 [inline]
sock_recvmsg net/socket.c:966 [inline]
sock_recvmsg net/socket.c:962 [inline]
____sys_recvmsg+0x2c4/0x600 net/socket.c:2632
___sys_recvmsg+0x127/0x200 net/socket.c:2674
__sys_recvmsg+0xe2/0x1a0 net/socket.c:2704
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7fdfd5954c29
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 41 15 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffcf8e71e48 EFLAGS: 00000246 ORIG_RAX: 000000000000002f
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007fdfd5954c29
RDX: 0000000000000000 RSI: 0000000020000500 RDI: 0000000000000005
RBP: 0000000000000000 R08: 000000000000000d R09: 000000000000000d
R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffcf8e71e60
R13: 00000000000f4240 R14: 000000000000c1ff R15: 00007ffcf8e71e54
</TASK>
addr ffffc9000385fb78 is located in stack of task syz-executor233/3631 at offset 32 in frame:
____sys_recvmsg+0x0/0x600 include/linux/uio.h:246
this frame has 1 object:
[32, 160) 'addr'
Memory state around the buggy address:
ffffc9000385fa80: 00 04 f3 f3 f3 f3 f3 00 00 00 00 00 00 00 00 00
ffffc9000385fb00: 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00
>ffffc9000385fb80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f3
^
ffffc9000385fc00: f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00 f1
ffffc9000385fc80: f1 f1 f1 00 f2 f2 f2 00 f2 f2 f2 00 00 00 00 00
==================================================================
Bug: 224546354
Fixes: 0fb375fb9b ("[AF_PACKET]: Allow for > 8 byte hardware addresses.")
Signed-off-by: Eric Dumazet <[email protected]>
Reported-by: syzbot <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
Signed-off-by: Lee Jones <[email protected]>
Change-Id: I37e4a05a8d81b2645bc65db002e644b40d1a984d
|
2022-04-28 12:16:30 +00:00 |
| .. |
|
6lowpan
|
6lowpan: iphc: Fix an off-by-one check of array index
|
2021-09-15 09:47:31 +02:00 |
|
9p
|
9p/net: fix missing error check in p9_check_errors
|
2021-11-17 09:48:49 +01:00 |
|
802
|
net/802/garp: fix memleak in garp_request_join()
|
2021-07-31 08:19:38 +02:00 |
|
8021q
|
net: vlan: fix underflow for the real_dev refcnt
|
2021-12-01 09:23:34 +01:00 |
|
appletalk
|
|
|
|
atm
|
|
|
|
ax25
|
ax25: NPD bug when detaching AX25 device
|
2021-12-29 12:23:38 +01:00 |
|
batman-adv
|
batman-adv: allow netlink usage in unprivileged containers
|
2022-01-27 09:19:41 +01:00 |
|
bluetooth
|
Bluetooth: refactor malicious adv data check
|
2022-02-01 17:24:33 +01:00 |
|
bpf
|
|
|
|
bpfilter
|
bpfilter: Specify the log level for the kmsg message
|
2021-07-14 16:53:33 +02:00 |
|
bridge
|
net: bridge: fix stale eth hdr pointer in br_dev_xmit
|
2022-02-16 12:52:50 +01:00 |
|
caif
|
This is the 5.4.148 stable release
|
2021-09-25 14:41:58 +02:00 |
|
can
|
This is the 5.4.164 stable release
|
2021-12-08 09:19:28 +01:00 |
|
ceph
|
|
|
|
core
|
This is the 5.4.177 stable release
|
2022-02-09 12:23:04 +01:00 |
|
dcb
|
|
|
|
dccp
|
dccp: don't duplicate ccid when cloning dccp sock
|
2021-09-22 12:26:40 +02:00 |
|
decnet
|
net: decnet: Fix sleeping inside in af_decnet
|
2021-07-28 13:30:56 +02:00 |
|
dns_resolver
|
|
|
|
dsa
|
net: dsa: destroy the phylink instance on any error in dsa_slave_phy_setup
|
2021-09-22 12:26:42 +02:00 |
|
ethernet
|
|
|
|
hsr
|
hsr: use netdev_err() instead of WARN_ONCE()
|
2021-05-14 09:44:10 +02:00 |
|
ieee802154
|
net: ieee802154: Return meaningful error codes from the netlink helpers
|
2022-02-08 18:24:31 +01:00 |
|
ife
|
|
|
|
ipv4
|
This is the 5.4.180 stable release
|
2022-02-16 17:17:22 +01:00 |
|
ipv6
|
This is the 5.4.180 stable release
|
2022-02-16 17:17:22 +01:00 |
|
iucv
|
|
|
|
kcm
|
|
|
|
key
|
|
|
|
l2tp
|
net/l2tp: Fix reference count leak in l2tp_udp_recv_core
|
2021-09-22 12:26:41 +02:00 |
|
l3mdev
|
|
|
|
lapb
|
|
|
|
llc
|
net: llc: fix skb_over_panic
|
2021-08-04 12:27:39 +02:00 |
|
mac80211
|
This is the 5.4.174 stable release
|
2022-01-31 15:14:13 +01:00 |
|
mac802154
|
|
|
|
mpls
|
net: mpls: Fix notifications when deleting a device
|
2021-12-08 09:01:12 +01:00 |
|
ncsi
|
net/ncsi: check for error return from call to nla_put_u32
|
2022-01-05 12:37:45 +01:00 |
|
netfilter
|
This is the 5.4.176 stable release
|
2022-02-01 17:48:27 +01:00 |
|
netlabel
|
net: fix NULL pointer reference in cipso_v4_doi_free
|
2021-09-22 12:26:36 +02:00 |
|
netlink
|
net: netlink: af_netlink: Prevent empty skb by adding a check on len.
|
2021-12-17 10:12:23 +01:00 |
|
netrom
|
netrom: Decrease sock refcount when sock timers expire
|
2021-07-28 13:30:56 +02:00 |
|
nfc
|
nfc: llcp: fix NULL error pointer dereference on sendmsg() after failed bind()
|
2022-01-27 09:19:26 +01:00 |
|
nsh
|
|
|
|
openvswitch
|
ovs: clear skb->tstamp in forwarding path
|
2021-08-26 08:36:19 -04:00 |
|
packet
|
BACKPORT: net/packet: fix slab-out-of-bounds access in packet_recvmsg()
|
2022-04-28 12:16:30 +00:00 |
|
phonet
|
phonet: refcount leak in pep_sock_accep
|
2022-01-11 15:23:33 +01:00 |
|
psample
|
|
|
|
qrtr
|
net: qrtr: fix another OOB Read in qrtr_endpoint_post
|
2021-09-03 10:08:12 +02:00 |
|
rds
|
rds: memory leak in __rds_conn_create()
|
2021-12-22 09:29:37 +01:00 |
|
rfkill
|
|
|
|
rose
|
|
|
|
rxrpc
|
rxrpc: Adjust retransmission backoff
|
2022-02-01 17:24:38 +01:00 |
|
sched
|
This is the 5.4.180 stable release
|
2022-02-16 17:17:22 +01:00 |
|
sctp
|
Merge tag 'android11-5.4.180_r00' into android11-5.4
|
2022-03-21 12:44:03 +01:00 |
|
smc
|
net/smc: Prevent smc_release() from long blocking
|
2021-12-22 09:29:38 +01:00 |
|
strparser
|
bpf: sockmap, strparser, and tls are reusing qdisc_skb_cb and colliding
|
2021-11-17 09:48:48 +01:00 |
|
sunrpc
|
fsnotify: fix fsnotify hooks in pseudo filesystems
|
2022-02-01 17:24:34 +01:00 |
|
switchdev
|
net: switchdev: do not propagate bridge updates across bridges
|
2021-10-27 09:54:24 +02:00 |
|
tipc
|
tipc: rate limit warning for received illegal binding update
|
2022-02-16 12:52:51 +01:00 |
|
tls
|
net/tls: Fix authentication failure in CCM mode
|
2021-12-08 09:01:14 +01:00 |
|
unix
|
af_unix: annote lockless accesses to unix_tot_inflight & gc_in_progress
|
2022-01-27 09:19:53 +01:00 |
|
vmw_vsock
|
This is the 5.4.160 stable release
|
2021-11-17 10:19:21 +01:00 |
|
wimax
|
|
|
|
wireless
|
This is the 5.4.162 stable release
|
2021-11-26 11:38:38 +01:00 |
|
x25
|
net/x25: Return the correct errno code
|
2021-06-18 09:59:00 +02:00 |
|
xdp
|
Revert "xsk: Do not sleep in poll() when need_wakeup set"
|
2021-12-22 09:29:40 +01:00 |
|
xfrm
|
UPSTREAM: Revert "xfrm: state and policy should fail if XFRMA_IF_ID 0"
|
2022-03-23 08:51:14 +01:00 |
|
compat.c
|
net: Return the correct errno code
|
2021-06-18 09:59:00 +02:00 |
|
Kconfig
|
|
|
|
Makefile
|
|
|
|
OWNERS
|
|
|
|
socket.c
|
This is the 5.4.144 stable release
|
2021-09-03 10:17:46 +02:00 |
|
sysctl_net.c
|
|
|