Revision 79a8a642bf05cd0dced20621f6fef9d884124abd authored by Kees Cook on 08 February 2018, 01:44:38 UTC, committed by David S. Miller on 08 February 2018, 20:15:48 UTC
Most callers of put_cmsg() use a "sizeof(foo)" for the length argument. Within put_cmsg(), a copy_to_user() call is made with a dynamic size, as a result of the cmsg header calculations. This means that hardened usercopy will examine the copy, even though it was technically a fixed size and should be implicitly whitelisted. All the put_cmsg() calls being built from values in skbuff_head_cache are coming out of the protocol-defined "cb" field, so whitelist this field entirely instead of creating per-use bounce buffers, for which there are concerns about performance. Original report was: Bad or missing usercopy whitelist? Kernel memory exposure attempt detected from SLAB object 'skbuff_head_cache' (offset 64, size 16)! WARNING: CPU: 0 PID: 3663 at mm/usercopy.c:81 usercopy_warn+0xdb/0x100 mm/usercopy.c:76 ... __check_heap_object+0x89/0xc0 mm/slab.c:4426 check_heap_object mm/usercopy.c:236 [inline] __check_object_size+0x272/0x530 mm/usercopy.c:259 check_object_size include/linux/thread_info.h:112 [inline] check_copy_size include/linux/thread_info.h:143 [inline] copy_to_user include/linux/uaccess.h:154 [inline] put_cmsg+0x233/0x3f0 net/core/scm.c:242 sock_recv_errqueue+0x200/0x3e0 net/core/sock.c:2913 packet_recvmsg+0xb2e/0x17a0 net/packet/af_packet.c:3296 sock_recvmsg_nosec net/socket.c:803 [inline] sock_recvmsg+0xc9/0x110 net/socket.c:810 ___sys_recvmsg+0x2a4/0x640 net/socket.c:2179 __sys_recvmmsg+0x2a9/0xaf0 net/socket.c:2287 SYSC_recvmmsg net/socket.c:2368 [inline] SyS_recvmmsg+0xc4/0x160 net/socket.c:2352 entry_SYSCALL_64_fastpath+0x29/0xa0 Reported-by: syzbot+e2d6cfb305e9f3911dea@syzkaller.appspotmail.com Fixes: 6d07d1cd300f ("usercopy: Restrict non-usercopy caches to size 0") Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e728789
File | Mode | Size |
---|---|---|
Makefile | -rw-r--r-- | 750 bytes |
README | -rw-r--r-- | 638 bytes |
cnv_float.h | -rw-r--r-- | 12.6 KB |
dbl_float.h | -rw-r--r-- | 35.9 KB |
decode_exc.c | -rw-r--r-- | 11.4 KB |
denormal.c | -rw-r--r-- | 3.3 KB |
dfadd.c | -rw-r--r-- | 15.4 KB |
dfcmp.c | -rw-r--r-- | 5.2 KB |
dfdiv.c | -rw-r--r-- | 12.3 KB |
dfmpy.c | -rw-r--r-- | 11.5 KB |
dfrem.c | -rw-r--r-- | 8.8 KB |
dfsqrt.c | -rw-r--r-- | 5.4 KB |
dfsub.c | -rw-r--r-- | 15.5 KB |
driver.c | -rw-r--r-- | 3.8 KB |
fcnvff.c | -rw-r--r-- | 9.2 KB |
fcnvfu.c | -rw-r--r-- | 12.1 KB |
fcnvfut.c | -rw-r--r-- | 7.8 KB |
fcnvfx.c | -rw-r--r-- | 14.7 KB |
fcnvfxt.c | -rw-r--r-- | 8.5 KB |
fcnvuf.c | -rw-r--r-- | 8.0 KB |
fcnvxf.c | -rw-r--r-- | 9.6 KB |
float.h | -rw-r--r-- | 21.9 KB |
fmpyfadd.c | -rw-r--r-- | 78.4 KB |
fpbits.h | -rw-r--r-- | 2.8 KB |
fpu.h | -rw-r--r-- | 2.2 KB |
fpudispatch.c | -rw-r--r-- | 38.3 KB |
frnd.c | -rw-r--r-- | 7.0 KB |
hppa.h | -rw-r--r-- | 1.7 KB |
math-emu.h | -rw-r--r-- | 1.0 KB |
sfadd.c | -rw-r--r-- | 14.3 KB |
sfcmp.c | -rw-r--r-- | 4.4 KB |
sfdiv.c | -rw-r--r-- | 10.9 KB |
sfmpy.c | -rw-r--r-- | 10.3 KB |
sfrem.c | -rw-r--r-- | 7.9 KB |
sfsqrt.c | -rw-r--r-- | 4.7 KB |
sfsub.c | -rw-r--r-- | 14.4 KB |
sgl_float.h | -rw-r--r-- | 19.2 KB |
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...