KEYS: fix out-of-bounds read during ASN.1 parsing
Eric Biggers authored
syzkaller with KASAN reported an out-of-bounds read in
asn1_ber_decoder().  It can be reproduced by the following command,
assuming CONFIG_X509_CERTIFICATE_PARSER=y and CONFIG_KASAN=y:

    keyctl add asymmetric desc $'\x30\x30' @s

The bug is that the length of an ASN.1 data value isn't validated in the
case where it is encoded using the short form, causing the decoder to
read past the end of the input buffer.  Fix it by validating the length.

The bug report was:

    BUG: KASAN: slab-out-of-bounds in asn1_ber_decoder+0x10cb/0x1730 lib/asn1_decoder.c:233
    Read of size 1 at addr ffff88003cccfa02 by task syz-executor0/6818

    CPU: 1 PID: 6818 Comm: syz-executor0 Not tainted 4.14.0-rc7-00008-g5f479447 #2
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
    Call Trace:
     __dump_stack lib/dump_stack.c:16 [inline]
     dump_stack+0xb3/0x10b lib/dump_stack.c:52
     print_address_description+0x79/0x2a0 mm/kasan/report...
2eb9eabf
Name Last commit Last update
Documentation Revert "PM / QoS: Fix device resume latency PM QoS"
arch x86/mm: fix use-after-free of vma during userfaultfd fault
block bio_copy_user_iov(): don't ignore ->iov_offset
certs modsign: add markers to endif-statements in certs/Makefile
crypto Merge commit 'tags/keys-fixes-20171018' into fixes-v4.14-rc5
drivers Merge branch 'for-linus' of git://git.kernel.dk/linux-block
firmware firmware: Restore support for built-in firmware
fs cifs: check MaxPathNameComponentLength != 0 before using it
include Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
init kbuild: Fix optimization level choice default
ipc fix a typo in put_compat_shm_info()
kernel Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace
lib KEYS: fix out-of-bounds read during ASN.1 parsing
mm Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
net tcp: fix tcp_mtu_probe() vs highest_sack
samples Fix tracing sample code warning.
scripts Merge tag 'kbuild-fixes-v4.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
security KEYS: trusted: fix writing past end of buffer in trusted_read()
sound ALSA: hda - fix headset mic problem for Dell machines with alc236
tools bpf: remove SK_REDIRECT from UAPI
usr ramfs: clarify help text that compression applies to ramfs as well as legacy ramdisk.
virt Revert "KVM: Don't accept obviously wrong gsi values via KVM_IRQFD"
.cocciconfig scripts: add Linux .cocciconfig for coccinelle
.get_maintainer.ignore Add hch to .get_maintainer.ignore
.gitattributes .gitattributes: set git diff driver for C source code files
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
Linux kernel
============

This file was moved to Documentation/admin-guide/README.rst

Please notice that there are several guides for kernel developers and users.
These guides can be rendered in a number of formats, like HTML and PDF.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.
See Documentation/00-INDEX for a list of what is contained in each file.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.