1. 03 Mar, 2018 11 commits
    • Arnaldo Carvalho de Melo's avatar
      x86/asm: Allow again using asm.h when building for the 'bpf' clang target · 9a5bd36c
      Arnaldo Carvalho de Melo authored
      
      [ Upstream commit ca26cffa ]
      
      Up to f5caf621 ("x86/asm: Fix inline asm call constraints for Clang")
      we were able to use x86 headers to build to the 'bpf' clang target, as
      done by the BPF code in tools/perf/.
      
      With that commit, we ended up with following failure for 'perf test LLVM', this
      is because "clang ... -target bpf ..." fails since 4.0 does not have bpf inline
      asm support and 6.0 does not recognize the register 'esp', fix it by guarding
      that part with an #ifndef __BPF__, that is defined by clang when building to
      the "bpf" target.
      
        # perf test -v LLVM
        37: LLVM search and compile                               :
        37.1: Basic BPF llvm compile                              :
        --- start ---
        test child forked, pid 25526
        Kernel build dir is set to /lib/modules/4.14.0+/build
        set env: KBUILD_DIR=/lib/modules/4.14.0+/build
        unset env: KBUILD_OPTS
        include option is set to  -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/7/include -I/home/acme/git/linux/arch/x86/include -I./arch/x86/include/generated  -I/home/acme/git/linux/include -I./include -I/home/acme/git/linux/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/home/acme/git/linux/include/uapi -I./include/generated/uapi -include /home/acme/git/linux/include/linux/kconfig.h
        set env: NR_CPUS=4
        set env: LINUX_VERSION_CODE=0x40e00
        set env: CLANG_EXEC=/usr/local/bin/clang
        set env: CLANG_OPTIONS=-xc
        set env: KERNEL_INC_OPTIONS= -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/7/include -I/home/acme/git/linux/arch/x86/include -I./arch/x86/include/generated  -I/home/acme/git/linux/include -I./include -I/home/acme/git/linux/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/home/acme/git/linux/include/uapi -I./include/generated/uapi -include /home/acme/git/linux/include/linux/kconfig.h
        set env: WORKING_DIR=/lib/modules/4.14.0+/build
        set env: CLANG_SOURCE=-
        llvm compiling command template: echo '/*
         * bpf-script-example.c
         * Test basic LLVM building
         */
        #ifndef LINUX_VERSION_CODE
        # error Need LINUX_VERSION_CODE
        # error Example: for 4.2 kernel, put 'clang-opt="-DLINUX_VERSION_CODE=0x40200" into llvm section of ~/.perfconfig'
        #endif
        #define BPF_ANY 0
        #define BPF_MAP_TYPE_ARRAY 2
        #define BPF_FUNC_map_lookup_elem 1
        #define BPF_FUNC_map_update_elem 2
      
        static void *(*bpf_map_lookup_elem)(void *map, void *key) =
      	  (void *) BPF_FUNC_map_lookup_elem;
        static void *(*bpf_map_update_elem)(void *map, void *key, void *value, int flags) =
      	  (void *) BPF_FUNC_map_update_elem;
      
        struct bpf_map_def {
      	  unsigned int type;
      	  unsigned int key_size;
      	  unsigned int value_size;
      	  unsigned int max_entries;
        };
      
        #define SEC(NAME) __attribute__((section(NAME), used))
        struct bpf_map_def SEC("maps") flip_table = {
      	  .type = BPF_MAP_TYPE_ARRAY,
      	  .key_size = sizeof(int),
      	  .value_size = sizeof(int),
      	  .max_entries = 1,
        };
      
        SEC("func=SyS_epoll_wait")
        int bpf_func__SyS_epoll_wait(void *ctx)
        {
      	  int ind =0;
      	  int *flag = bpf_map_lookup_elem(&flip_table, &ind);
      	  int new_flag;
      	  if (!flag)
      		  return 0;
      	  /* flip flag and store back */
      	  new_flag = !*flag;
      	  bpf_map_update_elem(&flip_table, &ind, &new_flag, BPF_ANY);
      	  return new_flag;
        }
        char _license[] SEC("license") = "GPL";
        int _version SEC("version") = LINUX_VERSION_CODE;
        ' | $CLANG_EXEC -D__KERNEL__ -D__NR_CPUS__=$NR_CPUS -DLINUX_VERSION_CODE=$LINUX_VERSION_CODE $CLANG_OPTIONS $KERNEL_INC_OPTIONS -Wno-unused-value -Wno-pointer-sign -working-directory $WORKING_DIR -c "$CLANG_SOURCE" -target bpf -O2 -o -
        test child finished with 0
        ---- end ----
        LLVM search and compile subtest 0: Ok
        37.2: kbuild searching                                    :
        --- start ---
        test child forked, pid 25950
        Kernel build dir is set to /lib/modules/4.14.0+/build
        set env: KBUILD_DIR=/lib/modules/4.14.0+/build
        unset env: KBUILD_OPTS
        include option is set to  -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/7/include -I/home/acme/git/linux/arch/x86/include -I./arch/x86/include/generated  -I/home/acme/git/linux/include -I./include -I/home/acme/git/linux/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/home/acme/git/linux/include/uapi -I./include/generated/uapi -include /home/acme/git/linux/include/linux/kconfig.h
        set env: NR_CPUS=4
        set env: LINUX_VERSION_CODE=0x40e00
        set env: CLANG_EXEC=/usr/local/bin/clang
        set env: CLANG_OPTIONS=-xc
        set env: KERNEL_INC_OPTIONS= -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/7/include -I/home/acme/git/linux/arch/x86/include -I./arch/x86/include/generated  -I/home/acme/git/linux/include -I./include -I/home/acme/git/linux/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/home/acme/git/linux/include/uapi -I./include/generated/uapi -include /home/acme/git/linux/include/linux/kconfig.h
        set env: WORKING_DIR=/lib/modules/4.14.0+/build
        set env: CLANG_SOURCE=-
        llvm compiling command template: echo '/*
         * bpf-script-test-kbuild.c
         * Test include from kernel header
         */
        #ifndef LINUX_VERSION_CODE
        # error Need LINUX_VERSION_CODE
        # error Example: for 4.2 kernel, put 'clang-opt="-DLINUX_VERSION_CODE=0x40200" into llvm section of ~/.perfconfig'
        #endif
        #define SEC(NAME) __attribute__((section(NAME), used))
      
        #include <uapi/linux/fs.h>
        #include <uapi/asm/ptrace.h>
      
        SEC("func=vfs_llseek")
        int bpf_func__vfs_llseek(void *ctx)
        {
      	  return 0;
        }
      
        char _license[] SEC("license") = "GPL";
        int _version SEC("version") = LINUX_VERSION_CODE;
        ' | $CLANG_EXEC -D__KERNEL__ -D__NR_CPUS__=$NR_CPUS -DLINUX_VERSION_CODE=$LINUX_VERSION_CODE $CLANG_OPTIONS $KERNEL_INC_OPTIONS -Wno-unused-value -Wno-pointer-sign -working-directory $WORKING_DIR -c "$CLANG_SOURCE" -target bpf -O2 -o -
        In file included from <stdin>:12:
        In file included from /home/acme/git/linux/arch/x86/include/uapi/asm/ptrace.h:5:
        In file included from /home/acme/git/linux/include/linux/compiler.h:242:
        In file included from /home/acme/git/linux/arch/x86/include/asm/barrier.h:5:
        In file included from /home/acme/git/linux/arch/x86/include/asm/alternative.h:10:
        /home/acme/git/linux/arch/x86/include/asm/asm.h:145:50: error: unknown register name 'esp' in asm
        register unsigned long current_stack_pointer asm(_ASM_SP);
                                                         ^
        /home/acme/git/linux/arch/x86/include/asm/asm.h:44:18: note: expanded from macro '_ASM_SP'
        #define _ASM_SP         __ASM_REG(sp)
                                ^
        /home/acme/git/linux/arch/x86/include/asm/asm.h:27:32: note: expanded from macro '__ASM_REG'
        #define __ASM_REG(reg)         __ASM_SEL_RAW(e##reg, r##reg)
                                       ^
        /home/acme/git/linux/arch/x86/include/asm/asm.h:18:29: note: expanded from macro '__ASM_SEL_RAW'
        # define __ASM_SEL_RAW(a,b) __ASM_FORM_RAW(a)
                                    ^
        /home/acme/git/linux/arch/x86/include/asm/asm.h:11:32: note: expanded from macro '__ASM_FORM_RAW'
        # define __ASM_FORM_RAW(x)     #x
                                       ^
        <scratch space>:4:1: note: expanded from here
        "esp"
        ^
        1 error generated.
        ERROR:	unable to compile -
        Hint:	Check error message shown above.
        Hint:	You can also pre-compile it into .o using:
           		  clang -target bpf -O2 -c -
           	  with proper -I and -D options.
        Failed to compile test case: 'kbuild searching'
        test child finished with -1
        ---- end ----
        LLVM search and compile subtest 1: FAILED!
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Dmitriy Vyukov <dvyukov@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Matthias Kaehlcke <mka@chromium.org>
      Cc: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Wang Nan <wangnan0@huawei.com>
      Cc: Yonghong Song <yhs@fb.com>
      Link: https://lkml.kernel.org/r/20171128175948.GL3298@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9a5bd36c
    • Chunyan Zhang's avatar
      ARM: 8731/1: Fix csum_partial_copy_from_user() stack mismatch · db1e8814
      Chunyan Zhang authored
      
      [ Upstream commit 36b0cb84 ]
      
      An additional 'ip' will be pushed to the stack, for restoring the
      DACR later, if CONFIG_CPU_SW_DOMAIN_PAN defined.
      
      However, the fixup still get the err_ptr by add #8*4 to sp, which
      results in the fact that the code area pointed by the LR will be
      overwritten, or the kernel will crash if CONFIG_DEBUG_RODATA is enabled.
      
      This patch fixes the stack mismatch.
      
      Fixes: a5e090ac ("ARM: software-based priviledged-no-access support")
      Signed-off-by: default avatarLvqiang Huang <Lvqiang.Huang@spreadtrum.com>
      Signed-off-by: default avatarChunyan Zhang <zhang.lyra@gmail.com>
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      db1e8814
    • Brendan McGrath's avatar
      ipv6: icmp6: Allow icmp messages to be looped back · 3cf31f5b
      Brendan McGrath authored
      
      [ Upstream commit 588753f1 ]
      
      One example of when an ICMPv6 packet is required to be looped back is
      when a host acts as both a Multicast Listener and a Multicast Router.
      
      A Multicast Router will listen on address ff02::16 for MLDv2 messages.
      
      Currently, MLDv2 messages originating from a Multicast Listener running
      on the same host as the Multicast Router are not being delivered to the
      Multicast Router. This is due to dst.input being assigned the default
      value of dst_discard.
      
      This results in the packet being looped back but discarded before being
      delivered to the Multicast Router.
      
      This patch sets dst.input to ip6_input to ensure a looped back packet
      is delivered to the Multicast Router.
      Signed-off-by: default avatarBrendan McGrath <redmcg@redmandi.dyndns.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3cf31f5b
    • Albert Hsieh's avatar
      mtd: nand: brcmnand: Zero bitflip is not an error · e88872ef
      Albert Hsieh authored
      
      [ Upstream commit e44b9a9c ]
      
      A negative return value of brcmstb_nand_verify_erased_page() indicates a
      real bitflip error of an erased page, and other return values (>= 0) show
      the corrected bitflip number. Zero return value means no bitflip, but the
      current driver code treats it as an error, and eventually leads to
      falsely reported ECC error.
      
      Fixes: 02b88eea ("mtd: brcmnand: Add check for erased page bitflip")
      Signed-off-by: default avatarAlbert Hsieh <wen.hsieh@broadcom.com>
      Acked-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e88872ef
    • Sascha Hauer's avatar
      mtd: nand: gpmi: Fix failure when a erased page has a bitflip at BBM · dd1e39f4
      Sascha Hauer authored
      
      [ Upstream commit fdf2e821 ]
      
      When erased subpages are read then the BCH decoder returns STATUS_ERASED
      if they are all empty, or STATUS_UNCORRECTABLE if there are bitflips.
      When there are bitflips, we have to set these bits again to show the
      upper layers a completely erased page. When a bitflip happens in the
      exact byte where the bad block marker is, then this byte is swapped
      with another byte in block_mark_swapping(). The correction code then
      detects a bitflip in another subpage and no longer corrects the bitflip
      where it really happens.
      
      Correct this behaviour by calling block_mark_swapping() after the
      bitflips have been corrected.
      
      In our case UBIFS failed with this bug because it expects erased
      pages to be really empty:
      
      UBIFS error (pid 187): ubifs_scan: corrupt empty space at LEB 36:118735
      UBIFS error (pid 187): ubifs_scanned_corruption: corruption at LEB 36:118735
      UBIFS error (pid 187): ubifs_scanned_corruption: first 8192 bytes from LEB 36:118735
      UBIFS error (pid 187): ubifs_scan: LEB 36 scanning failed
      UBIFS error (pid 187): do_commit: commit failed, error -117
      Signed-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
      Reviewed-by: default avatarRichard Weinberger <richard@nod.at>
      Acked-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dd1e39f4
    • Daniele Palmas's avatar
      net: usb: qmi_wwan: add Telit ME910 PID 0x1101 support · 83c5a935
      Daniele Palmas authored
      
      [ Upstream commit c647c0d6 ]
      
      This patch adds support for Telit ME910 PID 0x1101.
      Signed-off-by: default avatarDaniele Palmas <dnlplm@gmail.com>
      Acked-by: default avatarBjørn Mork <bjorn@mork.no>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      83c5a935
    • Keith Busch's avatar
      nvme: check hw sectors before setting chunk sectors · d4ea6118
      Keith Busch authored
      
      [ Upstream commit 249159c5 ]
      
      Some devices with IDs matching the "stripe" quirk don't actually have
      this quirk, and don't have an MDTS value. When MDTS is not set, the
      driver sets the max sectors to UINT_MAX, which is not a power of 2,
      hitting a BUG_ON from blk_queue_chunk_sectors. This patch skips setting
      chunk sectors for such devices.
      Signed-off-by: default avatarKeith Busch <keith.busch@intel.com>
      Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d4ea6118
    • Andreas Platschek's avatar
      dmaengine: fsl-edma: disable clks on all error paths · 051337a8
      Andreas Platschek authored
      
      [ Upstream commit 2610acf4 ]
      
      Previously enabled clks are only disabled if clk_prepare_enable() fails.
      However, there are other error paths were the previously enabled
      clocks are not disabled.
      
      To fix the problem, fsl_disable_clocks() now takes the number of clocks
      that shall be disabled + unprepared. For existing calls were all clocks
      were already successfully prepared + enabled, DMAMUX_NR is passed to
      disable + unprepare all clocks.
      
      In error paths were only some clocks were successfully prepared +
      enabled the loop counter is passed, in order to disable + unprepare
      all successfully prepared + enabled clocks.
      
      Found by Linux Driver Verification project (linuxtesting.org).
      Signed-off-by: default avatarAndreas Platschek <andreas.platschek@opentech.at>
      Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      051337a8
    • Yunlei He's avatar
      f2fs: fix a bug caused by NULL extent tree · 4a97b2d0
      Yunlei He authored
      commit dad48e73 upstream.
      
      Thread A:					Thread B:
      
      -f2fs_remount
          -sbi->mount_opt.opt = 0;
      						<--- -f2fs_iget
      						         -do_read_inode
      							     -f2fs_init_extent_tree
      							         -F2FS_I(inode)->extent_tree is NULL
              -default_options && parse_options
      	    -remount return
      						<---  -f2fs_map_blocks
      						          -f2fs_lookup_extent_tree
                                                                    -f2fs_bug_on(sbi, !et);
      
      The same problem with f2fs_new_inode.
      Signed-off-by: default avatarYunlei He <heyunlei@huawei.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4a97b2d0
    • Ben Gardner's avatar
      i2c: designware: must wait for enable · b4e0649e
      Ben Gardner authored
      commit fba4adbb upstream.
      
      One I2C bus on my Atom E3845 board has been broken since 4.9.
      It has two devices, both declared by ACPI and with built-in drivers.
      
      There are two back-to-back transactions originating from the kernel, one
      targeting each device. The first transaction works, the second one locks
      up the I2C controller. The controller never recovers.
      
      These kernel logs show up whenever an I2C transaction is attempted after
      this failure.
      i2c-designware-pci 0000:00:18.3: timeout in disabling adapter
      i2c-designware-pci 0000:00:18.3: timeout waiting for bus ready
      
      Waiting for the I2C controller status to indicate that it is enabled
      before programming it fixes the issue.
      
      I have tested this patch on 4.14 and 4.15.
      
      Fixes: commit 2702ea7d ("i2c: designware: wait for disable/enable only if necessary")
      Cc: linux-stable <stable@vger.kernel.org> #4.13+
      Signed-off-by: default avatarBen Gardner <gardner.ben@gmail.com>
      Acked-by: default avatarJarkko Nikula <jarkko.nikula@linux.intel.com>
      Reviewed-by: default avatarJosé Roberto de Souza <jose.souza@intel.com>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      Signed-off-by: default avatarBen Gardner <gardner.ben@gmail.com>
      [Jarkko: Backported to v4.9..v4.12 before i2c-designware-core.c was renamed to i2c-designware-master.c]
      Signed-off-by: default avatarJarkko Nikula <jarkko.nikula@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b4e0649e
    • Anna-Maria Gleixner's avatar
      hrtimer: Ensure POSIX compliance (relative CLOCK_REALTIME hrtimers) · 5a9f69b2
      Anna-Maria Gleixner authored
      commit 48d0c9be upstream.
      
      The POSIX specification defines that relative CLOCK_REALTIME timers are not
      affected by clock modifications. Those timers have to use CLOCK_MONOTONIC
      to ensure POSIX compliance.
      
      The introduction of the additional HRTIMER_MODE_PINNED mode broke this
      requirement for pinned timers.
      
      There is no user space visible impact because user space timers are not
      using pinned mode, but for consistency reasons this needs to be fixed.
      
      Check whether the mode has the HRTIMER_MODE_REL bit set instead of
      comparing with HRTIMER_MODE_ABS.
      Signed-off-by: default avatarAnna-Maria Gleixner <anna-maria@linutronix.de>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: keescook@chromium.org
      Fixes: 597d0275 ("timers: Framework for identifying pinned timers")
      Link: http://lkml.kernel.org/r/20171221104205.7269-7-anna-maria@linutronix.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5a9f69b2
  2. 28 Feb, 2018 29 commits