Skip to content
  1. Jan 18, 2023
    • Heiko Carstens's avatar
      s390/cpum_sf: add READ_ONCE() semantics to compare and swap loops · a400593e
      Heiko Carstens authored
      commit 82d3edb5
      
       upstream.
      
      The current cmpxchg_double() loops within the perf hw sampling code do not
      have READ_ONCE() semantics to read the old value from memory. This allows
      the compiler to generate code which reads the "old" value several times
      from memory, which again allows for inconsistencies.
      
      For example:
      
              /* Reset trailer (using compare-double-and-swap) */
              do {
                      te_flags = te->flags & ~SDB_TE_BUFFER_FULL_MASK;
                      te_flags |= SDB_TE_ALERT_REQ_MASK;
              } while (!cmpxchg_double(&te->flags, &te->overflow,
                       te->flags, te->overflow,
                       te_flags, 0ULL));
      
      The compiler could generate code where te->flags used within the
      cmpxchg_double() call may be refetched from memory and which is not
      necessarily identical to the previous read version which was used to
      generate te_flags. Which in turn means that an incorrect update could
      happen.
      
      Fix this by adding READ_ONCE() semantics to all cmpxchg_double()
      loops. Given that READ_ONCE() cannot generate code on s390 which atomically
      reads 16 bytes, use a private compare-and-swap-double implementation to
      achieve that.
      
      Also replace cmpxchg_double() with the private implementation to be able to
      re-use the old value within the loops.
      
      As a side effect this converts the whole code to only use bit fields
      to read and modify bits within the hws trailer header.
      
      Reported-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
      Acked-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
      Acked-by: default avatarHendrik Brueckner <brueckner@linux.ibm.com>
      Reviewed-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/linux-s390/Y71QJBhNTIatvxUT@osiris/T/#ma14e2a5f7aa8ed4b94b6f9576799b3ad9c60f333
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a400593e
    • Brian Norris's avatar
      ASoC: qcom: lpass-cpu: Fix fallback SD line index handling · d4fa6596
      Brian Norris authored
      commit 000bca8d upstream.
      
      These indices should reference the ID placed within the dai_driver
      array, not the indices of the array itself.
      
      This fixes commit 4ff028f6 ("ASoC: qcom: lpass-cpu: Make I2S SD
      lines configurable"), which among others, broke IPQ8064 audio
      (sound/soc/qcom/lpass-ipq806x.c) because it uses ID 4 but we'd stop
      initializing the mi2s_playback_sd_mode and mi2s_capture_sd_mode arrays
      at ID 0.
      
      Fixes: 4ff028f6
      
       ("ASoC: qcom: lpass-cpu: Make I2S SD lines configurable")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      Reviewed-by: default avatarStephan Gerhold <stephan@gerhold.net>
      Link: https://lore.kernel.org/r/20221231061545.2110253-1-computersforpeace@gmail.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d4fa6596
    • Alexander Egorenkov's avatar
      s390/kexec: fix ipl report address for kdump · 8400b91c
      Alexander Egorenkov authored
      commit c2337a40 upstream.
      
      This commit addresses the following erroneous situation with file-based
      kdump executed on a system with a valid IPL report.
      
      On s390, a kdump kernel, its initrd and IPL report if present are loaded
      into a special and reserved on boot memory region - crashkernel. When
      a system crashes and kdump was activated before, the purgatory code
      is entered first which swaps the crashkernel and [0 - crashkernel size]
      memory regions. Only after that the kdump kernel is entered. For this
      reason, the pointer to an IPL report in lowcore must point to the IPL report
      after the swap and not to the address of the IPL report that was located in
      crashkernel memory region before the swap. Failing to do so, makes the
      kdump's decompressor try to read memory from the crashkernel memory region
      which already contains the production's kernel memory.
      
      The situation described above caused spontaneous kdump failures/hangs
      on systems where the Secure IPL is activated because on such systems
      an IPL report is always present. In that case kdump's decompressor tried
      to parse an IPL report which frequently lead to illegal memory accesses
      because an IPL report contains addresses to various data.
      
      Cc: <stable@vger.kernel.org>
      Fixes: 99feaa71
      
       ("s390/kexec_file: Create ipl report and pass to next kernel")
      Reviewed-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: default avatarAlexander Egorenkov <egorenar@linux.ibm.com>
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8400b91c
    • Adrian Hunter's avatar
      perf auxtrace: Fix address filter duplicate symbol selection · c07e0bab
      Adrian Hunter authored
      commit cf129830 upstream.
      
      When a match has been made to the nth duplicate symbol, return
      success not error.
      
      Example:
      
        Before:
      
          $ cat file.c
          cat: file.c: No such file or directory
          $ cat file1.c
          #include <stdio.h>
      
          static void func(void)
          {
                  printf("First func\n");
          }
      
          void other(void);
      
          int main()
          {
                  func();
                  other();
                  return 0;
          }
          $ cat file2.c
          #include <stdio.h>
      
          static void func(void)
          {
                  printf("Second func\n");
          }
      
          void other(void)
          {
                  func();
          }
      
          $ gcc -Wall -Wextra -o test file1.c file2.c
          $ perf record -e intel_pt//u --filter 'filter func @ ./test' -- ./test
          Multiple symbols with name 'func'
          #1      0x1149  l       func
                          which is near           main
          #2      0x1179  l       func
                          which is near           other
          Disambiguate symbol name by inserting #n after the name e.g. func #2
          Or select a global symbol by inserting #0 or #g or #G
          Failed to parse address filter: 'filter func @ ./test'
          Filter format is: filter|start|stop|tracestop <start symbol or address> [/ <end symbol or size>] [@<file name>]
          Where multiple filters are separated by space or comma.
          $ perf record -e intel_pt//u --filter 'filter func #2 @ ./test' -- ./test
          Failed to parse address filter: 'filter func #2 @ ./test'
          Filter format is: filter|start|stop|tracestop <start symbol or address> [/ <end symbol or size>] [@<file name>]
          Where multiple filters are separated by space or comma.
      
        After:
      
          $ perf record -e intel_pt//u --filter 'filter func #2 @ ./test' -- ./test
          First func
          Second func
          [ perf record: Woken up 1 times to write data ]
          [ perf record: Captured and wrote 0.016 MB perf.data ]
          $ perf script --itrace=b -Ftime,flags,ip,sym,addr --ns
          1231062.526977619:   tr strt                               0 [unknown] =>     558495708179 func
          1231062.526977619:   tr end  call               558495708188 func =>     558495708050 _init
          1231062.526979286:   tr strt                               0 [unknown] =>     55849570818d func
          1231062.526979286:   tr end  return             55849570818f func =>     55849570819d other
      
      Fixes: 1b36c03e
      
       ("perf record: Add support for using symbols in address filters")
      Reported-by: default avatarDmitrii Dolgov <9erthalion6@gmail.com>
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: default avatarDmitry Dolgov <9erthalion6@gmail.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20230110185659.15979-1-adrian.hunter@intel.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c07e0bab
    • Noor Azura Ahmad Tarmizi's avatar
      net: stmmac: add aux timestamps fifo clearance wait · e81d82da
      Noor Azura Ahmad Tarmizi authored
      commit ae9dcb91 upstream.
      
      Add timeout polling wait for auxiliary timestamps snapshot FIFO clear bit
      (ATSFC) to clear. This is to ensure no residue fifo value is being read
      erroneously.
      
      Fixes: f4da5652
      
       ("net: stmmac: Add support for external trigger timestamping")
      Cc: <stable@vger.kernel.org> # 5.10.x
      Signed-off-by: default avatarNoor Azura Ahmad Tarmizi <noor.azura.ahmad.tarmizi@intel.com>
      Link: https://lore.kernel.org/r/20230111050200.2130-1-noor.azura.ahmad.tarmizi@intel.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e81d82da
    • Jonathan Corbet's avatar
      docs: Fix the docs build with Sphinx 6.0 · 44167b74
      Jonathan Corbet authored
      commit 0283189e
      
       upstream.
      
      Sphinx 6.0 removed the execfile_() function, which we use as part of the
      configuration process.  They *did* warn us...  Just open-code the
      functionality as is done in Sphinx itself.
      
      Tested (using SPHINX_CONF, since this code is only executed with an
      alternative config file) on various Sphinx versions from 2.5 through 6.0.
      
      Reported-by: default avatarMartin Liška <mliska@suse.cz>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      44167b74
    • Ard Biesheuvel's avatar
      efi: tpm: Avoid READ_ONCE() for accessing the event log · 24176bf2
      Ard Biesheuvel authored
      commit d3f45053
      
       upstream.
      
      Nathan reports that recent kernels built with LTO will crash when doing
      EFI boot using Fedora's GRUB and SHIM. The culprit turns out to be a
      misaligned load from the TPM event log, which is annotated with
      READ_ONCE(), and under LTO, this gets translated into a LDAR instruction
      which does not tolerate misaligned accesses.
      
      Interestingly, this does not happen when booting the same kernel
      straight from the UEFI shell, and so the fact that the event log may
      appear misaligned in memory may be caused by a bug in GRUB or SHIM.
      
      However, using READ_ONCE() to access firmware tables is slightly unusual
      in any case, and here, we only need to ensure that 'event' is not
      dereferenced again after it gets unmapped, but this is already taken
      care of by the implicit barrier() semantics of the early_memunmap()
      call.
      
      Cc: <stable@vger.kernel.org>
      Cc: Peter Jones <pjones@redhat.com>
      Cc: Jarkko Sakkinen <jarkko@kernel.org>
      Cc: Matthew Garrett <mjg59@srcf.ucam.org>
      Reported-by: default avatarNathan Chancellor <nathan@kernel.org>
      Tested-by: default avatarNathan Chancellor <nathan@kernel.org>
      Link: https://github.com/ClangBuiltLinux/linux/issues/1782
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      24176bf2
    • Jinrong Liang's avatar
      selftests: kvm: Fix a compile error in selftests/kvm/rseq_test.c · 01b966b1
      Jinrong Liang authored
      commit 561cafeb
      
       upstream.
      
      The following warning appears when executing:
      	make -C tools/testing/selftests/kvm
      
      rseq_test.c: In function ‘main’:
      rseq_test.c:237:33: warning: implicit declaration of function ‘gettid’; did you mean ‘getgid’? [-Wimplicit-function-declaration]
                (void *)(unsigned long)gettid());
                                       ^~~~~~
                                       getgid
      /usr/bin/ld: /tmp/ccr5mMko.o: in function `main':
      ../kvm/tools/testing/selftests/kvm/rseq_test.c:237: undefined reference to `gettid'
      collect2: error: ld returned 1 exit status
      make: *** [../lib.mk:173: ../kvm/tools/testing/selftests/kvm/rseq_test] Error 1
      
      Use the more compatible syscall(SYS_gettid) instead of gettid() to fix it.
      More subsequent reuse may cause it to be wrapped in a lib file.
      
      Signed-off-by: default avatarJinrong Liang <cloudliang@tencent.com>
      Message-Id: <20220802071240.84626-1-cloudliang@tencent.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Cc: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      01b966b1
    • Denis Nikitin's avatar
      KVM: arm64: nvhe: Fix build with profile optimization · c773ebe1
      Denis Nikitin authored
      commit bde971a8
      
       upstream.
      
      Kernel build with clang and KCFLAGS=-fprofile-sample-use=<profile> fails with:
      
      error: arch/arm64/kvm/hyp/nvhe/kvm_nvhe.tmp.o: Unexpected SHT_REL
      section ".rel.llvm.call-graph-profile"
      
      Starting from 13.0.0 llvm can generate SHT_REL section, see
      https://reviews.llvm.org/rGca3bdb57fa1ac98b711a735de048c12b5fdd8086.
      gen-hyprel does not support SHT_REL relocation section.
      
      Filter out profile use flags to fix the build with profile optimization.
      
      Signed-off-by: default avatarDenis Nikitin <denik@chromium.org>
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Link: https://lore.kernel.org/r/20221014184532.3153551-1-denik@chromium.org
      Signed-off-by: default avatarStephen Boyd <swboyd@chromium.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c773ebe1
    • Marc Zyngier's avatar
      KVM: arm64: Fix S1PTW handling on RO memslots · c1d6a72f
      Marc Zyngier authored
      commit 406504c7 upstream.
      
      A recent development on the EFI front has resulted in guests having
      their page tables baked in the firmware binary, and mapped into the
      IPA space as part of a read-only memslot. Not only is this legitimate,
      but it also results in added security, so thumbs up.
      
      It is possible to take an S1PTW translation fault if the S1 PTs are
      unmapped at stage-2. However, KVM unconditionally treats S1PTW as a
      write to correctly handle hardware AF/DB updates to the S1 PTs.
      Furthermore, KVM injects an exception into the guest for S1PTW writes.
      In the aforementioned case this results in the guest taking an abort
      it won't recover from, as the S1 PTs mapping the vectors suffer from
      the same problem.
      
      So clearly our handling is... wrong.
      
      Instead, switch to a two-pronged approach:
      
      - On S1PTW translation fault, handle the fault as a read
      
      - On S1PTW permission fault, handle the fault as a write
      
      This is of no consequence to SW that *writes* to its PTs (the write
      will trigger a non-S1PTW fault), and SW that uses RO PTs will not
      use HW-assisted AF/DB anyway, as that'd be wrong.
      
      Only in the case described in c4ad98e4 ("KVM: arm64: Assume write
      fault on S1PTW permission fault on instruction fetch") do we end-up
      with two back-to-back faults (page being evicted and faulted back).
      I don't think this is a case worth optimising for.
      
      Fixes: c4ad98e4
      
       ("KVM: arm64: Assume write fault on S1PTW permission fault on instruction fetch")
      Reviewed-by: default avatarOliver Upton <oliver.upton@linux.dev>
      Reviewed-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Regression-tested-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c1d6a72f
    • Luka Guzenko's avatar
      ALSA: hda/realtek: Enable mute/micmute LEDs on HP Spectre x360 13-aw0xxx · e04e6cd8
      Luka Guzenko authored
      commit ca88eeb3
      
       upstream.
      
      The HP Spectre x360 13-aw0xxx devices use the ALC285 codec with GPIO 0x04
      controlling the micmute LED and COEF 0x0b index 8 controlling the mute LED.
      A quirk was added to make these work as well as a fixup.
      
      Signed-off-by: default avatarLuka Guzenko <l.guzenko@web.de>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20230110202514.2792-1-l.guzenko@web.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e04e6cd8
    • Yuchi Yang's avatar
      ALSA: hda/realtek - Turn on power early · b983c9a9
      Yuchi Yang authored
      commit 1f680609
      
       upstream.
      
      Turn on power early to avoid wrong state for power relation register.
      This can earlier update JD state when resume back.
      
      Signed-off-by: default avatarYuchi Yang <yangyuchi66@gmail.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/e35d8f4fa18f4448a2315cc7d4a3715f@realtek.com
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b983c9a9
    • Jaroslav Kysela's avatar
      ALSA: control-led: use strscpy in set_led_id() · 9ab36968
      Jaroslav Kysela authored
      commit 70051cff upstream.
      
      The use of strncpy() in the set_led_id() was incorrect.
      The len variable should use 'min(sizeof(buf2) - 1, count)'
      expression.
      
      Use strscpy() function to simplify things and handle the error gracefully.
      
      Fixes: a135dfb5
      
       ("ALSA: led control - add sysfs kcontrol LED marking layer")
      Reported-by: default avatar <yang.yang29@zte.com.cn>
      Link: https://lore.kernel.org/alsa-devel/202301091945513559977@zte.com.cn/
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarJaroslav Kysela <perex@perex.cz>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9ab36968
    • Pablo Neira Ayuso's avatar
      netfilter: nft_payload: incorrect arithmetics when fetching VLAN header bits · a8acfe2c
      Pablo Neira Ayuso authored
      commit 696e1a48
      
       upstream.
      
      If the offset + length goes over the ethernet + vlan header, then the
      length is adjusted to copy the bytes that are within the boundaries of
      the vlan_ethhdr scratchpad area. The remaining bytes beyond ethernet +
      vlan header are copied directly from the skbuff data area.
      
      Fix incorrect arithmetic operator: subtract, not add, the size of the
      vlan header in case of double-tagged packets to adjust the length
      accordingly to address CVE-2023-0179.
      
      Reported-by: default avatarDavide Ornaghi <d.ornaghi97@gmail.com>
      Fixes: f6ae9f12
      
       ("netfilter: nft_payload: add C-VLAN support")
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a8acfe2c
  2. Jan 14, 2023
  3. Jan 12, 2023