1. 02 Sep, 2022 14 commits
  2. 01 Sep, 2022 24 commits
  3. 31 Aug, 2022 2 commits
    • Jann Horn's avatar
      mm/rmap: Fix anon_vma->degree ambiguity leading to double-reuse · 2555283e
      Jann Horn authored
      anon_vma->degree tracks the combined number of child anon_vmas and VMAs
      that use the anon_vma as their ->anon_vma.
      
      anon_vma_clone() then assumes that for any anon_vma attached to
      src->anon_vma_chain other than src->anon_vma, it is impossible for it to
      be a leaf node of the VMA tree, meaning that for such VMAs ->degree is
      elevated by 1 because of a child anon_vma, meaning that if ->degree
      equals 1 there are no VMAs that use the anon_vma as their ->anon_vma.
      
      This assumption is wrong because the ->degree optimization leads to leaf
      nodes being abandoned on anon_vma_clone() - an existing anon_vma is
      reused and no new parent-child relationship is created.  So it is
      possible to reuse an anon_vma for one VMA while it is still tied to
      another VMA.
      
      This is an issue because is_mergeable_anon_vma() and its callers assume
      that if two VMAs have the same ->anon_vma, the list of anon_vmas
      attached to the VMAs is guaranteed to be the same.  When this assumption
      is violated, vma_merge() can merge pages into a VMA that is not attached
      to the corresponding anon_vma, leading to dangling page->mapping
      pointers that will be dereferenced during rmap walks.
      
      Fix it by separately tracking the number of child anon_vmas and the
      number of VMAs using the anon_vma as their ->anon_vma.
      
      Fixes: 7a3ef208 ("mm: prevent endless growth of anon_vma hierarchy")
      Cc: stable@kernel.org
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Signed-off-by: default avatarJann Horn <jannh@google.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2555283e
    • Sven van Ashbrook's avatar
      r8152: allow userland to disable multicast · 7305b78a
      Sven van Ashbrook authored
      The rtl8152 driver does not disable multicasting when userspace asks
      it to. For example:
       $ ifconfig eth0 -multicast -allmulti
       $ tcpdump -p -i eth0  # will still capture multicast frames
      
      Fix by clearing the device multicast filter table when multicast and
      allmulti are both unset.
      
      Tested as follows:
      - Set multicast on eth0 network interface
      - verify that multicast packets are coming in:
        $ tcpdump -p -i eth0
      - Clear multicast and allmulti on eth0 network interface
      - verify that no more multicast packets are coming in:
        $ tcpdump -p -i eth0
      Signed-off-by: default avatarSven van Ashbrook <svenva@chromium.org>
      Acked-by: default avatarHayes Wang <hayeswang@realtek.com>
      Link: https://lore.kernel.org/r/20220830045923.net-next.v1.1.I4fee0ac057083d4f848caf0fa3a9fd466fc374a0@changeidSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      7305b78a