1. 01 10月, 2019 32 次提交
  2. 21 9月, 2019 8 次提交
    • G
      Linux 4.19.75 · d573e8a7
      Greg Kroah-Hartman 提交于
      d573e8a7
    • S
      media: technisat-usb2: break out of loop at end of buffer · b841a9f5
      Sean Young 提交于
      commit 0c4df39e504bf925ab666132ac3c98d6cbbe380b upstream.
      
      Ensure we do not access the buffer beyond the end if no 0xff byte
      is encountered.
      
      Reported-by: syzbot+eaaaf38a95427be88f4b@syzkaller.appspotmail.com
      Signed-off-by: NSean Young <sean@mess.org>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b841a9f5
    • W
      arm64: kpti: Whitelist Cortex-A CPUs that don't implement the CSV3 field · f35f5a99
      Will Deacon 提交于
      commit 2a355ec25729053bb9a1a89b6c1d1cdd6c3b3fb1 upstream.
      
      While the CSV3 field of the ID_AA64_PFR0 CPU ID register can be checked
      to see if a CPU is susceptible to Meltdown and therefore requires kpti
      to be enabled, existing CPUs do not implement this field.
      
      We therefore whitelist all unaffected Cortex-A CPUs that do not implement
      the CSV3 field.
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      Cc: Niklas Cassel <niklas.cassel@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f35f5a99
    • K
      binfmt_elf: move brk out of mmap when doing direct loader exec · c0ccb4da
      Kees Cook 提交于
      commit bbdc6076d2e5d07db44e74c11b01a3e27ab90b32 upstream.
      
      Commmit eab09532 ("binfmt_elf: use ELF_ET_DYN_BASE only for PIE"),
      made changes in the rare case when the ELF loader was directly invoked
      (e.g to set a non-inheritable LD_LIBRARY_PATH, testing new versions of
      the loader), by moving into the mmap region to avoid both ET_EXEC and
      PIE binaries.  This had the effect of also moving the brk region into
      mmap, which could lead to the stack and brk being arbitrarily close to
      each other.  An unlucky process wouldn't get its requested stack size
      and stack allocations could end up scribbling on the heap.
      
      This is illustrated here.  In the case of using the loader directly, brk
      (so helpfully identified as "[heap]") is allocated with the _loader_ not
      the binary.  For example, with ASLR entirely disabled, you can see this
      more clearly:
      
      $ /bin/cat /proc/self/maps
      555555554000-55555555c000 r-xp 00000000 ... /bin/cat
      55555575b000-55555575c000 r--p 00007000 ... /bin/cat
      55555575c000-55555575d000 rw-p 00008000 ... /bin/cat
      55555575d000-55555577e000 rw-p 00000000 ... [heap]
      ...
      7ffff7ff7000-7ffff7ffa000 r--p 00000000 ... [vvar]
      7ffff7ffa000-7ffff7ffc000 r-xp 00000000 ... [vdso]
      7ffff7ffc000-7ffff7ffd000 r--p 00027000 ... /lib/x86_64-linux-gnu/ld-2.27.so
      7ffff7ffd000-7ffff7ffe000 rw-p 00028000 ... /lib/x86_64-linux-gnu/ld-2.27.so
      7ffff7ffe000-7ffff7fff000 rw-p 00000000 ...
      7ffffffde000-7ffffffff000 rw-p 00000000 ... [stack]
      
      $ /lib/x86_64-linux-gnu/ld-2.27.so /bin/cat /proc/self/maps
      ...
      7ffff7bcc000-7ffff7bd4000 r-xp 00000000 ... /bin/cat
      7ffff7bd4000-7ffff7dd3000 ---p 00008000 ... /bin/cat
      7ffff7dd3000-7ffff7dd4000 r--p 00007000 ... /bin/cat
      7ffff7dd4000-7ffff7dd5000 rw-p 00008000 ... /bin/cat
      7ffff7dd5000-7ffff7dfc000 r-xp 00000000 ... /lib/x86_64-linux-gnu/ld-2.27.so
      7ffff7fb2000-7ffff7fd6000 rw-p 00000000 ...
      7ffff7ff7000-7ffff7ffa000 r--p 00000000 ... [vvar]
      7ffff7ffa000-7ffff7ffc000 r-xp 00000000 ... [vdso]
      7ffff7ffc000-7ffff7ffd000 r--p 00027000 ... /lib/x86_64-linux-gnu/ld-2.27.so
      7ffff7ffd000-7ffff7ffe000 rw-p 00028000 ... /lib/x86_64-linux-gnu/ld-2.27.so
      7ffff7ffe000-7ffff8020000 rw-p 00000000 ... [heap]
      7ffffffde000-7ffffffff000 rw-p 00000000 ... [stack]
      
      The solution is to move brk out of mmap and into ELF_ET_DYN_BASE since
      nothing is there in the direct loader case (and ET_EXEC is still far
      away at 0x400000).  Anything that ran before should still work (i.e.
      the ultimately-launched binary already had the brk very far from its
      text, so this should be no different from a COMPAT_BRK standpoint).  The
      only risk I see here is that if someone started to suddenly depend on
      the entire memory space lower than the mmap region being available when
      launching binaries via a direct loader execs which seems highly
      unlikely, I'd hope: this would mean a binary would _not_ work when
      exec()ed normally.
      
      (Note that this is only done under CONFIG_ARCH_HAS_ELF_RANDOMIZATION
      when randomization is turned on.)
      
      Link: http://lkml.kernel.org/r/20190422225727.GA21011@beast
      Link: https://lkml.kernel.org/r/CAGXu5jJ5sj3emOT2QPxQkNQk0qbU6zEfu9=Omfhx_p0nCKPSjA@mail.gmail.com
      Fixes: eab09532 ("binfmt_elf: use ELF_ET_DYN_BASE only for PIE")
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Reported-by: NAli Saidi <alisaidi@amazon.com>
      Cc: Ali Saidi <alisaidi@amazon.com>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Jann Horn <jannh@google.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Cc: Frank van der Linden <fllinden@amazon.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c0ccb4da
    • J
      floppy: fix usercopy direction · c3817ffb
      Jann Horn 提交于
      commit 52f6f9d74f31078964ca1574f7bb612da7877ac8 upstream.
      
      As sparse points out, these two copy_from_user() should actually be
      copy_to_user().
      
      Fixes: 229b53c9 ("take floppy compat ioctls to sodding floppy.c")
      Cc: stable@vger.kernel.org
      Acked-by: NAlexander Popov <alex.popov@linux.com>
      Reviewed-by: NMukesh Ojha <mojha@codeaurora.org>
      Signed-off-by: NJann Horn <jannh@google.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c3817ffb
    • A
      ovl: fix regression caused by overlapping layers detection · 9c13e770
      Amir Goldstein 提交于
      commit 0be0bfd2de9dfdd2098a9c5b14bdd8f739c9165d upstream.
      
      Once upon a time, commit 2cac0c00 ("ovl: get exclusive ownership on
      upper/work dirs") in v4.13 added some sanity checks on overlayfs layers.
      This change caused a docker regression. The root cause was mount leaks
      by docker, which as far as I know, still exist.
      
      To mitigate the regression, commit 85fdee1e ("ovl: fix regression
      caused by exclusive upper/work dir protection") in v4.14 turned the
      mount errors into warnings for the default index=off configuration.
      
      Recently, commit 146d62e5a586 ("ovl: detect overlapping layers") in
      v5.2, re-introduced exclusive upper/work dir checks regardless of
      index=off configuration.
      
      This changes the status quo and mount leak related bug reports have
      started to re-surface. Restore the status quo to fix the regressions.
      To clarify, index=off does NOT relax overlapping layers check for this
      ovelayfs mount. index=off only relaxes exclusive upper/work dir checks
      with another overlayfs mount.
      
      To cover the part of overlapping layers detection that used the
      exclusive upper/work dir checks to detect overlap with self upper/work
      dir, add a trap also on the work base dir.
      
      Link: https://github.com/moby/moby/issues/34672
      Link: https://lore.kernel.org/linux-fsdevel/20171006121405.GA32700@veci.piliscsaba.szeredi.hu/
      Link: https://github.com/containers/libpod/issues/3540
      Fixes: 146d62e5a586 ("ovl: detect overlapping layers")
      Cc: <stable@vger.kernel.org> # v4.19+
      Signed-off-by: NAmir Goldstein <amir73il@gmail.com>
      Tested-by: NColin Walters <walters@verbum.org>
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9c13e770
    • N
      PCI: kirin: Fix section mismatch warning · 5e74396d
      Nathan Chancellor 提交于
      commit 6870b673509779195cab300aedc844b352d9cfbc upstream.
      
      The PCI kirin driver compilation produces the following section mismatch
      warning:
      
      WARNING: vmlinux.o(.text+0x4758cc): Section mismatch in reference from
      the function kirin_pcie_probe() to the function
      .init.text:kirin_add_pcie_port()
      The function kirin_pcie_probe() references
      the function __init kirin_add_pcie_port().
      This is often because kirin_pcie_probe lacks a __init
      annotation or the annotation of kirin_add_pcie_port is wrong.
      
      Remove '__init' from kirin_add_pcie_port() to fix it.
      
      Fixes: fc5165db ("PCI: kirin: Add HiSilicon Kirin SoC PCIe controller driver")
      Reported-by: NNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: NNathan Chancellor <natechancellor@gmail.com>
      [lorenzo.pieralisi@arm.com: updated commit log]
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5e74396d
    • J
      iommu/amd: Fix race in increase_address_space() · 0d50f7b1
      Joerg Roedel 提交于
      [ Upstream commit 754265bcab78a9014f0f99cd35e0d610fcd7dfa7 ]
      
      After the conversion to lock-less dma-api call the
      increase_address_space() function can be called without any
      locking. Multiple CPUs could potentially race for increasing
      the address space, leading to invalid domain->mode settings
      and invalid page-tables. This has been happening in the wild
      under high IO load and memory pressure.
      
      Fix the race by locking this operation. The function is
      called infrequently so that this does not introduce
      a performance regression in the dma-api path again.
      Reported-by: NQian Cai <cai@lca.pw>
      Fixes: 256e4621 ('iommu/amd: Make use of the generic IOVA allocator')
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      0d50f7b1