1. 03 Jul, 2019 7 commits
    • Dominique Martinet's avatar
      9p/xen: fix check for xenbus_read error in front_probe · f8bc5f1a
      Dominique Martinet authored
      [ Upstream commit 2f9ad0ac ]
      
      If the xen bus exists but does not expose the proper interface, it is
      possible to get a non-zero length but still some error, leading to
      strcmp failing trying to load invalid memory addresses e.g.
      fffffffffffffffe.
      
      There is then no need to check length when there is no error, as the
      xenbus driver guarantees that the string is nul-terminated.
      
      Link: http://lkml.kernel.org/r/1534236007-10170-1-git-send-email-asmadeus@codewreck.orgSigned-off-by: default avatarDominique Martinet <dominique.martinet@cea.fr>
      Reviewed-by: default avatarStefano Stabellini <sstabellini@kernel.org>
      Cc: Eric Van Hensbergen <ericvh@gmail.com>
      Cc: Latchesar Ionkov <lucho@ionkov.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f8bc5f1a
    • Mike Marciniszyn's avatar
      IB/hfi1: Close PSM sdma_progress sleep window · a8782ce0
      Mike Marciniszyn authored
      commit da9de5f8 upstream.
      
      The call to sdma_progress() is called outside the wait lock.
      
      In this case, there is a race condition where sdma_progress() can return
      false and the sdma_engine can idle.  If that happens, there will be no
      more sdma interrupts to cause the wakeup and the user_sdma xmit will hang.
      
      Fix by moving the lock to enclose the sdma_progress() call.
      
      Also, delete busycount. The need for this was removed by:
      commit bcad2913 ("IB/hfi1: Serve the most starved iowait entry first")
      
      Ported to linux-4.19.y.
      
      Cc: <stable@vger.kernel.org>
      Fixes: 77241056 ("IB/hfi1: add driver files")
      Reviewed-by: default avatarGary Leshner <Gary.S.Leshner@intel.com>
      Signed-off-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
      Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a8782ce0
    • Sasha Levin's avatar
      Revert "x86/uaccess, ftrace: Fix ftrace_likely_update() vs. SMAP" · fec1a13b
      Sasha Levin authored
      This reverts commit 1a3188d7, which was
      upstream commit 4a6c91fb.
      
      On Tue, Jun 25, 2019 at 09:39:45AM +0200, Sebastian Andrzej Siewior wrote:
      >Please backport commit e74deb11 to
      >stable _or_ revert the backport of commit 4a6c91fb ("x86/uaccess,
      >ftrace: Fix ftrace_likely_update() vs. SMAP"). It uses
      >user_access_{save|restore}() which has been introduced in the following
      >commit.
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fec1a13b
    • Nathan Chancellor's avatar
      arm64: Don't unconditionally add -Wno-psabi to KBUILD_CFLAGS · 85a3b1ef
      Nathan Chancellor authored
      commit fa63da2a upstream.
      
      This is a GCC only option, which warns about ABI changes within GCC, so
      unconditionally adding it breaks Clang with tons of:
      
      warning: unknown warning option '-Wno-psabi' [-Wunknown-warning-option]
      
      and link time failures:
      
      ld.lld: error: undefined symbol: __efistub___stack_chk_guard
      >>> referenced by arm-stub.c:73
      (/home/nathan/cbl/linux/drivers/firmware/efi/libstub/arm-stub.c:73)
      >>>               arm-stub.stub.o:(__efistub_install_memreserve_table)
      in archive ./drivers/firmware/efi/libstub/lib.a
      
      These failures come from the lack of -fno-stack-protector, which is
      added via cc-option in drivers/firmware/efi/libstub/Makefile. When an
      unknown flag is added to KBUILD_CFLAGS, clang will noisily warn that it
      is ignoring the option like above, unlike gcc, who will just error.
      
      $ echo "int main() { return 0; }" > tmp.c
      
      $ clang -Wno-psabi tmp.c; echo $?
      warning: unknown warning option '-Wno-psabi' [-Wunknown-warning-option]
      1 warning generated.
      0
      
      $ gcc -Wsometimes-uninitialized tmp.c; echo $?
      gcc: error: unrecognized command line option
      ‘-Wsometimes-uninitialized’; did you mean ‘-Wmaybe-uninitialized’?
      1
      
      For cc-option to work properly with clang and behave like gcc, -Werror
      is needed, which was done in commit c3f0d0bc ("kbuild, LLVMLinux:
      Add -Werror to cc-option to support clang").
      
      $ clang -Werror -Wno-psabi tmp.c; echo $?
      error: unknown warning option '-Wno-psabi'
      [-Werror,-Wunknown-warning-option]
      1
      
      As a consequence of this, when an unknown flag is unconditionally added
      to KBUILD_CFLAGS, it will cause cc-option to always fail and those flags
      will never get added:
      
      $ clang -Werror -Wno-psabi -fno-stack-protector tmp.c; echo $?
      error: unknown warning option '-Wno-psabi'
      [-Werror,-Wunknown-warning-option]
      1
      
      This can be seen when compiling the whole kernel as some warnings that
      are normally disabled (see below) show up. The full list of flags
      missing from drivers/firmware/efi/libstub are the following (gathered
      from diffing .arm64-stub.o.cmd):
      
      -fno-delete-null-pointer-checks
      -Wno-address-of-packed-member
      -Wframe-larger-than=2048
      -Wno-unused-const-variable
      -fno-strict-overflow
      -fno-merge-all-constants
      -fno-stack-check
      -Werror=date-time
      -Werror=incompatible-pointer-types
      -ffreestanding
      -fno-stack-protector
      
      Use cc-disable-warning so that it gets disabled for GCC and does nothing
      for Clang.
      
      Fixes: ebcc5928 ("arm64: Silence gcc warnings about arch ABI drift")
      Link: https://github.com/ClangBuiltLinux/linux/issues/511Reported-by: default avatarQian Cai <cai@lca.pw>
      Acked-by: default avatarDave Martin <Dave.Martin@arm.com>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      85a3b1ef
    • Arnaldo Carvalho de Melo's avatar
      perf header: Fix unchecked usage of strncpy() · 6461a454
      Arnaldo Carvalho de Melo authored
      commit 5192bde7 upstream.
      
      The strncpy() function may leave the destination string buffer
      unterminated, better use strlcpy() that we have a __weak fallback
      implementation for systems without it.
      
      This fixes this warning on an Alpine Linux Edge system with gcc 8.2:
      
        util/header.c: In function 'perf_event__synthesize_event_update_name':
        util/header.c:3625:2: error: 'strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]
          strncpy(ev->data, evsel->name, len);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        util/header.c:3618:15: note: length computed here
          size_t len = strlen(evsel->name);
                       ^~~~~~~~~~~~~~~~~~~
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Fixes: a6e52817 ("perf tools: Add event_update event unit type")
      Link: https://lkml.kernel.org/n/tip-wycz66iy8dl2z3yifgqf894p@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6461a454
    • Arnaldo Carvalho de Melo's avatar
      perf help: Remove needless use of strncpy() · 0bf5d53b
      Arnaldo Carvalho de Melo authored
      commit b6313899 upstream.
      
      Since we make sure the destination buffer has at least strlen(orig) + 1,
      no need to do a strncpy(dest, orig, strlen(orig)), just use strcpy(dest,
      orig).
      
      This silences this gcc 8.2 warning on Alpine Linux:
      
        In function 'add_man_viewer',
            inlined from 'perf_help_config' at builtin-help.c:284:3:
        builtin-help.c:192:2: error: 'strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]
          strncpy((*p)->name, name, len);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        builtin-help.c: In function 'perf_help_config':
        builtin-help.c:187:15: note: length computed here
          size_t len = strlen(name);
                       ^~~~~~~~~~~~
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Fixes: 07800601 ("perf_counter tools: add in basic glue from Git")
      Link: https://lkml.kernel.org/n/tip-2f69l7drca427ob4km8i7kvo@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0bf5d53b
    • Arnaldo Carvalho de Melo's avatar
      perf ui helpline: Use strlcpy() as a shorter form of strncpy() + explicit set nul · 6e75d927
      Arnaldo Carvalho de Melo authored
      commit 4d0f16d0 upstream.
      
      The strncpy() function may leave the destination string buffer
      unterminated, better use strlcpy() that we have a __weak fallback
      implementation for systems without it.
      
      In this case we are actually setting the null byte at the right place,
      but since we pass the buffer size as the limit to strncpy() and not
      it minus one, gcc ends up warning us about that, see below. So, lets
      just switch to the shorter form provided by strlcpy().
      
      This fixes this warning on an Alpine Linux Edge system with gcc 8.2:
      
        ui/tui/helpline.c: In function 'tui_helpline__push':
        ui/tui/helpline.c:27:2: error: 'strncpy' specified bound 512 equals destination size [-Werror=stringop-truncation]
          strncpy(ui_helpline__current, msg, sz)[sz - 1] = '\0';
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        cc1: all warnings being treated as errors
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Fixes: e6e90468 ("perf ui: Introduce struct ui_helpline")
      Link: https://lkml.kernel.org/n/tip-d1wz0hjjsh19xbalw69qpytj@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6e75d927
  2. 25 Jun, 2019 33 commits