1. 11 11月, 2022 1 次提交
  2. 21 10月, 2022 3 次提交
  3. 18 10月, 2022 1 次提交
  4. 17 10月, 2022 1 次提交
  5. 16 10月, 2022 1 次提交
  6. 15 10月, 2022 1 次提交
  7. 13 10月, 2022 7 次提交
  8. 12 10月, 2022 4 次提交
    • B
      mm/hugetlb: fix races when looking up a CONT-PTE/PMD size hugetlb page · fac35ba7
      Baolin Wang 提交于
      On some architectures (like ARM64), it can support CONT-PTE/PMD size
      hugetlb, which means it can support not only PMD/PUD size hugetlb (2M and
      1G), but also CONT-PTE/PMD size(64K and 32M) if a 4K page size specified.
      
      So when looking up a CONT-PTE size hugetlb page by follow_page(), it will
      use pte_offset_map_lock() to get the pte entry lock for the CONT-PTE size
      hugetlb in follow_page_pte().  However this pte entry lock is incorrect
      for the CONT-PTE size hugetlb, since we should use huge_pte_lock() to get
      the correct lock, which is mm->page_table_lock.
      
      That means the pte entry of the CONT-PTE size hugetlb under current pte
      lock is unstable in follow_page_pte(), we can continue to migrate or
      poison the pte entry of the CONT-PTE size hugetlb, which can cause some
      potential race issues, even though they are under the 'pte lock'.
      
      For example, suppose thread A is trying to look up a CONT-PTE size hugetlb
      page by move_pages() syscall under the lock, however antoher thread B can
      migrate the CONT-PTE hugetlb page at the same time, which will cause
      thread A to get an incorrect page, if thread A also wants to do page
      migration, then data inconsistency error occurs.
      
      Moreover we have the same issue for CONT-PMD size hugetlb in
      follow_huge_pmd().
      
      To fix above issues, rename the follow_huge_pmd() as follow_huge_pmd_pte()
      to handle PMD and PTE level size hugetlb, which uses huge_pte_lock() to
      get the correct pte entry lock to make the pte entry stable.
      
      Mike said:
      
      Support for CONT_PMD/_PTE was added with bb9dd3df ("arm64: hugetlb:
      refactor find_num_contig()").  Patch series "Support for contiguous pte
      hugepages", v4.  However, I do not believe these code paths were
      executed until migration support was added with 5480280d ("arm64/mm:
      enable HugeTLB migration for contiguous bit HugeTLB pages") I would go
      with 5480280d for the Fixes: targe.
      
      Link: https://lkml.kernel.org/r/635f43bdd85ac2615a58405da82b4d33c6e5eb05.1662017562.git.baolin.wang@linux.alibaba.com
      Fixes: 5480280d ("arm64/mm: enable HugeTLB migration for contiguous bit HugeTLB pages")
      Signed-off-by: NBaolin Wang <baolin.wang@linux.alibaba.com>
      Suggested-by: NMike Kravetz <mike.kravetz@oracle.com>
      Reviewed-by: NMike Kravetz <mike.kravetz@oracle.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Muchun Song <songmuchun@bytedance.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      fac35ba7
    • T
      include/linux/entry-common.h: remove has_signal comment of arch_do_signal_or_restart() prototype · 6a961bff
      Tiezhu Yang 提交于
      The argument has_signal of arch_do_signal_or_restart() has been removed in
      commit 8ba62d37 ("task_work: Call tracehook_notify_signal from
      get_signal on all architectures"), let us remove the related comment.
      
      Link: https://lkml.kernel.org/r/1662090106-5545-1-git-send-email-yangtiezhu@loongson.cn
      Fixes: 8ba62d37 ("task_work: Call tracehook_notify_signal from get_signal on all architectures")
      Signed-off-by: NTiezhu Yang <yangtiezhu@loongson.cn>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      6a961bff
    • J
      prandom: remove unused functions · de492c83
      Jason A. Donenfeld 提交于
      With no callers left of prandom_u32() and prandom_bytes(), as well as
      get_random_int(), remove these deprecated wrappers, in favor of
      get_random_u32() and get_random_bytes().
      Reviewed-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      Reviewed-by: NYury Norov <yury.norov@gmail.com>
      Acked-by: NJakub Kicinski <kuba@kernel.org>
      Signed-off-by: NJason A. Donenfeld <Jason@zx2c4.com>
      de492c83
    • J
      treewide: use prandom_u32_max() when possible, part 1 · 81895a65
      Jason A. Donenfeld 提交于
      Rather than incurring a division or requesting too many random bytes for
      the given range, use the prandom_u32_max() function, which only takes
      the minimum required bytes from the RNG and avoids divisions. This was
      done mechanically with this coccinelle script:
      
      @basic@
      expression E;
      type T;
      identifier get_random_u32 =~ "get_random_int|prandom_u32|get_random_u32";
      typedef u64;
      @@
      (
      - ((T)get_random_u32() % (E))
      + prandom_u32_max(E)
      |
      - ((T)get_random_u32() & ((E) - 1))
      + prandom_u32_max(E * XXX_MAKE_SURE_E_IS_POW2)
      |
      - ((u64)(E) * get_random_u32() >> 32)
      + prandom_u32_max(E)
      |
      - ((T)get_random_u32() & ~PAGE_MASK)
      + prandom_u32_max(PAGE_SIZE)
      )
      
      @multi_line@
      identifier get_random_u32 =~ "get_random_int|prandom_u32|get_random_u32";
      identifier RAND;
      expression E;
      @@
      
      -       RAND = get_random_u32();
              ... when != RAND
      -       RAND %= (E);
      +       RAND = prandom_u32_max(E);
      
      // Find a potential literal
      @literal_mask@
      expression LITERAL;
      type T;
      identifier get_random_u32 =~ "get_random_int|prandom_u32|get_random_u32";
      position p;
      @@
      
              ((T)get_random_u32()@p & (LITERAL))
      
      // Add one to the literal.
      @script:python add_one@
      literal << literal_mask.LITERAL;
      RESULT;
      @@
      
      value = None
      if literal.startswith('0x'):
              value = int(literal, 16)
      elif literal[0] in '123456789':
              value = int(literal, 10)
      if value is None:
              print("I don't know how to handle %s" % (literal))
              cocci.include_match(False)
      elif value == 2**32 - 1 or value == 2**31 - 1 or value == 2**24 - 1 or value == 2**16 - 1 or value == 2**8 - 1:
              print("Skipping 0x%x for cleanup elsewhere" % (value))
              cocci.include_match(False)
      elif value & (value + 1) != 0:
              print("Skipping 0x%x because it's not a power of two minus one" % (value))
              cocci.include_match(False)
      elif literal.startswith('0x'):
              coccinelle.RESULT = cocci.make_expr("0x%x" % (value + 1))
      else:
              coccinelle.RESULT = cocci.make_expr("%d" % (value + 1))
      
      // Replace the literal mask with the calculated result.
      @plus_one@
      expression literal_mask.LITERAL;
      position literal_mask.p;
      expression add_one.RESULT;
      identifier FUNC;
      @@
      
      -       (FUNC()@p & (LITERAL))
      +       prandom_u32_max(RESULT)
      
      @collapse_ret@
      type T;
      identifier VAR;
      expression E;
      @@
      
       {
      -       T VAR;
      -       VAR = (E);
      -       return VAR;
      +       return E;
       }
      
      @drop_var@
      type T;
      identifier VAR;
      @@
      
       {
      -       T VAR;
              ... when != VAR
       }
      Reviewed-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      Reviewed-by: NYury Norov <yury.norov@gmail.com>
      Reviewed-by: NKP Singh <kpsingh@kernel.org>
      Reviewed-by: Jan Kara <jack@suse.cz> # for ext4 and sbitmap
      Reviewed-by: Christoph Böhmwalder <christoph.boehmwalder@linbit.com> # for drbd
      Acked-by: NJakub Kicinski <kuba@kernel.org>
      Acked-by: Heiko Carstens <hca@linux.ibm.com> # for s390
      Acked-by: Ulf Hansson <ulf.hansson@linaro.org> # for mmc
      Acked-by: Darrick J. Wong <djwong@kernel.org> # for xfs
      Signed-off-by: NJason A. Donenfeld <Jason@zx2c4.com>
      81895a65
  9. 10 10月, 2022 2 次提交
  10. 07 10月, 2022 4 次提交
    • J
      vfio: Add vfio_file_is_group() · 4b22ef04
      Jason Gunthorpe 提交于
      This replaces uses of vfio_file_iommu_group() which were only detecting if
      the file is a VFIO file with no interest in the actual group.
      
      The only remaning user of vfio_file_iommu_group() is in KVM for the SPAPR
      stuff. It passes the iommu_group into the arch code through kvm for some
      reason.
      Tested-by: NMatthew Rosato <mjrosato@linux.ibm.com>
      Tested-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Tested-by: NEric Farman <farman@linux.ibm.com>
      Signed-off-by: NJason Gunthorpe <jgg@nvidia.com>
      Link: https://lore.kernel.org/r/1-v2-15417f29324e+1c-vfio_group_disassociate_jgg@nvidia.comSigned-off-by: NAlex Williamson <alex.williamson@redhat.com>
      4b22ef04
    • J
      vdpa: device feature provisioning · 90fea5a8
      Jason Wang 提交于
      This patch allows the device features to be provisioned through
      netlink. A new attribute is introduced to allow the userspace to pass
      a 64bit device features during device adding.
      
      This provides several advantages:
      
      - Allow to provision a subset of the features to ease the cross vendor
        live migration.
      - Better debug-ability for vDPA framework and parent.
      Reviewed-by: NEli Cohen <elic@nvidia.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      Message-Id: <20220927074810.28627-2-jasowang@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      90fea5a8
    • M
      virtio: drop vp_legacy_set_queue_size · cdbd952b
      Michael S. Tsirkin 提交于
      There's actually no way to set queue size on legacy virtio pci.
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Message-Id: <20220815220447.155860-1-mst@redhat.com>
      cdbd952b
    • H
      wifi: wext: use flex array destination for memcpy() · e3e6e1d1
      Hawkins Jiawei 提交于
      Syzkaller reports buffer overflow false positive as follows:
      ------------[ cut here ]------------
      memcpy: detected field-spanning write (size 8) of single field
      	"&compat_event->pointer" at net/wireless/wext-core.c:623 (size 4)
      WARNING: CPU: 0 PID: 3607 at net/wireless/wext-core.c:623
      	wireless_send_event+0xab5/0xca0 net/wireless/wext-core.c:623
      Modules linked in:
      CPU: 1 PID: 3607 Comm: syz-executor659 Not tainted
      	6.0.0-rc6-next-20220921-syzkaller #0
      [...]
      Call Trace:
       <TASK>
       ioctl_standard_call+0x155/0x1f0 net/wireless/wext-core.c:1022
       wireless_process_ioctl+0xc8/0x4c0 net/wireless/wext-core.c:955
       wext_ioctl_dispatch net/wireless/wext-core.c:988 [inline]
       wext_ioctl_dispatch net/wireless/wext-core.c:976 [inline]
       wext_handle_ioctl+0x26b/0x280 net/wireless/wext-core.c:1049
       sock_ioctl+0x285/0x640 net/socket.c:1220
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:870 [inline]
       __se_sys_ioctl fs/ioctl.c:856 [inline]
       __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:856
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
       [...]
       </TASK>
      
      Wireless events will be sent on the appropriate channels in
      wireless_send_event(). Different wireless events may have different
      payload structure and size, so kernel uses **len** and **cmd** field
      in struct __compat_iw_event as wireless event common LCP part, uses
      **pointer** as a label to mark the position of remaining different part.
      
      Yet the problem is that, **pointer** is a compat_caddr_t type, which may
      be smaller than the relative structure at the same position. So during
      wireless_send_event() tries to parse the wireless events payload, it may
      trigger the memcpy() run-time destination buffer bounds checking when the
      relative structure's data is copied to the position marked by **pointer**.
      
      This patch solves it by introducing flexible-array field **ptr_bytes**,
      to mark the position of the wireless events remaining part next to
      LCP part. What's more, this patch also adds **ptr_len** variable in
      wireless_send_event() to improve its maintainability.
      
      Reported-and-tested-by: syzbot+473754e5af963cf014cf@syzkaller.appspotmail.com
      Link: https://lore.kernel.org/all/00000000000070db2005e95a5984@google.com/Suggested-by: NKees Cook <keescook@chromium.org>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NHawkins Jiawei <yin31149@gmail.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      e3e6e1d1
  11. 06 10月, 2022 8 次提交
  12. 05 10月, 2022 7 次提交