1. 27 11月, 2018 27 次提交
    • N
      arm64: percpu: Initialize ret in the default case · ee9b3813
      Nathan Chancellor 提交于
      [ Upstream commit b5bb4258 ]
      
      Clang warns that if the default case is taken, ret will be
      uninitialized.
      
      ./arch/arm64/include/asm/percpu.h:196:2: warning: variable 'ret' is used
      uninitialized whenever switch default is taken
      [-Wsometimes-uninitialized]
              default:
              ^~~~~~~
      ./arch/arm64/include/asm/percpu.h:200:9: note: uninitialized use occurs
      here
              return ret;
                     ^~~
      ./arch/arm64/include/asm/percpu.h:157:19: note: initialize the variable
      'ret' to silence this warning
              unsigned long ret, loop;
                               ^
                                = 0
      
      This warning appears several times while building the erofs filesystem.
      While it's not strictly wrong, the BUILD_BUG will prevent this from
      becoming a true problem. Initialize ret to 0 in the default case right
      before the BUILD_BUG to silence all of these warnings.
      Reported-by: NPrasad Sodagudi <psodagud@codeaurora.org>
      Signed-off-by: NNathan Chancellor <natechancellor@gmail.com>
      Reviewed-by: NNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: NDennis Zhou <dennis@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      ee9b3813
    • Y
      clk: meson-axg: pcie: drop the mpll3 clock parent · e252c95d
      Yixun Lan 提交于
      [ Upstream commit 69b93104c7ec5668019caf5d2dbfd0e182df06db ]
      
      We found the PCIe driver doesn't really work with
      the mpll3 clock which is actually reserved for debug,
      So drop it from the mux list.
      
      Fixes: 33b89db68236 ("clk: meson-axg: add clocks required by pcie driver")
      Tested-by: NJianxin Qin <jianxin.qin@amlogic.com>
      Signed-off-by: NYixun Lan <yixun.lan@amlogic.com>
      Signed-off-by: NJerome Brunet <jbrunet@baylibre.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      e252c95d
    • P
      platform/x86: acerhdf: Add BIOS entry for Gateway LT31 v1.3307 · e28f4634
      Paul Gortmaker 提交于
      [ Upstream commit 684238d79ad85c5e19a71bb5818e77e329912fbc ]
      
      To fix:
      
        acerhdf: unknown (unsupported) BIOS version Gateway  /LT31   /v1.3307 , please report, aborting!
      
      As can be seen in the context, the BIOS registers haven't changed in
      the previous versions, so the assumption is they won't have changed
      in this last update for this somewhat older platform either.
      
      Cc: Peter Feuerer <peter@piie.net>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Andy Shevchenko <andy@infradead.org>
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Reviewed-by: NPeter Feuerer <peter@piie.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      e28f4634
    • F
      x86/earlyprintk: Add a force option for pciserial device · 9f0e46bf
      Feng Tang 提交于
      [ Upstream commit d2266bbf ]
      
      The "pciserial" earlyprintk variant helps much on many modern x86
      platforms, but unfortunately there are still some platforms with PCI
      UART devices which have the wrong PCI class code. In that case, the
      current class code check does not allow for them to be used for logging.
      
      Add a sub-option "force" which overrides the class code check and thus
      the use of such device can be enforced.
      
       [ bp: massage formulations. ]
      Suggested-by: NBorislav Petkov <bp@alien8.de>
      Signed-off-by: NFeng Tang <feng.tang@intel.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: "Stuart R . Anderson" <stuart.r.anderson@intel.com>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Feng Tang <feng.tang@intel.com>
      Cc: Frederic Weisbecker <frederic@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: H Peter Anvin <hpa@linux.intel.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Kai-Heng Feng <kai.heng.feng@canonical.com>
      Cc: Kate Stewart <kstewart@linuxfoundation.org>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Philippe Ombredanne <pombredanne@nexb.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Thymo van Beers <thymovanbeers@gmail.com>
      Cc: alan@linux.intel.com
      Cc: linux-doc@vger.kernel.org
      Link: http://lkml.kernel.org/r/20181002164921.25833-1-feng.tang@intel.comSigned-off-by: NSasha Levin <sashal@kernel.org>
      9f0e46bf
    • Z
      apparmor: Fix uninitialized value in aa_split_fqname · c8a1685a
      Zubin Mithra 提交于
      [ Upstream commit 250f2da49cb8e582215a65c03f50e8ddf5cd119c ]
      
      Syzkaller reported a OOB-read with the stacktrace below. This occurs
      inside __aa_lookupn_ns as `n` is not initialized. `n` is obtained from
      aa_splitn_fqname. In cases where `name` is invalid, aa_splitn_fqname
      returns without initializing `ns_name` and `ns_len`.
      
      Fix this by always initializing `ns_name` and `ns_len`.
      
      	__dump_stack lib/dump_stack.c:77 [inline]
      	dump_stack+0x1c4/0x2b4 lib/dump_stack.c:113
      	print_address_description.cold.8+0x9/0x1ff mm/kasan/report.c:256
      	kasan_report_error mm/kasan/report.c:354 [inline]
      	kasan_report.cold.9+0x242/0x309 mm/kasan/report.c:412
      	__asan_report_load1_noabort+0x14/0x20 mm/kasan/report.c:430
      	memcmp+0xe3/0x160 lib/string.c:861
      	strnstr+0x4b/0x70 lib/string.c:934
      	__aa_lookupn_ns+0xc1/0x570 security/apparmor/policy_ns.c:209
      	aa_lookupn_ns+0x88/0x1e0 security/apparmor/policy_ns.c:240
      	aa_fqlookupn_profile+0x1b9/0x1010 security/apparmor/policy.c:468
      	fqlookupn_profile+0x80/0xc0 security/apparmor/label.c:1844
      	aa_label_strn_parse+0xa3a/0x1230 security/apparmor/label.c:1908
      	aa_label_parse+0x42/0x50 security/apparmor/label.c:1943
      	aa_change_profile+0x513/0x3510 security/apparmor/domain.c:1362
      	apparmor_setprocattr+0xaa4/0x1150 security/apparmor/lsm.c:658
      	security_setprocattr+0x66/0xc0 security/security.c:1298
      	proc_pid_attr_write+0x301/0x540 fs/proc/base.c:2555
      	__vfs_write+0x119/0x9f0 fs/read_write.c:485
      	vfs_write+0x1fc/0x560 fs/read_write.c:549
      	ksys_write+0x101/0x260 fs/read_write.c:598
      	__do_sys_write fs/read_write.c:610 [inline]
      	__se_sys_write fs/read_write.c:607 [inline]
      	__x64_sys_write+0x73/0xb0 fs/read_write.c:607
      	do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
      	entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      Fixes: 3b0aaf58 ("apparmor: add lib fn to find the "split" for fqnames")
      Reported-by: syzbot+61e4b490d9d2da591b50@syzkaller.appspotmail.com
      Signed-off-by: NZubin Mithra <zsm@chromium.org>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NJohn Johansen <john.johansen@canonical.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      c8a1685a
    • M
      clk: samsung: exynos5420: Enable PERIS clocks for suspend · 8b9cdb75
      Marek Szyprowski 提交于
      [ Upstream commit b33228029d842269e17bba591609e83ed422005d ]
      
      Ensure that clocks for core SoC modules (including TZPC0..9 modules)
      are enabled for suspend/resume cycle. This fixes suspend/resume
      support on Exynos5422-based Odroid XU3/XU4 boards.
      Suggested-by: NJoonyoung Shim <jy0922.shim@samsung.com>
      Signed-off-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      Signed-off-by: NSylwester Nawrocki <snawrocki@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      8b9cdb75
    • C
      fs/exofs: fix potential memory leak in mount option parsing · 33df9177
      Chengguang Xu 提交于
      [ Upstream commit 515f1867addaba49c1c6ac73abfaffbc192c1db4 ]
      
      There are some cases can cause memory leak when parsing
      option 'osdname'.
      Signed-off-by: NChengguang Xu <cgxu519@gmx.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      33df9177
    • D
      perf symbols: Set PLT entry/header sizes properly on Sparc · b7d1a786
      David Miller 提交于
      [ Upstream commit d6afa561e1471ccfdaf7191230c0c59a37e45a5b ]
      
      Using the sh_entsize for both values isn't correct.  It happens to be
      correct on x86...
      
      For both 32-bit and 64-bit sparc, there are four PLT entries in the PLT
      section.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
      Cc: David Tolnay <dtolnay@gmail.com>
      Cc: Hanjun Guo <guohanjun@huawei.com>
      Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
      Cc: Li Bin <huawei.libin@huawei.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Milian Wolff <milian.wolff@kdab.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Cc: zhangmengting@huawei.com
      Fixes: b2f76050 ("perf symbols: Fix plt entry calculation for ARM and AARCH64")
      Link: http://lkml.kernel.org/r/20181017.120859.2268840244308635255.davem@davemloft.netSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      b7d1a786
    • A
      clk: fixed-rate: fix of_node_get-put imbalance · 070bbd57
      Alan Tull 提交于
      [ Upstream commit 52091c256bdcad0d01e2852a63f19cd2cce6af96 ]
      
      When the fixed rate clock is created by devicetree,
      of_clk_add_provider is called.  Add a call to
      of_clk_del_provider in the remove function to balance
      it out.
      Signed-off-by: NAlan Tull <atull@kernel.org>
      Fixes: 435779fe ("clk: fixed-rate: Convert into a module platform driver")
      Signed-off-by: NStephen Boyd <sboyd@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      070bbd57
    • R
      platform/x86: intel_telemetry: report debugfs failure · c80506fa
      Rajneesh Bhardwaj 提交于
      [ Upstream commit 8d98b1ef368feeb7720b8b9b6f3bd93f2ad892bc ]
      
      On some Goldmont based systems such as ASRock J3455M the BIOS may not
      enable the IPC1 device that provides access to the PMC and PUNIT. In
      such scenarios, the IOSS and PSS resources from the platform device can
      not be obtained and result in a invalid telemetry_plt_config which is an
      internal data structure that holds platform config and is maintained by
      the telemetry platform driver.
      
      This is also applicable to the platforms where the BIOS supports IPC1
      device under debug configurations but IPC1 is disabled by user or the
      policy.
      
      This change allows user to know the reason for not seeing entries under
      /sys/kernel/debug/telemetry/* when there is no apparent failure at boot.
      
      Cc: Matt Turner <matt.turner@intel.com>
      Cc: Len Brown <len.brown@intel.com>
      Cc: Souvik Kumar Chakravarty <souvik.k.chakravarty@intel.com>
      Cc: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@intel.com>
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=198779Acked-by: NMatt Turner <matt.turner@intel.com>
      Signed-off-by: NRajneesh Bhardwaj <rajneesh.bhardwaj@linux.intel.com>
      Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      c80506fa
    • D
      afs: Handle EIO from delivery function · 464ac699
      David Howells 提交于
      [ Upstream commit 4ac15ea53622272c01954461b4814892b7481b40 ]
      
      Fix afs_deliver_to_call() to handle -EIO being returned by the operation
      delivery function, indicating that the call found itself in the wrong
      state, by printing an error and aborting the call.
      
      Currently, an assertion failure will occur.  This can happen, say, if the
      delivery function falls off the end without calling afs_extract_data() with
      the want_more parameter set to false to collect the end of the Rx phase of
      a call.
      
      The assertion failure looks like:
      
      	AFS: Assertion failed
      	4 == 7 is false
      	0x4 == 0x7 is false
      	------------[ cut here ]------------
      	kernel BUG at fs/afs/rxrpc.c:462!
      
      and is matched in the trace buffer by a line like:
      
      kworker/7:3-3226 [007] ...1 85158.030203: afs_io_error: c=0003be0c r=-5 CM_REPLY
      
      Fixes: 98bf40cd ("afs: Protect call->state changes against signals")
      Reported-by: NMarc Dionne <marc.dionne@auristor.com>
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      464ac699
    • L
      drm/edid: Add 6 bpc quirk for BOE panel. · 6ea95033
      Lee, Shawn C 提交于
      [ Upstream commit 922dceff8dc1fb4dafc9af78139ba65671408103 ]
      
      BOE panel (ID: 0x0771) that reports "DFP 1.x compliant TMDS".
      But it's 6bpc panel only instead of 8 bpc.
      
      Add panel ID to edid quirk list and set 6 bpc as default to
      work around this issue.
      
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Cc: Gustavo Padovan <gustavo@padovan.org>
      Cc: Cooper Chiou <cooper.chiou@intel.com>
      Signed-off-by: NLee, Shawn C <shawn.c.lee@intel.com&gt;>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/1540792173-7288-1-git-send-email-shawn.c.lee@intel.comSigned-off-by: NSasha Levin <sashal@kernel.org>
      6ea95033
    • R
      um: Give start_idle_thread() a return code · d21e4ba3
      Richard Weinberger 提交于
      [ Upstream commit 7ff1e34bbdc15acab823b1ee4240e94623d50ee8 ]
      
      Fixes:
      arch/um/os-Linux/skas/process.c:613:1: warning: control reaches end of
      non-void function [-Wreturn-type]
      
      longjmp() never returns but gcc still warns that the end of the function
      can be reached.
      Add a return code and debug aid to detect this impossible case.
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      d21e4ba3
    • M
      perf unwind: Take pgoff into account when reporting elf to libdwfl · 6cddd650
      Milian Wolff 提交于
      [ Upstream commit 1fe627da30331024f453faef04d500079b901107 ]
      
      libdwfl parses an ELF file itself and creates mappings for the
      individual sections. perf on the other hand sees raw mmap events which
      represent individual sections. When we encounter an address pointing
      into a mapping with pgoff != 0, we must take that into account and
      report the file at the non-offset base address.
      
      This fixes unwinding with libdwfl in some cases. E.g. for a file like:
      
      ```
      
      using namespace std;
      
      mutex g_mutex;
      
      double worker()
      {
          lock_guard<mutex> guard(g_mutex);
          uniform_real_distribution<double> uniform(-1E5, 1E5);
          default_random_engine engine;
          double s = 0;
          for (int i = 0; i < 1000; ++i) {
              s += norm(complex<double>(uniform(engine), uniform(engine)));
          }
          cout << s << endl;
          return s;
      }
      
      int main()
      {
          vector<std::future<double>> results;
          for (int i = 0; i < 10000; ++i) {
              results.push_back(async(launch::async, worker));
          }
          return 0;
      }
      ```
      
      Compile it with `g++ -g -O2 -lpthread cpp-locking.cpp  -o cpp-locking`,
      then record it with `perf record --call-graph dwarf -e
      sched:sched_switch`.
      
      When you analyze it with `perf script` and libunwind, you should see:
      
      ```
      cpp-locking 20038 [005] 54830.236589: sched:sched_switch: prev_comm=cpp-locking prev_pid=20038 prev_prio=120 prev_state=T ==> next_comm=swapper/5 next_pid=0 next_prio=120
              ffffffffb166fec5 __sched_text_start+0x545 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb166fec5 __sched_text_start+0x545 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb1670208 schedule+0x28 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb16737cc rwsem_down_read_failed+0xec (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb1665e04 call_rwsem_down_read_failed+0x14 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb1672a03 down_read+0x13 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb106bd85 __do_page_fault+0x445 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb18015f5 page_fault+0x45 (/lib/modules/4.14.78-1-lts/build/vmlinux)
                  7f38e4252591 new_heap+0x101 (/usr/lib/libc-2.28.so)
                  7f38e4252d0b arena_get2.part.4+0x2fb (/usr/lib/libc-2.28.so)
                  7f38e4255b1c tcache_init.part.6+0xec (/usr/lib/libc-2.28.so)
                  7f38e42569e5 __GI___libc_malloc+0x115 (inlined)
                  7f38e4241790 __GI__IO_file_doallocate+0x90 (inlined)
                  7f38e424fbbf __GI__IO_doallocbuf+0x4f (inlined)
                  7f38e424ee47 __GI__IO_file_overflow+0x197 (inlined)
                  7f38e424df36 _IO_new_file_xsputn+0x116 (inlined)
                  7f38e4242bfb __GI__IO_fwrite+0xdb (inlined)
                  7f38e463fa6d std::basic_streambuf<char, std::char_traits<char> >::sputn(char const*, long)+0x1cd (inlined)
                  7f38e463fa6d std::ostreambuf_iterator<char, std::char_traits<char> >::_M_put(char const*, long)+0x1cd (inlined)
                  7f38e463fa6d std::ostreambuf_iterator<char, std::char_traits<char> > std::__write<char>(std::ostreambuf_iterator<char, std::char_traits<char> >, char const*, int)+0x1cd (inlined)
                  7f38e463fa6d std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_insert_float<double>(std::ostreambuf_iterator<c>
                  7f38e464bd70 std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, double) const+0x90 (inl>
                  7f38e464bd70 std::ostream& std::ostream::_M_insert<double>(double)+0x90 (/usr/lib/libstdc++.so.6.0.25)
                  563b9cb502f7 std::ostream::operator<<(double)+0xb7 (inlined)
                  563b9cb502f7 worker()+0xb7 (/ssd/milian/projects/kdab/rnd/hotspot/build/tests/test-clients/cpp-locking/cpp-locking)
                  563b9cb506fb double std::__invoke_impl<double, double (*)()>(std::__invoke_other, double (*&&)())+0x2b (inlined)
                  563b9cb506fb std::__invoke_result<double (*)()>::type std::__invoke<double (*)()>(double (*&&)())+0x2b (inlined)
                  563b9cb506fb decltype (__invoke((_S_declval<0ul>)())) std::thread::_Invoker<std::tuple<double (*)()> >::_M_invoke<0ul>(std::_Index_tuple<0ul>)+0x2b (inlined)
                  563b9cb506fb std::thread::_Invoker<std::tuple<double (*)()> >::operator()()+0x2b (inlined)
                  563b9cb506fb std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<double>, std::__future_base::_Result_base::_Deleter>, std::thread::_Invoker<std::tuple<double (*)()> >, dou>
                  563b9cb506fb std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_>
                  563b9cb507e8 std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>::operator()() const+0x28 (inlined)
                  563b9cb507e8 std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)+0x28 (/ssd/milian/>
                  7f38e46d24fe __pthread_once_slow+0xbe (/usr/lib/libpthread-2.28.so)
                  563b9cb51149 __gthread_once+0xe9 (inlined)
                  563b9cb51149 void std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)>
                  563b9cb51149 std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool)+0xe9 (inlined)
                  563b9cb51149 std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<double (*)()> >, double>::_Async_state_impl(std::thread::_Invoker<std::tuple<double (*)()> >&&)::{lambda()#1}::op>
                  563b9cb51149 void std::__invoke_impl<void, std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<double (*)()> >, double>::_Async_state_impl(std::thread::_Invoker<std::tuple<double>
                  563b9cb51149 std::__invoke_result<std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<double (*)()> >, double>::_Async_state_impl(std::thread::_Invoker<std::tuple<double (*)()> >>
                  563b9cb51149 decltype (__invoke((_S_declval<0ul>)())) std::thread::_Invoker<std::tuple<std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<double (*)()> >, double>::_Async_state_>
                  563b9cb51149 std::thread::_Invoker<std::tuple<std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<double (*)()> >, double>::_Async_state_impl(std::thread::_Invoker<std::tuple<dou>
                  563b9cb51149 std::thread::_State_impl<std::thread::_Invoker<std::tuple<std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<double (*)()> >, double>::_Async_state_impl(std::thread>
                  7f38e45f0062 execute_native_thread_routine+0x12 (/usr/lib/libstdc++.so.6.0.25)
                  7f38e46caa9c start_thread+0xfc (/usr/lib/libpthread-2.28.so)
                  7f38e42ccb22 __GI___clone+0x42 (inlined)
      ```
      
      Before this patch, using libdwfl, you would see:
      
      ```
      cpp-locking 20038 [005] 54830.236589: sched:sched_switch: prev_comm=cpp-locking prev_pid=20038 prev_prio=120 prev_state=T ==> next_comm=swapper/5 next_pid=0 next_prio=120
              ffffffffb166fec5 __sched_text_start+0x545 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb166fec5 __sched_text_start+0x545 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb1670208 schedule+0x28 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb16737cc rwsem_down_read_failed+0xec (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb1665e04 call_rwsem_down_read_failed+0x14 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb1672a03 down_read+0x13 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb106bd85 __do_page_fault+0x445 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb18015f5 page_fault+0x45 (/lib/modules/4.14.78-1-lts/build/vmlinux)
                  7f38e4252591 new_heap+0x101 (/usr/lib/libc-2.28.so)
              a041161e77950c5c [unknown] ([unknown])
      ```
      
      With this patch applied, we get a bit further in unwinding:
      
      ```
      cpp-locking 20038 [005] 54830.236589: sched:sched_switch: prev_comm=cpp-locking prev_pid=20038 prev_prio=120 prev_state=T ==> next_comm=swapper/5 next_pid=0 next_prio=120
              ffffffffb166fec5 __sched_text_start+0x545 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb166fec5 __sched_text_start+0x545 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb1670208 schedule+0x28 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb16737cc rwsem_down_read_failed+0xec (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb1665e04 call_rwsem_down_read_failed+0x14 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb1672a03 down_read+0x13 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb106bd85 __do_page_fault+0x445 (/lib/modules/4.14.78-1-lts/build/vmlinux)
              ffffffffb18015f5 page_fault+0x45 (/lib/modules/4.14.78-1-lts/build/vmlinux)
                  7f38e4252591 new_heap+0x101 (/usr/lib/libc-2.28.so)
                  7f38e4252d0b arena_get2.part.4+0x2fb (/usr/lib/libc-2.28.so)
                  7f38e4255b1c tcache_init.part.6+0xec (/usr/lib/libc-2.28.so)
                  7f38e42569e5 __GI___libc_malloc+0x115 (inlined)
                  7f38e4241790 __GI__IO_file_doallocate+0x90 (inlined)
                  7f38e424fbbf __GI__IO_doallocbuf+0x4f (inlined)
                  7f38e424ee47 __GI__IO_file_overflow+0x197 (inlined)
                  7f38e424df36 _IO_new_file_xsputn+0x116 (inlined)
                  7f38e4242bfb __GI__IO_fwrite+0xdb (inlined)
                  7f38e463fa6d std::basic_streambuf<char, std::char_traits<char> >::sputn(char const*, long)+0x1cd (inlined)
                  7f38e463fa6d std::ostreambuf_iterator<char, std::char_traits<char> >::_M_put(char const*, long)+0x1cd (inlined)
                  7f38e463fa6d std::ostreambuf_iterator<char, std::char_traits<char> > std::__write<char>(std::ostreambuf_iterator<char, std::char_traits<char> >, char const*, int)+0x1cd (inlined)
                  7f38e463fa6d std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_insert_float<double>(std::ostreambuf_iterator<c>
                  7f38e464bd70 std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, double) const+0x90 (inl>
                  7f38e464bd70 std::ostream& std::ostream::_M_insert<double>(double)+0x90 (/usr/lib/libstdc++.so.6.0.25)
                  563b9cb502f7 std::ostream::operator<<(double)+0xb7 (inlined)
                  563b9cb502f7 worker()+0xb7 (/ssd/milian/projects/kdab/rnd/hotspot/build/tests/test-clients/cpp-locking/cpp-locking)
              6eab825c1ee3e4ff [unknown] ([unknown])
      ```
      
      Note that the backtrace is still stopping too early, when compared to
      the nice results obtained via libunwind. It's unclear so far what the
      reason for that is.
      
      Committer note:
      
      Further comment by Milian on the thread started on the Link: tag below:
      
       ---
      The remaining issue is due to a bug in elfutils:
      
      https://sourceware.org/ml/elfutils-devel/2018-q4/msg00089.html
      
      With both patches applied, libunwind and elfutils produce the same output for
      the above scenario.
       ---
      Signed-off-by: NMilian Wolff <milian.wolff@kdab.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Link: http://lkml.kernel.org/r/20181029141644.3907-1-milian.wolff@kdab.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      6cddd650
    • E
      hfsplus: prevent btree data loss on root split · 52fc49b6
      Ernesto A. Fernández 提交于
      [ Upstream commit 0a3021d4f5295aa073c7bf5c5e4de60a2e292578 ]
      
      Creating, renaming or deleting a file may cause catalog corruption and
      data loss.  This bug is randomly triggered by xfstests generic/027, but
      here is a faster reproducer:
      
        truncate -s 50M fs.iso
        mkfs.hfsplus fs.iso
        mount fs.iso /mnt
        i=100
        while [ $i -le 150 ]; do
          touch /mnt/$i &>/dev/null
          ((++i))
        done
        i=100
        while [ $i -le 150 ]; do
          mv /mnt/$i /mnt/$(perl -e "print $i x82") &>/dev/null
          ((++i))
        done
        umount /mnt
        fsck.hfsplus -n fs.iso
      
      The bug is triggered whenever hfs_brec_update_parent() needs to split the
      root node.  The height of the btree is not increased, which leaves the new
      node orphaned and its records lost.
      
      Link: http://lkml.kernel.org/r/26d882184fc43043a810114258f45277752186c7.1535682461.git.ernesto.mnd.fernandez@gmail.comSigned-off-by: NErnesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
      Cc: Christoph Hellwig <hch@infradead.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      52fc49b6
    • E
      hfs: prevent btree data loss on root split · ea54dce2
      Ernesto A. Fernández 提交于
      [ Upstream commit d057c036672f33d43a5f7344acbb08cf3a8a0c09 ]
      
      This bug is triggered whenever hfs_brec_update_parent() needs to split
      the root node.  The height of the btree is not increased, which leaves
      the new node orphaned and its records lost.  It is not possible for this
      to happen on a valid hfs filesystem because the index nodes have fixed
      length keys.
      
      For reasons I ignore, the hfs module does have support for a number of
      hfsplus features.  A corrupt btree header may report variable length
      keys and trigger this bug, so it's better to fix it.
      
      Link: http://lkml.kernel.org/r/9750b1415685c4adca10766895f6d5ef12babdb0.1535682463.git.ernesto.mnd.fernandez@gmail.comSigned-off-by: NErnesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
      Cc: Christoph Hellwig <hch@infradead.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      ea54dce2
    • J
      reiserfs: propagate errors from fill_with_dentries() properly · ee38053f
      Jann Horn 提交于
      [ Upstream commit b10298d56c9623f9b173f19959732d3184b35f4f ]
      
      fill_with_dentries() failed to propagate errors up to
      reiserfs_for_each_xattr() properly.  Plumb them through.
      
      Note that reiserfs_for_each_xattr() is only used by
      reiserfs_delete_xattrs() and reiserfs_chown_xattrs().  The result of
      reiserfs_delete_xattrs() is discarded anyway, the only difference there is
      whether a warning is printed to dmesg.  The result of
      reiserfs_chown_xattrs() does matter because it can block chowning of the
      file to which the xattrs belong; but either way, the resulting state can
      have misaligned ownership, so my patch doesn't improve things greatly.
      
      Credit for making me look at this code goes to Al Viro, who pointed out
      that the ->actor calling convention is suboptimal and should be changed.
      
      Link: http://lkml.kernel.org/r/20180802163335.83312-1-jannh@google.comSigned-off-by: NJann Horn <jannh@google.com>
      Reviewed-by: NAndrew Morton <akpm@linux-foundation.org>
      Cc: Jeff Mahoney <jeffm@suse.com>
      Cc: Eric Biggers <ebiggers@google.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      ee38053f
    • R
      ixgbe: fix MAC anti-spoofing filter after VFLR · 23ce028f
      Radoslaw Tyl 提交于
      [ Upstream commit 6702185c1ffec3421181b5e24491e3fac920cb61 ]
      
      This change resolves a driver bug where the driver is logging a
      message that says "Spoofed packets detected". This can occur on the PF
      (host) when a VF has VLAN+MACVLAN enabled and is re-started with a
      different MAC address.
      
      MAC and VLAN anti-spoofing filters are to be enabled together.
      Signed-off-by: NRadoslaw Tyl <radoslawx.tyl@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Acked-by: NPiotr Skajewski <piotrx.skajewski@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      23ce028f
    • H
      net: hns3: bugfix for the initialization of command queue's spin lock · 91a52a44
      Huazhong Tan 提交于
      [ Upstream commit b2f74dbaf12bf59ff35d451005b3cdee78232ff0 ]
      
      The spin lock of the command queue only need to be initialized once
      when the driver initializes the command queue. It is not necessary to
      initialize the spin lock when resetting. At the same time, the
      modification of the queue member should be performed after acquiring
      the lock.
      
      Fixes: 3efb960f ("net: hns3: Refactor the initialization of command queue")
      Signed-off-by: NHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      91a52a44
    • H
      net: hns3: bugfix for handling mailbox while the command queue reinitialized · 355ec075
      Huazhong Tan 提交于
      [ Upstream commit 3c88ed1d ]
      
      In a multi-core machine, the mailbox service and reset service
      will be executed at the same time. The reset service will re-initialize
      the command queue, before that, the mailbox handler can only get some
      invalid messages.
      
      The HCLGE_STATE_CMD_DISABLE flag means that the command queue is not
      available and needs to be reinitialized. Therefore, when the mailbox
      handler recognizes this flag, it should not process the command.
      
      Fixes: dde1a86e ("net: hns3: Add mailbox support to PF driver")
      Signed-off-by: NHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      355ec075
    • H
      net: hns3: bugfix for rtnl_lock's range in the hclge_reset() · 92cb1b09
      Huazhong Tan 提交于
      [ Upstream commit a963052e ]
      
      Since hclge_reset_wait() is used to wait for the hardware to complete
      the reset, it is not necessary to hold the rtnl_lock during
      hclge_reset_wait(). So this patch releases the lock for the duration
      of hclge_reset_wait().
      
      Fixes: 6d4fab39 ("net: hns3: Reset net device with rtnl_lock")
      Signed-off-by: NHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      92cb1b09
    • H
      net: hns3: bugfix for rtnl_lock's range in the hclgevf_reset() · 733edfd6
      Huazhong Tan 提交于
      [ Upstream commit 29118ab9 ]
      
      Since hclgevf_reset_wait() is used to wait for the hardware to complete
      the reset, it is not necessary to hold the rtnl_lock during
      hclgevf_reset_wait(). So this patch releases the lock for the duration
      of hclgevf_reset_wait().
      
      Fixes: 6988eb2a ("net: hns3: Add support to reset the enet/ring mgmt layer")
      Signed-off-by: NHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      733edfd6
    • M
      block: brd: associate with queue until adding disk · 0987d5a6
      Ming Lei 提交于
      [ Upstream commit 153fcd5f6d93b8e1e4040b1337f564a10f8d93af ]
      
      brd_free() may be called in failure path on one brd instance which
      disk isn't added yet, so release handler of gendisk may free the
      associated request_queue early and causes the following use-after-free[1].
      
      This patch fixes this issue by associating gendisk with request_queue
      just before adding disk.
      
      [1] KASAN: use-after-free Read in del_timer_syncNon-volatile memory driver v1.3
      Linux agpgart interface v0.103
      [drm] Initialized vgem 1.0.0 20120112 for virtual device on minor 0
      usbcore: registered new interface driver udl
      ==================================================================
      BUG: KASAN: use-after-free in __lock_acquire+0x36d9/0x4c20
      kernel/locking/lockdep.c:3218
      Read of size 8 at addr ffff8801d1b6b540 by task swapper/0/1
      
      CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.19.0+ #88
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
      Google 01/01/2011
      Call Trace:
        __dump_stack lib/dump_stack.c:77 [inline]
        dump_stack+0x244/0x39d lib/dump_stack.c:113
        print_address_description.cold.7+0x9/0x1ff mm/kasan/report.c:256
        kasan_report_error mm/kasan/report.c:354 [inline]
        kasan_report.cold.8+0x242/0x309 mm/kasan/report.c:412
        __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
        __lock_acquire+0x36d9/0x4c20 kernel/locking/lockdep.c:3218
        lock_acquire+0x1ed/0x520 kernel/locking/lockdep.c:3844
        del_timer_sync+0xb7/0x270 kernel/time/timer.c:1283
        blk_cleanup_queue+0x413/0x710 block/blk-core.c:809
        brd_free+0x5d/0x71 drivers/block/brd.c:422
        brd_init+0x2eb/0x393 drivers/block/brd.c:518
        do_one_initcall+0x145/0x957 init/main.c:890
        do_initcall_level init/main.c:958 [inline]
        do_initcalls init/main.c:966 [inline]
        do_basic_setup init/main.c:984 [inline]
        kernel_init_freeable+0x5c6/0x6b9 init/main.c:1148
        kernel_init+0x11/0x1ae init/main.c:1068
        ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:350
      
      Reported-by: syzbot+3701447012fe951dabb2@syzkaller.appspotmail.com
      Signed-off-by: NMing Lei <ming.lei@redhat.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      0987d5a6
    • A
      arm64: kprobe: make page to RO mode when allocate it · 262522cc
      Anders Roxell 提交于
      [ Upstream commit 966866892cf89d606544bca22d584ba2ef9ec208 ]
      
      Commit 1404d6f1 ("arm64: dump: Add checking for writable and exectuable pages")
      has successfully identified code that leaves a page with W+X
      permissions.
      
      [    3.245140] arm64/mm: Found insecure W+X mapping at address (____ptrval____)/0xffff000000d90000
      [    3.245771] WARNING: CPU: 0 PID: 1 at ../arch/arm64/mm/dump.c:232 note_page+0x410/0x420
      [    3.246141] Modules linked in:
      [    3.246653] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.19.0-rc5-next-20180928-00001-ge70ae259b853-dirty #62
      [    3.247008] Hardware name: linux,dummy-virt (DT)
      [    3.247347] pstate: 80000005 (Nzcv daif -PAN -UAO)
      [    3.247623] pc : note_page+0x410/0x420
      [    3.247898] lr : note_page+0x410/0x420
      [    3.248071] sp : ffff00000804bcd0
      [    3.248254] x29: ffff00000804bcd0 x28: ffff000009274000
      [    3.248578] x27: ffff00000921a000 x26: ffff80007dfff000
      [    3.248845] x25: ffff0000093f5000 x24: ffff000009526f6a
      [    3.249109] x23: 0000000000000004 x22: ffff000000d91000
      [    3.249396] x21: ffff000000d90000 x20: 0000000000000000
      [    3.249661] x19: ffff00000804bde8 x18: 0000000000000400
      [    3.249924] x17: 0000000000000000 x16: 0000000000000000
      [    3.250271] x15: ffffffffffffffff x14: 295f5f5f5f6c6176
      [    3.250594] x13: 7274705f5f5f5f28 x12: 2073736572646461
      [    3.250941] x11: 20746120676e6970 x10: 70616d20582b5720
      [    3.251252] x9 : 6572756365736e69 x8 : 3039643030303030
      [    3.251519] x7 : 306666666678302f x6 : ffff0000095467b2
      [    3.251802] x5 : 0000000000000000 x4 : 0000000000000000
      [    3.252060] x3 : 0000000000000000 x2 : ffffffffffffffff
      [    3.252323] x1 : 4d151327adc50b00 x0 : 0000000000000000
      [    3.252664] Call trace:
      [    3.252953]  note_page+0x410/0x420
      [    3.253186]  walk_pgd+0x12c/0x238
      [    3.253417]  ptdump_check_wx+0x68/0xf8
      [    3.253637]  mark_rodata_ro+0x68/0x98
      [    3.253847]  kernel_init+0x38/0x160
      [    3.254103]  ret_from_fork+0x10/0x18
      
      kprobes allocates a writable executable page with module_alloc() in
      order to store executable code.
      Reworked to that when allocate a page it sets mode RO. Inspired by
      commit 63fef14f ("kprobes/x86: Make insn buffer always ROX and use text_poke()").
      Suggested-by: NArnd Bergmann <arnd@arndb.de>
      Suggested-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Acked-by: NWill Deacon <will.deacon@arm.com>
      Acked-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Reviewed-by: NLaura Abbott <labbott@redhat.com>
      Signed-off-by: NAnders Roxell <anders.roxell@linaro.org>
      [catalin.marinas@arm.com: removed unnecessary casts]
      Signed-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      262522cc
    • R
      cifs: fix return value for cifs_listxattr · e4ed4e68
      Ronnie Sahlberg 提交于
      [ Upstream commit 0c5d6cb6643f48ad3775322f3ebab6c7eb67484e ]
      
      If the application buffer was too small to fit all the names
      we would still count the number of bytes and return this for
      listxattr. This would then trigger a BUG in usercopy.c
      
      Fix the computation of the size so that we return -ERANGE
      correctly when the buffer is too small.
      
      This fixes the kernel BUG for xfstest generic/377
      Signed-off-by: NRonnie Sahlberg <lsahlber@redhat.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      Reviewed-by: NAurelien Aptel <aaptel@suse.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      e4ed4e68
    • C
      cifs: don't dereference smb_file_target before null check · ad1834fd
      Colin Ian King 提交于
      [ Upstream commit 8c6c9bed8773375b1d54ccca2911ec892c59db5d ]
      
      There is a null check on dst_file->private data which suggests
      it can be potentially null. However, before this check, pointer
      smb_file_target is derived from dst_file->private and dereferenced
      in the call to tlink_tcon, hence there is a potential null pointer
      deference.
      
      Fix this by assigning smb_file_target and target_tcon after the
      null pointer sanity checks.
      
      Detected by CoverityScan, CID#1475302 ("Dereference before null check")
      
      Fixes: 04b38d60 ("vfs: pull btrfs clone API to vfs layer")
      Signed-off-by: NColin Ian King <colin.king@canonical.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      ad1834fd
    • V
      drm/i915: Replace some PAGE_SIZE with I915_GTT_PAGE_SIZE · 1beb22c5
      Ville Syrjälä 提交于
      commit f6e35cda66146106cfeb85ed65696e0f8e793fee upstream.
      
      Use I915_GTT_PAGE_SIZE when talking about GTT pages rather than
      physical pages.
      
      There are some PAGE_SHIFTs left though. Not sure if we want to
      introduce I915_GTT_PAGE_SHIFT or what?
      
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Suggested-by: Chris Wilson <chris@chris-wilson.co.uk> # at least some of it :)
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20180913150405.706-1-ville.syrjala@linux.intel.comReviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1beb22c5
  2. 23 11月, 2018 13 次提交