1. 03 5月, 2018 1 次提交
  2. 14 4月, 2018 1 次提交
  3. 13 4月, 2018 1 次提交
  4. 12 4月, 2018 9 次提交
  5. 11 4月, 2018 1 次提交
  6. 10 4月, 2018 1 次提交
  7. 06 4月, 2018 3 次提交
  8. 01 4月, 2018 1 次提交
  9. 31 3月, 2018 4 次提交
  10. 30 3月, 2018 1 次提交
  11. 28 3月, 2018 2 次提交
  12. 27 3月, 2018 1 次提交
  13. 26 3月, 2018 7 次提交
  14. 24 3月, 2018 1 次提交
  15. 23 3月, 2018 1 次提交
    • T
      mm/vmalloc: add interfaces to free unmapped page table · b6bdb751
      Toshi Kani 提交于
      On architectures with CONFIG_HAVE_ARCH_HUGE_VMAP set, ioremap() may
      create pud/pmd mappings.  A kernel panic was observed on arm64 systems
      with Cortex-A75 in the following steps as described by Hanjun Guo.
      
       1. ioremap a 4K size, valid page table will build,
       2. iounmap it, pte0 will set to 0;
       3. ioremap the same address with 2M size, pgd/pmd is unchanged,
          then set the a new value for pmd;
       4. pte0 is leaked;
       5. CPU may meet exception because the old pmd is still in TLB,
          which will lead to kernel panic.
      
      This panic is not reproducible on x86.  INVLPG, called from iounmap,
      purges all levels of entries associated with purged address on x86.  x86
      still has memory leak.
      
      The patch changes the ioremap path to free unmapped page table(s) since
      doing so in the unmap path has the following issues:
      
       - The iounmap() path is shared with vunmap(). Since vmap() only
         supports pte mappings, making vunmap() to free a pte page is an
         overhead for regular vmap users as they do not need a pte page freed
         up.
      
       - Checking if all entries in a pte page are cleared in the unmap path
         is racy, and serializing this check is expensive.
      
       - The unmap path calls free_vmap_area_noflush() to do lazy TLB purges.
         Clearing a pud/pmd entry before the lazy TLB purges needs extra TLB
         purge.
      
      Add two interfaces, pud_free_pmd_page() and pmd_free_pte_page(), which
      clear a given pud/pmd entry and free up a page for the lower level
      entries.
      
      This patch implements their stub functions on x86 and arm64, which work
      as workaround.
      
      [akpm@linux-foundation.org: fix typo in pmd_free_pte_page() stub]
      Link: http://lkml.kernel.org/r/20180314180155.19492-2-toshi.kani@hpe.com
      Fixes: e61ce6ad ("mm: change ioremap to set up huge I/O mappings")
      Reported-by: NLei Li <lious.lilei@hisilicon.com>
      Signed-off-by: NToshi Kani <toshi.kani@hpe.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Wang Xuefeng <wxf.wang@hisilicon.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Hanjun Guo <guohanjun@huawei.com>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Chintan Pandya <cpandya@codeaurora.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b6bdb751
  16. 22 3月, 2018 3 次提交
    • C
      netns: send uevent messages · 692ec06d
      Christian Brauner 提交于
      This patch adds a receive method to NETLINK_KOBJECT_UEVENT netlink sockets
      to allow sending uevent messages into the network namespace the socket
      belongs to.
      
      Currently non-initial network namespaces are already isolated and don't
      receive uevents. There are a number of cases where it is beneficial for a
      sufficiently privileged userspace process to send a uevent into a network
      namespace.
      
      One such use case would be debugging and fuzzing of a piece of software
      which listens and reacts to uevents. By running a copy of that software
      inside a network namespace, specific uevents could then be presented to it.
      More concretely, this would allow for easy testing of udevd/ueventd.
      
      This will also allow some piece of software to run components inside a
      separate network namespace and then effectively filter what that software
      can receive. Some examples of software that do directly listen to uevents
      and that we have in the past attempted to run inside a network namespace
      are rbd (CEPH client) or the X server.
      
      Implementation:
      The implementation has been kept as simple as possible from the kernel's
      perspective. Specifically, a simple input method uevent_net_rcv() is added
      to NETLINK_KOBJECT_UEVENT sockets which completely reuses existing
      af_netlink infrastructure and does neither add an additional netlink family
      nor requires any user-visible changes.
      
      For example, by using netlink_rcv_skb() we can make use of existing netlink
      infrastructure to report back informative error messages to userspace.
      
      Furthermore, this implementation does not introduce any overhead for
      existing uevent generating codepaths. The struct netns got a new uevent
      socket member that records the uevent socket associated with that network
      namespace including its position in the uevent socket list. Since we record
      the uevent socket for each network namespace in struct net we don't have to
      walk the whole uevent socket list. Instead we can directly retrieve the
      relevant uevent socket and send the message. At exit time we can now also
      trivially remove the uevent socket from the uevent socket list. This keeps
      the codepath very performant without introducing needless overhead and even
      makes older codepaths faster.
      
      Uevent sequence numbers are kept global. When a uevent message is sent to
      another network namespace the implementation will simply increment the
      global uevent sequence number and append it to the received uevent. This
      has the advantage that the kernel will never need to parse the received
      uevent message to replace any existing uevent sequence numbers. Instead it
      is up to the userspace process to remove any existing uevent sequence
      numbers in case the uevent message to be sent contains any.
      
      Security:
      In order for a caller to send uevent messages to a target network namespace
      the caller must have CAP_SYS_ADMIN in the owning user namespace of the
      target network namespace. Additionally, any received uevent message is
      verified to not exceed size UEVENT_BUFFER_SIZE. This includes the space
      needed to append the uevent sequence number.
      
      Testing:
      This patch has been tested and verified to work with the following udev
      implementations:
      1. CentOS 6 with udevd version 147
      2. Debian Sid with systemd-udevd version 237
      3. Android 7.1.1 with ueventd
      Signed-off-by: NChristian Brauner <christian.brauner@ubuntu.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      692ec06d
    • C
      net: add uevent socket member · 94e5e308
      Christian Brauner 提交于
      This commit adds struct uevent_sock to struct net. Since struct uevent_sock
      records the position of the uevent socket in the uevent socket list we can
      trivially remove it from the uevent socket list during cleanup. This speeds
      up the old removal codepath.
      Note, list_del() will hit __list_del_entry_valid() in its call chain which
      will validate that the element is a member of the list. If it isn't it will
      take care that the list is not modified.
      Signed-off-by: NChristian Brauner <christian.brauner@ubuntu.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      94e5e308
    • Z
      lib: Add generic PIO mapping method · 031e3601
      Zhichang Yuan 提交于
      41f8bba7 ("of/pci: Add pci_register_io_range() and
      pci_pio_to_address()") added support for PCI I/O space mapped into CPU
      physical memory space.  With that support, the I/O ranges configured for
      PCI/PCIe hosts on some architectures can be mapped to logical PIO and
      converted easily between CPU address and the corresponding logical PIO.
      Based on this, PCI I/O port space can be accessed via in/out accessors that
      use memory read/write.
      
      But on some platforms, there are bus hosts that access I/O port space with
      host-local I/O port addresses rather than memory addresses.
      
      Add a more generic I/O mapping method to support those devices.  With this
      patch, both the CPU addresses and the host-local port can be mapped into
      the logical PIO space with different logical/fake PIOs.  After this, all
      the I/O accesses to either PCI MMIO devices or host-local I/O peripherals
      can be unified into the existing I/O accessors defined in asm-generic/io.h
      and be redirected to the right device-specific hooks based on the input
      logical PIO.
      Tested-by: Ndann frazier <dann.frazier@canonical.com>
      Signed-off-by: NZhichang Yuan <yuanzhichang@hisilicon.com>
      Signed-off-by: NGabriele Paoloni <gabriele.paoloni@huawei.com>
      Signed-off-by: NJohn Garry <john.garry@huawei.com>
      [bhelgaas: remove -EFAULT return from logic_pio_register_range() per
      https://lkml.kernel.org/r/20180403143909.GA21171@ulmo, fix NULL pointer
      checking per https://lkml.kernel.org/r/20180403211505.GA29612@embeddedor.com]
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NAndy Shevchenko <andy.shevchenko@gmail.com>
      031e3601
  17. 21 3月, 2018 1 次提交
  18. 20 3月, 2018 1 次提交