Skip to content
  1. Jul 25, 2018
    • Masahiro Yamada's avatar
      kconfig: allow all config targets to write auto.conf if missing · 00c864f8
      Masahiro Yamada authored
      
      
      Currently, only syncconfig creates or updates include/config/auto.conf
      and some other files.  Other config targets create or update only the
      .config file.
      
      When you configure and build the kernel from a pristine source tree,
      any config target is followed by syncconfig in the build stage since
      include/config/auto.conf is missing.
      
      We are moving compiler tests from Makefile to Kconfig.  It means that
      parsing Kconfig files will be more costly since Kconfig invokes the
      compiler commands internally.  Thus, we want to avoid invoking Kconfig
      twice (one for *config to create the .config, and one for syncconfig
      to synchronize the auto.conf).  If auto.conf does not exist, we can
      generate all configuration files in the first configuration stage,
      which will save the syncconfig in the build stage.
      
      Please note this should be done only when auto.conf is missing.  If
      *config blindly did this, time stamp files under include/config/ would
      be unnecessarily touched, triggering unneeded rebuild of objects.
      
      I assume a scenario like this:
      
       1. You have a source tree that has already been built
          with CONFIG_FOO disabled
      
       2. Run "make menuconfig" to enable CONFIG_FOO
      
       3. CONFIG_FOO turns out to be unnecessary.
          Run "make menuconfig" again to disable CONFIG_FOO
      
       4. Run "make"
      
      In this case, include/config/foo.h should not be touched since there
      is no change in CONFIG_FOO.  The sync process should be delayed until
      the user really attempts to build the kernel.
      
      This commit has another motivation; I want to suppress the 'No such
      file or directory' warning from the 'include' directive.
      
      The top-level Makefile includes auto.conf with '-include' directive,
      like this:
      
        ifeq ($(dot-config),1)
        -include include/config/auto.conf
        endif
      
      This looks strange because auto.conf is mandatory when dot-config is 1.
      I guess only the reason of using '-include' is to suppress the warning
      'include/config/auto.conf: No such file or directory' when building
      from a clean tree.  However, this has a side-effect; Make considers
      the files included by '-include' are optional.  Hence, Make continues
      to build even if it fails to generate include/config/auto.conf.  I will
      change this in the next commit, but the warning message is annoying.
      (At least, kbuild test robot reports it as a regression.)
      
      With this commit, Kconfig will generate all configuration files together
      with the .config and I guess it is a solution good enough to suppress
      the warning.
      
      Note:
      GNU Make 4.2 or later does not display the warning from the 'include'
      directive if include files are successfully generated.  See GNU Make
      commit 87a5f98d248f ("[SV 102] Don't show unnecessary include file
      errors.")  However, older GNU Make versions are still widely used.
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      00c864f8
    • Masahiro Yamada's avatar
      kconfig: make syncconfig update .config regardless of sym_change_count · 16952b77
      Masahiro Yamada authored
      
      
      syncconfig updates the .config only when sym_change_count > 0, i.e.
      any change in config symbols has been detected.
      
      Not only symbols but also comments are contained in the .config file.
      If only comments are updated, they are not fed back to the .config,
      then the stale comments are left-over.  Of course, this is just a
      matter of comments, but why not fix it.
      
      I see some scenarios where this happens.
      
      Scenario A:
      
       1. You have a source tree that has already been configured.
      
       2. Linus increments the version number in the top-level Makefile
          (i.e. he commits a new release)
      
       3. You pull it, and run 'make'
      
       4. syncconfig is invoked because the environment variable,
          KERNELVERSION is updated, but the .config is not updated since
          no config symbol is changed.
      
       5. The .config file contains a kernel version in the top line:
      
          # Automatically generated file; DO NOT EDIT.
          # Linux/arm64 4.18.0-rc2 Kernel Configuration
      
          ... which points to a previous version.
      
      Scenario B:
      
       1. You have a source tree that has already been configured.
      
       2. You upgrade the compiler, but it still has the same version number.
          This may happen if you regularly build the latest compiler from
          the source code.
      
       3. You run 'make'
      
       4. syncconfig is invoked because the environment variable,
          CC_VERSION_TEXT is updated, but the .config is not updated since
          no config symbol is changed.
      
       5. The .config file contains the version string of the compiler:
      
          #
          # Compiler: aarch64-linux-gcc (GCC) 9.0.0 20180628 (experimental)
          #
      
          ... which carries the information of the old compiler.
      
      If KCONFIG_NOSILENTUPDATE is set, syncconfig is not allowed to update
      the .config file.  Otherwise, it is fine to update it regardless of
      sym_change_count.
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      16952b77
    • Masahiro Yamada's avatar
      kconfig: create directories needed for syncconfig by itself · 79123b13
      Masahiro Yamada authored
      
      
      'make syncconfig' creates some files such as include/config/auto.conf,
      include/generate/autoconf.h, etc. but the necessary directory creation
      relies on scripts/kconfig/Makefile.
      
      To make Kconfig self-contained, create directories as needed in
      conf_write_autoconf().
      
      This change allows scripts/kconfig/Makefile cleanups; syncconfig can
      be merged into simple-targets.
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      79123b13
    • Masahiro Yamada's avatar
      kconfig: remove unneeded directory generation from local*config · adc18acf
      Masahiro Yamada authored
      Commit 17263baf ("kconfig: Create include/generated for
      localmodconfig") added the 'mkdir' line because local{yes,mod}config
      ran streamline_config.pl followed by silentoldconfig at that time.
      
      Since commit 81d2bc22
      
       ("kconfig: invoke oldconfig instead of
      silentoldconfig from local*config"), no sub-directory is required.
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      adc18acf
    • Masahiro Yamada's avatar
      kconfig: split out useful helpers in confdata.c · 0608182a
      Masahiro Yamada authored
      
      
      Split out helpers:
       is_present() - check if the given path exists
       is_dir() - check if the given path exists and it is a directory
       make_parent_dir() - create the parent directories of the given path
      
      These helpers will be reused in later commits.
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      0608182a
    • Masahiro Yamada's avatar
      kconfig: rename file_write_dep and move it to confdata.c · a2ff4040
      Masahiro Yamada authored
      
      
      file_write_dep() is called only from conf_write_autoconf().
      Move it from util.c to confdata.c to make it static.
      Also, rename it to conf_write_dep() since it should belong to
      the group of conf_write* functions.
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      a2ff4040
    • Randy Dunlap's avatar
      kconfig: fix typos in description of "choice" in kconfig-language.txt · 08b220b3
      Randy Dunlap authored
      
      
      Fix a couple of punctuation "typos" in the description of the
      "choice" keyword.
      
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      08b220b3
    • Masahiro Yamada's avatar
      kconfig: handle format string before calling conf_message_callback() · 5accd7f3
      Masahiro Yamada authored
      
      
      As you see in mconf.c and nconf.c, conf_message_callback() hooks are
      likely to end up with the boilerplate of vsnprintf().  Process the
      string format before calling conf_message_callback() so that it
      receives a simple string.
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: default avatarDirk Gouders <dirk@gouders.net>
      5accd7f3
  2. Jul 18, 2018
  3. Jul 16, 2018
    • Linus Torvalds's avatar
      Linux 4.18-rc5 · 9d3cce1e
      Linus Torvalds authored
      9d3cce1e
    • Linus Torvalds's avatar
      Merge tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc · 41b55d23
      Linus Torvalds authored
      Pull ARM SoC fixes from Olof Johansson:
      
       - A fix for OMAP5 and DRA7 to make the branch predictor hardening
         settings take proper effect on secondary cores
      
       - Disable USB OTG on am3517 since current driver isn't working
      
       - Fix thermal sensor register settings on Armada 38x
      
       - Fix suspend/resume IRQs on pxa3xx
      
      * tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc:
        ARM: dts: am3517.dtsi:  Disable reference to OMAP3 OTG controller
        ARM: DRA7/OMAP5: Enable ACTLR[0] (Enable invalidates of BTB) for secondary cores
        ARM: pxa: irq: fix handling of ICMR registers in suspend/resume
        ARM: dts: armada-38x: use the new thermal binding
      41b55d23
  4. Jul 15, 2018
    • Linus Torvalds's avatar
      Merge tag 'rtc-4.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux · 37b5dca2
      Linus Torvalds authored
      Pull RTC fixes from Alexandre Belloni:
       "Two fixes for 4.18:
      
         - an important core fix for RTCs using the core offsetting only one
           driver is affected
      
         - a fix for the error path of mrst"
      
      * tag 'rtc-4.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux:
        rtc: fix alarm read and set offset
        rtc: mrst: fix error code in probe()
      37b5dca2
    • Olof Johansson's avatar
      Merge tag 'omap-for-v4.18/fixes-rc4-signed' of... · 13e66cee
      Olof Johansson authored
      
      Merge tag 'omap-for-v4.18/fixes-rc4-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into fixes
      
      Two omap fixes for v4.18-rc cycle
      
      Turns out the recent patches for ARM branch predictor hardening are
      not working on omap5 and dra7 as planned because the secondary CPU
      is parked to the bootrom code. We can't configure it in the bootloader.
      So we must enable invalidates of BTB for omap5 and dra7 secondary
      core in the kernel.
      
      And there's a fix for reserved register access for am3517. The
      usb otg module on am3517 is not the same as for other omap3.
      
      * tag 'omap-for-v4.18/fixes-rc4-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap:
        ARM: dts: am3517.dtsi:  Disable reference to OMAP3 OTG controller
        ARM: DRA7/OMAP5: Enable ACTLR[0] (Enable invalidates of BTB) for secondary cores
      
      Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
      13e66cee
    • Olof Johansson's avatar
      Merge tag 'mvebu-fixes-4.18-1' of git://git.infradead.org/linux-mvebu into fixes · d4f72a70
      Olof Johansson authored
      
      
      mvebu fixes for 4.18 (part 1)
      
      Use the new thermal binding on Armada 38x allowing to use a driver fix
      which is already part of the kernel.
      
      * tag 'mvebu-fixes-4.18-1' of git://git.infradead.org/linux-mvebu:
        ARM: dts: armada-38x: use the new thermal binding
      
      Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
      d4f72a70
    • Olof Johansson's avatar
      Merge tag 'pxa-fixes-4.18' of https://github.com/rjarzmik/linux into fixes · 4dbd2b42
      Olof Johansson authored
      
      
      This is the fixes set for v4.18 cycle.
      
      This is a fix for suspending all pxa3xx platforms, where high
      number interrupts are not reenabled.
      
      * tag 'pxa-fixes-4.18' of https://github.com/rjarzmik/linux:
        ARM: pxa: irq: fix handling of ICMR registers in suspend/resume
      
      Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
      4dbd2b42
    • Linus Torvalds's avatar
      Merge tag 'for-linus-4.18-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · c31496db
      Linus Torvalds authored
      Pull xen fixes from Juergen Gross:
       "Two related fixes for a boot failure of Xen PV guests"
      
      * tag 'for-linus-4.18-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
        xen: setup pv irq ops vector earlier
        xen: remove global bit from __default_kernel_pte_mask for pv guests
      c31496db
    • Linus Torvalds's avatar
      Merge tag 'for-linus-20180713' of git://git.kernel.dk/linux-block · 2da8c426
      Linus Torvalds authored
      Pull block fix from Jens Axboe:
       "Just a single regression fix (from 4.17) for bsg, fixing an EINVAL
        return on non-data commands"
      
      * tag 'for-linus-20180713' of git://git.kernel.dk/linux-block:
        bsg: fix bogus EINVAL on non-data commands
      2da8c426
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · f353078f
      Linus Torvalds authored
      Merge misc fixes from Andrew Morton:
       "11 fixes"
      
      * emailed patches form Andrew Morton <akpm@linux-foundation.org>:
        reiserfs: fix buffer overflow with long warning messages
        checkpatch: fix duplicate invalid vsprintf pointer extension '%p<foo>' messages
        mm: do not bug_on on incorrect length in __mm_populate()
        mm/memblock.c: do not complain about top-down allocations for !MEMORY_HOTREMOVE
        fs, elf: make sure to page align bss in load_elf_library
        x86/purgatory: add missing FORCE to Makefile target
        net/9p/client.c: put refcount of trans_mod in error case in parse_opts()
        mm: allow arch to supply p??_free_tlb functions
        autofs: fix slab out of bounds read in getname_kernel()
        fs/proc/task_mmu.c: fix Locked field in /proc/pid/smaps*
        mm: do not drop unused pages when userfaultd is running
      f353078f
    • Eric Biggers's avatar
      reiserfs: fix buffer overflow with long warning messages · fe10e398
      Eric Biggers authored
      ReiserFS prepares log messages into a 1024-byte buffer with no bounds
      checks.  Long messages, such as the "unknown mount option" warning when
      userspace passes a crafted mount options string, overflow this buffer.
      This causes KASAN to report a global-out-of-bounds write.
      
      Fix it by truncating messages to the buffer size.
      
      Link: http://lkml.kernel.org/r/20180707203621.30922-1-ebiggers3@gmail.com
      Fixes: 1da177e4
      
       ("Linux-2.6.12-rc2")
      Reported-by: default avatar <syzbot+b890b3335a4d8c608963@syzkaller.appspotmail.com>
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      fe10e398
    • Joe Perches's avatar
      checkpatch: fix duplicate invalid vsprintf pointer extension '%p<foo>' messages · ffe07513
      Joe Perches authored
      
      
      Multiline statements with invalid %p<foo> uses produce multiple
      warnings.  Fix that.
      
      e.g.:
      
      $ cat t_block.c
      void foo(void)
      {
      	MY_DEBUG(drv->foo,
      		 "%pk",
      		 foo->boo);
      }
      
      $ ./scripts/checkpatch.pl -f t_block.c
      WARNING: Missing or malformed SPDX-License-Identifier tag in line 1
      #1: FILE: t_block.c:1:
      +void foo(void)
      
      WARNING: Invalid vsprintf pointer extension '%pk'
      #3: FILE: t_block.c:3:
      +	MY_DEBUG(drv->foo,
      +		 "%pk",
      +		 foo->boo);
      
      WARNING: Invalid vsprintf pointer extension '%pk'
      #3: FILE: t_block.c:3:
      +	MY_DEBUG(drv->foo,
      +		 "%pk",
      +		 foo->boo);
      
      total: 0 errors, 3 warnings, 6 lines checked
      
      NOTE: For some of the reported defects, checkpatch may be able to
            mechanically convert to the typical style using --fix or --fix-inplace.
      
      t_block.c has style problems, please review.
      
      NOTE: If any of the errors are false positives, please report
            them to the maintainer, see CHECKPATCH in MAINTAINERS.
      
      Link: http://lkml.kernel.org/r/9e8341bbe4c9877d159cb512bb701043cbfbb10b.camel@perches.com
      Signed-off-by: default avatarJoe Perches <joe@perches.com>
      Cc: "Tobin C. Harding" <me@tobin.cc>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ffe07513
    • Michal Hocko's avatar
      mm: do not bug_on on incorrect length in __mm_populate() · bb177a73
      Michal Hocko authored
      
      
      syzbot has noticed that a specially crafted library can easily hit
      VM_BUG_ON in __mm_populate
      
        kernel BUG at mm/gup.c:1242!
        invalid opcode: 0000 [#1] SMP
        CPU: 2 PID: 9667 Comm: a.out Not tainted 4.18.0-rc3 #644
        Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 05/19/2017
        RIP: 0010:__mm_populate+0x1e2/0x1f0
        Code: 55 d0 65 48 33 14 25 28 00 00 00 89 d8 75 21 48 83 c4 20 5b 41 5c 41 5d 41 5e 41 5f 5d c3 e8 75 18 f1 ff 0f 0b e8 6e 18 f1 ff <0f> 0b 31 db eb c9 e8 93 06 e0 ff 0f 1f 00 55 48 89 e5 53 48 89 fb
        Call Trace:
           vm_brk_flags+0xc3/0x100
           vm_brk+0x1f/0x30
           load_elf_library+0x281/0x2e0
           __ia32_sys_uselib+0x170/0x1e0
           do_fast_syscall_32+0xca/0x420
           entry_SYSENTER_compat+0x70/0x7f
      
      The reason is that the length of the new brk is not page aligned when we
      try to populate the it.  There is no reason to bug on that though.
      do_brk_flags already aligns the length properly so the mapping is
      expanded as it should.  All we need is to tell mm_populate about it.
      Besides that there is absolutely no reason to to bug_on in the first
      place.  The worst thing that could happen is that the last page wouldn't
      get populated and that is far from putting system into an inconsistent
      state.
      
      Fix the issue by moving the length sanitization code from do_brk_flags
      up to vm_brk_flags.  The only other caller of do_brk_flags is brk
      syscall entry and it makes sure to provide the proper length so t here
      is no need for sanitation and so we can use do_brk_flags without it.
      
      Also remove the bogus BUG_ONs.
      
      [osalvador@techadventures.net: fix up vm_brk_flags s@request@len@]
      Link: http://lkml.kernel.org/r/20180706090217.GI32658@dhcp22.suse.cz
      Signed-off-by: default avatarMichal Hocko <mhocko@suse.com>
      Reported-by: default avatarsyzbot <syzbot+5dcb560fe12aa5091c06@syzkaller.appspotmail.com>
      Tested-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Reviewed-by: default avatarOscar Salvador <osalvador@suse.de>
      Cc: Zi Yan <zi.yan@cs.rutgers.edu>
      Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: "Huang, Ying" <ying.huang@intel.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      bb177a73
    • Michal Hocko's avatar
      mm/memblock.c: do not complain about top-down allocations for !MEMORY_HOTREMOVE · e3d301ca
      Michal Hocko authored
      
      
      Mike Rapoport is converting architectures from bootmem to nobootmem
      allocator.  While doing so for m68k Geert has noticed that he gets a
      scary looking warning:
      
        WARNING: CPU: 0 PID: 0 at mm/memblock.c:230
        memblock_find_in_range_node+0x11c/0x1be
        memblock: bottom-up allocation failed, memory hotunplug may be affected
        Modules linked in:
        CPU: 0 PID: 0 Comm: swapper Not tainted
        4.18.0-rc3-atari-01343-gf2fb5f2e09a97a3c-dirty #7
        Call Trace: __warn+0xa8/0xc2
          kernel_pg_dir+0x0/0x1000
          netdev_lower_get_next+0x2/0x22
          warn_slowpath_fmt+0x2e/0x36
          memblock_find_in_range_node+0x11c/0x1be
          memblock_find_in_range_node+0x11c/0x1be
          memblock_find_in_range_node+0x0/0x1be
          vprintk_func+0x66/0x6e
          memblock_virt_alloc_internal+0xd0/0x156
          netdev_lower_get_next+0x2/0x22
          netdev_lower_get_next+0x2/0x22
          kernel_pg_dir+0x0/0x1000
          memblock_virt_alloc_try_nid_nopanic+0x58/0x7a
          netdev_lower_get_next+0x2/0x22
          kernel_pg_dir+0x0/0x1000
          kernel_pg_dir+0x0/0x1000
          EXPTBL+0x234/0x400
          EXPTBL+0x234/0x400
          alloc_node_mem_map+0x4a/0x66
          netdev_lower_get_next+0x2/0x22
          free_area_init_node+0xe2/0x29e
          EXPTBL+0x234/0x400
          paging_init+0x430/0x462
          kernel_pg_dir+0x0/0x1000
          printk+0x0/0x1a
          EXPTBL+0x234/0x400
          setup_arch+0x1b8/0x22c
          start_kernel+0x4a/0x40a
          _sinittext+0x344/0x9e8
      
      The warning is basically saying that a top-down allocation can break
      memory hotremove because memblock allocation is not movable.  But m68k
      doesn't even support MEMORY_HOTREMOVE so there is no point to warn about
      it.
      
      Make the warning conditional only to configurations that care.
      
      Link: http://lkml.kernel.org/r/20180706061750.GH32658@dhcp22.suse.cz
      Signed-off-by: default avatarMichal Hocko <mhocko@suse.com>
      Reported-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Tested-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
      Cc: Greg Ungerer <gerg@linux-m68k.org>
      Cc: Sam Creasey <sammy@sammy.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e3d301ca
    • Oscar Salvador's avatar
      fs, elf: make sure to page align bss in load_elf_library · 24962af7
      Oscar Salvador authored
      
      
      The current code does not make sure to page align bss before calling
      vm_brk(), and this can lead to a VM_BUG_ON() in __mm_populate() due to
      the requested lenght not being correctly aligned.
      
      Let us make sure to align it properly.
      
      Kees: only applicable to CONFIG_USELIB kernels: 32-bit and configured
      for libc5.
      
      Link: http://lkml.kernel.org/r/20180705145539.9627-1-osalvador@techadventures.net
      Signed-off-by: default avatarOscar Salvador <osalvador@suse.de>
      Reported-by: default avatar <syzbot+5dcb560fe12aa5091c06@syzkaller.appspotmail.com>
      Tested-by: default avatarTetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
      Acked-by: default avatarKees Cook <keescook@chromium.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Nicolas Pitre <nicolas.pitre@linaro.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      24962af7
    • Philipp Rudo's avatar
      x86/purgatory: add missing FORCE to Makefile target · fa8cbda8
      Philipp Rudo authored
      - Build the kernel without the fix
      - Add some flag to the purgatories KBUILD_CFLAGS,I used
        -fno-asynchronous-unwind-tables
      - Re-build the kernel
      
      When you look at makes output you see that sha256.o is not re-build in the
      last step.  Also readelf -S still shows the .eh_frame section for
      sha256.o.
      
      With the fix sha256.o is rebuilt in the last step.
      
      Without FORCE make does not detect changes only made to the command line
      options.  So object files might not be re-built even when they should be.
      Fix this by adding FORCE where it is missing.
      
      Link: http://lkml.kernel.org/r/20180704110044.29279-2-prudo@linux.ibm.com
      Fixes: df6f2801
      
       ("kernel/kexec_file.c: move purgatories sha256 to common code")
      Signed-off-by: default avatarPhilipp Rudo <prudo@linux.ibm.com>
      Acked-by: default avatarDave Young <dyoung@redhat.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: <stable@vger.kernel.org>	[4.17+]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      fa8cbda8
    • piaojun's avatar
      net/9p/client.c: put refcount of trans_mod in error case in parse_opts() · c290fba8
      piaojun authored
      In my testing, the second mount will fail after umounting successfully.
      The reason is that we put refcount of trans_mod in the correct case
      rather than the error case in parse_opts() at last.  That will cause the
      refcount decrease to -1, and when we try to get trans_mod again in
      try_module_get(), we could only increase refcount to 0 which will cause
      failure as follows:
      
      parse_opts
        v9fs_get_trans_by_name
          try_module_get : return NULL to caller which cause error
      
      So we should put refcount of trans_mod in error case.
      
      Link: http://lkml.kernel.org/r/5B3F39A0.2030509@huawei.com
      Fixes: 9421c3e6
      
       ("net/9p/client.c: fix potential refcnt problem of trans module")
      Signed-off-by: default avatarJun Piao <piaojun@huawei.com>
      Reviewed-by: default avatarYiwen Jiang <jiangyiwen@huawei.com>
      Reviewed-by: default avatarGreg Kurz <groug@kaod.org>
      Reviewed-by: default avatarDominique Martinet <dominique.martinet@cea.fr>
      Tested-by: default avatarDominique Martinet <dominique.martinet@cea.fr>
      Cc: Eric Van Hensbergen <ericvh@gmail.com>
      Cc: Ron Minnich <rminnich@sandia.gov>
      Cc: Latchesar Ionkov <lucho@ionkov.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c290fba8
    • Nicholas Piggin's avatar
      mm: allow arch to supply p??_free_tlb functions · a90744ba
      Nicholas Piggin authored
      
      
      The mmu_gather APIs keep track of the invalidated address range
      including the span covered by invalidated page table pages.  Ranges
      covered by page tables but not ptes (and therefore no TLBs) still need
      to be invalidated because some architectures (x86) can cache
      intermediate page table entries, and invalidate those with normal TLB
      invalidation instructions to be almost-backward-compatible.
      
      Architectures which don't cache intermediate page table entries, or
      which invalidate these caches separately from TLB invalidation, do not
      require TLB invalidation range expanded over page tables.
      
      Allow architectures to supply their own p??_free_tlb functions, which
      can avoid the __tlb_adjust_range.
      
      Link: http://lkml.kernel.org/r/20180703013131.2807-1-npiggin@gmail.com
      Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: "Aneesh Kumar K. V" <aneesh.kumar@linux.vnet.ibm.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Nadav Amit <nadav.amit@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a90744ba
    • Tomas Bortoli's avatar
      autofs: fix slab out of bounds read in getname_kernel() · 02f51d45
      Tomas Bortoli authored
      
      
      The autofs subsystem does not check that the "path" parameter is present
      for all cases where it is required when it is passed in via the "param"
      struct.
      
      In particular it isn't checked for the AUTOFS_DEV_IOCTL_OPENMOUNT_CMD
      ioctl command.
      
      To solve it, modify validate_dev_ioctl(function to check that a path has
      been provided for ioctl commands that require it.
      
      Link: http://lkml.kernel.org/r/153060031527.26631.18306637892746301555.stgit@pluto.themaw.net
      Signed-off-by: default avatarTomas Bortoli <tomasbortoli@gmail.com>
      Signed-off-by: default avatarIan Kent <raven@themaw.net>
      Reported-by: default avatar <syzbot+60c837b428dc84e83a93@syzkaller.appspotmail.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      02f51d45
    • Vlastimil Babka's avatar
      fs/proc/task_mmu.c: fix Locked field in /proc/pid/smaps* · e70cc2bd
      Vlastimil Babka authored
      Thomas reports:
       "While looking around in /proc on my v4.14.52 system I noticed that all
        processes got a lot of "Locked" memory in /proc/*/smaps. A lot more
        memory than a regular user can usually lock with mlock().
      
        Commit 493b0e9d (in v4.14-rc1) seems to have changed the behavior
        of "Locked".
      
        Before that commit the code was like this. Notice the VM_LOCKED check.
      
                 (vma->vm_flags & VM_LOCKED) ?
                      (unsigned long)(mss.pss >> (10 + PSS_SHIFT)) : 0);
      
        After that commit Locked is now the same as Pss:
      
      	  (unsigned long)(mss->pss >> (10 + PSS_SHIFT)));
      
        This looks like a mistake."
      
      Indeed, the commit has added mss->pss_locked with the correct value that
      depends on VM_LOCKED, but forgot to actually use it.  Fix it.
      
      Link: http://lkml.kernel.org/r/ebf6c7fb-fec3-6a26-544f-710ed193c154@suse.cz
      Fixes: 493b0e9d
      
       ("mm: add /proc/pid/smaps_rollup")
      Signed-off-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Reported-by: default avatarThomas Lindroth <thomas.lindroth@gmail.com>
      Cc: Alexey Dobriyan <adobriyan@gmail.com>
      Cc: Daniel Colascione <dancol@google.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e70cc2bd
    • Christian Borntraeger's avatar
      mm: do not drop unused pages when userfaultd is running · bce73e48
      Christian Borntraeger authored
      
      
      KVM guests on s390 can notify the host of unused pages.  This can result
      in pte_unused callbacks to be true for KVM guest memory.
      
      If a page is unused (checked with pte_unused) we might drop this page
      instead of paging it.  This can have side-effects on userfaultd, when
      the page in question was already migrated:
      
      The next access of that page will trigger a fault and a user fault
      instead of faulting in a new and empty zero page.  As QEMU does not
      expect a userfault on an already migrated page this migration will fail.
      
      The most straightforward solution is to ignore the pte_unused hint if a
      userfault context is active for this VMA.
      
      Link: http://lkml.kernel.org/r/20180703171854.63981-1-borntraeger@de.ibm.com
      Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
      Cc: Janosch Frank <frankja@linux.ibm.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Cornelia Huck <cohuck@redhat.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      bce73e48
    • Pavel Tatashin's avatar
      mm: zero unavailable pages before memmap init · e181ae0c
      Pavel Tatashin authored
      We must zero struct pages for memory that is not backed by physical
      memory, or kernel does not have access to.
      
      Recently, there was a change which zeroed all memmap for all holes in
      e820.  Unfortunately, it introduced a bug that is discussed here:
      
        https://www.spinics.net/lists/linux-mm/msg156764.html
      
      Linus, also saw this bug on his machine, and confirmed that reverting
      commit 124049de ("x86/e820: put !E820_TYPE_RAM regions into
      memblock.reserved") fixes the issue.
      
      The problem is that we incorrectly zero some struct pages after they
      were setup.
      
      The fix is to zero unavailable struct pages prior to initializing of
      struct pages.
      
      A more detailed fix should come later that would avoid double zeroing
      cases: one in __init_single_page(), the other one in
      zero_resv_unavail().
      
      Fixes: 124049de
      
       ("x86/e820: put !E820_TYPE_RAM regions into memblock.reserved")
      Signed-off-by: default avatarPavel Tatashin <pasha.tatashin@oracle.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e181ae0c
  5. Jul 14, 2018
    • Linus Torvalds's avatar
      Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · 2db39a2f
      Linus Torvalds authored
      Pull i2c fixes from Wolfram Sang:
      
       - I2C core bugfix regarding bus recovery
      
       - driver bugfix for the tegra driver
      
       - typo correction
      
      * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
        i2c: recovery: if possible send STOP with recovery pulses
        i2c: tegra: Fix NACK error handling
        i2c: stu300: use non-archaic spelling of failes
      2db39a2f
    • Linus Torvalds's avatar
      Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 3951dbf2
      Linus Torvalds authored
      Pull timer fixes from Ingo Molnar:
       "A clocksource driver fix and a revert"
      
      * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        clocksource: arm_arch_timer: Set arch_mem_timer cpumask to cpu_possible_mask
        Revert "tick: Prefer a lower rating device only if it's CPU local device"
      3951dbf2
    • Linus Torvalds's avatar
      Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · aa0a3247
      Linus Torvalds authored
      Pull perf tool fixes from Ingo Molnar:
       "Misc tooling fixes: python3 related fixes, gcc8 fix, bashism fixes and
        some other smaller fixes"
      
      * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf tools: Use python-config --includes rather than --cflags
        perf script python: Fix dict reference counting
        perf stat: Fix --interval_clear option
        perf tools: Fix compilation errors on gcc8
        perf test shell: Prevent temporary editor files from being considered test scripts
        perf llvm-utils: Remove bashism from kernel include fetch script
        perf test shell: Make perf's inet_pton test more portable
        perf test shell: Replace '|&' with '2>&1 |' to work with more shells
        perf scripts python: Add Python 3 support to EventClass.py
        perf scripts python: Add Python 3 support to sched-migration.py
        perf scripts python: Add Python 3 support to Util.py
        perf scripts python: Add Python 3 support to SchedGui.py
        perf scripts python: Add Python 3 support to Core.py
        perf tools: Generate a Python script compatible with Python 2 and 3
      aa0a3247
    • Linus Torvalds's avatar
      Merge branch 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 75adbd13
      Linus Torvalds authored
      Pull EFI fix from Ingo Molnar:
       "Fix a UEFI mixed mode (64-bit kernel on 32-bit UEFI) reboot loop
        regression"
      
      * 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        efi/x86: Fix mixed mode reboot loop by removing pointless call to PciIo->Attributes()
      75adbd13
    • Linus Torvalds's avatar
      Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · ae4ea397
      Linus Torvalds authored
      Pull rseq fixes from Ingo Molnar:
       "Various rseq ABI fixes and cleanups: use get_user()/put_user(),
        validate parameters and use proper uapi types, etc"
      
      * 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        rseq/selftests: cleanup: Update comment above rseq_prepare_unload
        rseq: Remove unused types_32_64.h uapi header
        rseq: uapi: Declare rseq_cs field as union, update includes
        rseq: uapi: Update uapi comments
        rseq: Use get_user/put_user rather than __get_user/__put_user
        rseq: Use __u64 for rseq_cs fields, validate user inputs
      ae4ea397
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma · 4659fc84
      Linus Torvalds authored
      Pull rdma fixes from Jason Gunthorpe:
       "Things have been quite slow, only 6 RC patches have been sent to the
        list. Regression, user visible bugs, and crashing fixes:
      
         - cxgb4 could wrongly fail MR creation due to a typo
      
         - various crashes if the wrong QP type is mixed in with APIs that
           expect other types
      
         - syzkaller oops
      
         - using ERR_PTR and NULL together cases HFI1 to crash in some cases
      
         - mlx5 memory leak in error unwind"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma:
        RDMA/mlx5: Fix memory leak in mlx5_ib_create_srq() error path
        RDMA/uverbs: Don't fail in creation of multiple flows
        IB/hfi1: Fix incorrect mixing of ERR_PTR and NULL return values
        RDMA/uverbs: Fix slab-out-of-bounds in ib_uverbs_ex_create_flow
        RDMA/uverbs: Protect from attempts to create flows on unsupported QP
        iw_cxgb4: correctly enforce the max reg_mr depth
      4659fc84
    • Linus Torvalds's avatar
      Merge tag 'vfio-v4.18-rc5' of git://github.com/awilliam/linux-vfio · 2a7e1211
      Linus Torvalds authored
      Pull VFIO fix from Alex Williamson:
       "Fix deadlock in mbochs sample driver (Alexey Khoroshilov)"
      
      * tag 'vfio-v4.18-rc5' of git://github.com/awilliam/linux-vfio:
        sample: vfio-mdev: avoid deadlock in mdev_access()
      2a7e1211
    • Linus Torvalds's avatar
      Merge tag 'kbuild-fixes-v4.18-2' of... · 79facf30
      Linus Torvalds authored
      Merge tag 'kbuild-fixes-v4.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
      
      Pull Kbuild fixes from Masahiro Yamada:
      
       - update Kbuild and Kconfig documents
      
       - sanitize -I compiler option handling
      
       - update extract-vmlinux script to recognize LZ4 and ZSTD
      
       - fix tools Makefiles
      
       - update tags.sh to handle __ro_after_init
      
       - suppress warnings in case getconf does not recognize LFS_* parameters
      
      * tag 'kbuild-fixes-v4.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
        kbuild: suppress warnings from 'getconf LFS_*'
        scripts/tags.sh: add __ro_after_init
        tools: build: Use HOSTLDFLAGS with fixdep
        tools: build: Fixup host c flags
        tools build: fix # escaping in .cmd files for future Make
        scripts: teach extract-vmlinux about LZ4 and ZSTD
        kbuild: remove duplicated comments about PHONY
        kbuild: .PHONY is not a variable, but PHONY is
        kbuild: do not drop -I without parameter
        kbuild: document the KBUILD_KCONFIG env. variable
        kconfig: update user kconfig tools doc.
        kbuild: delete INSTALL_FW_PATH from kbuild documentation
        kbuild: update ARCH alias info for sparc
        kbuild: update ARCH alias info for sh
      79facf30
    • Linus Torvalds's avatar
      Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux · 9d2e3489
      Linus Torvalds authored
      Pull arm64 fixes from Will Deacon:
       "Catalin's out enjoying the sunshine, so I'm sending the fixes for a
        couple of weeks (although there hopefully won't be any more!).
      
        We've got a revert of a previous fix because it broke the build with
        some distro toolchains and a preemption fix when detemining whether or
        not the SIMD unit is in use.
      
        Summary:
      
         - Revert back to the 'linux' target for LD, as 'elf' breaks some
           distributions
      
         - Fix preemption race when testing whether the vector unit is in use
           or not"
      
      * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
        arm64: neon: Fix function may_use_simd() return error status
        Revert "arm64: Use aarch64elf and aarch64elfb emulation mode variants"
      9d2e3489