1. 03 6月, 2020 16 次提交
    • J
      x86/mm/64: implement arch_sync_kernel_mappings() · 8e19843c
      Joerg Roedel 提交于
      Implement the function to sync changes in vmalloc and ioremap ranges to
      all page-tables.
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Acked-by: NAndy Lutomirski <luto@kernel.org>
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: "H . Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Link: http://lkml.kernel.org/r/20200515140023.25469-5-joro@8bytes.orgSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8e19843c
    • C
      s390: use __vmalloc_node in stack_alloc · b200f5b5
      Christoph Hellwig 提交于
      stack_alloc can use a slightly higher level vmalloc function.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Acked-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Cc: Stephen Hemminger <sthemmin@microsoft.com>
      Cc: Wei Liu <wei.liu@kernel.org>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Laura Abbott <labbott@redhat.com>
      Cc: Sumit Semwal <sumit.semwal@linaro.org>
      Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Gao Xiang <xiang@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Kelley <mikelley@microsoft.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Paul Mackerras <paulus@ozlabs.org>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will@kernel.org>
      Link: http://lkml.kernel.org/r/20200414131348.444715-30-hch@lst.deSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b200f5b5
    • C
      powerpc: use __vmalloc_node in alloc_vm_stack · cb0849a9
      Christoph Hellwig 提交于
      alloc_vm_stack can use a slightly higher level vmalloc function.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Gao Xiang <xiang@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Laura Abbott <labbott@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Kelley <mikelley@microsoft.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
      Cc: Stephen Hemminger <sthemmin@microsoft.com>
      Cc: Sumit Semwal <sumit.semwal@linaro.org>
      Cc: Wei Liu <wei.liu@kernel.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Paul Mackerras <paulus@ozlabs.org>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will@kernel.org>
      Link: http://lkml.kernel.org/r/20200414131348.444715-29-hch@lst.deSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      cb0849a9
    • C
      arm64: use __vmalloc_node in arch_alloc_vmap_stack · ebcdd307
      Christoph Hellwig 提交于
      arch_alloc_vmap_stack can use a slightly higher level vmalloc function.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Gao Xiang <xiang@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Laura Abbott <labbott@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Kelley <mikelley@microsoft.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
      Cc: Stephen Hemminger <sthemmin@microsoft.com>
      Cc: Sumit Semwal <sumit.semwal@linaro.org>
      Cc: Wei Liu <wei.liu@kernel.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Paul Mackerras <paulus@ozlabs.org>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will@kernel.org>
      Link: http://lkml.kernel.org/r/20200414131348.444715-28-hch@lst.deSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ebcdd307
    • C
      mm: switch the test_vmalloc module to use __vmalloc_node · c3f896dc
      Christoph Hellwig 提交于
      No need to export the very low-level __vmalloc_node_range when the test
      module can use a slightly higher level variant.
      
      [akpm@linux-foundation.org: add missing `node' arg]
      [akpm@linux-foundation.org: fix riscv nommu build]
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Gao Xiang <xiang@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Laura Abbott <labbott@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Kelley <mikelley@microsoft.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
      Cc: Stephen Hemminger <sthemmin@microsoft.com>
      Cc: Sumit Semwal <sumit.semwal@linaro.org>
      Cc: Wei Liu <wei.liu@kernel.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Paul Mackerras <paulus@ozlabs.org>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will@kernel.org>
      Link: http://lkml.kernel.org/r/20200414131348.444715-26-hch@lst.deSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c3f896dc
    • C
      mm: remove the pgprot argument to __vmalloc · 88dca4ca
      Christoph Hellwig 提交于
      The pgprot argument to __vmalloc is always PAGE_KERNEL now, so remove it.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: Michael Kelley <mikelley@microsoft.com> [hyperv]
      Acked-by: Gao Xiang <xiang@kernel.org> [erofs]
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: NWei Liu <wei.liu@kernel.org>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Laura Abbott <labbott@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
      Cc: Stephen Hemminger <sthemmin@microsoft.com>
      Cc: Sumit Semwal <sumit.semwal@linaro.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Paul Mackerras <paulus@ozlabs.org>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will@kernel.org>
      Link: http://lkml.kernel.org/r/20200414131348.444715-22-hch@lst.deSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      88dca4ca
    • C
      mm: enforce that vmap can't map pages executable · cca98e9f
      Christoph Hellwig 提交于
      To help enforcing the W^X protection don't allow remapping existing pages
      as executable.
      
      x86 bits from Peter Zijlstra, arm64 bits from Mark Rutland.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Mark Rutland <mark.rutland@arm.com>.
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Gao Xiang <xiang@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Laura Abbott <labbott@redhat.com>
      Cc: Michael Kelley <mikelley@microsoft.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
      Cc: Stephen Hemminger <sthemmin@microsoft.com>
      Cc: Sumit Semwal <sumit.semwal@linaro.org>
      Cc: Wei Liu <wei.liu@kernel.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Paul Mackerras <paulus@ozlabs.org>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will@kernel.org>
      Link: http://lkml.kernel.org/r/20200414131348.444715-20-hch@lst.deSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      cca98e9f
    • C
      mm: rename CONFIG_PGTABLE_MAPPING to CONFIG_ZSMALLOC_PGTABLE_MAPPING · 8b136018
      Christoph Hellwig 提交于
      Rename the Kconfig variable to clarify the scope.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Acked-by: NMinchan Kim <minchan@kernel.org>
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Gao Xiang <xiang@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Laura Abbott <labbott@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Kelley <mikelley@microsoft.com>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
      Cc: Stephen Hemminger <sthemmin@microsoft.com>
      Cc: Sumit Semwal <sumit.semwal@linaro.org>
      Cc: Wei Liu <wei.liu@kernel.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Paul Mackerras <paulus@ozlabs.org>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will@kernel.org>
      Link: http://lkml.kernel.org/r/20200414131348.444715-11-hch@lst.deSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8b136018
    • C
      mm: remove __get_vm_area · 49266277
      Christoph Hellwig 提交于
      Switch the two remaining callers to use __get_vm_area_caller instead.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Gao Xiang <xiang@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Laura Abbott <labbott@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Kelley <mikelley@microsoft.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
      Cc: Stephen Hemminger <sthemmin@microsoft.com>
      Cc: Sumit Semwal <sumit.semwal@linaro.org>
      Cc: Wei Liu <wei.liu@kernel.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Paul Mackerras <paulus@ozlabs.org>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will@kernel.org>
      Link: http://lkml.kernel.org/r/20200414131348.444715-9-hch@lst.deSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      49266277
    • C
      powerpc: remove __ioremap_at and __iounmap_at · 91f03f29
      Christoph Hellwig 提交于
      These helpers are only used for remapping the ISA I/O base.  Replace the
      mapping side with a remap_isa_range helper in isa-bridge.c that hard codes
      all the known arguments, and just remove __iounmap_at in favour of open
      coding it in the only caller.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Gao Xiang <xiang@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Laura Abbott <labbott@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Kelley <mikelley@microsoft.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
      Cc: Stephen Hemminger <sthemmin@microsoft.com>
      Cc: Sumit Semwal <sumit.semwal@linaro.org>
      Cc: Wei Liu <wei.liu@kernel.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Paul Mackerras <paulus@ozlabs.org>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will@kernel.org>
      Link: http://lkml.kernel.org/r/20200414131348.444715-8-hch@lst.deSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      91f03f29
    • C
      powerpc: add an ioremap_phb helper · b274014c
      Christoph Hellwig 提交于
      Factor code shared between pci_64 and electra_cf into a ioremap_pbh helper
      that follows the normal ioremap semantics, and returns a useful __iomem
      pointer.  Note that it opencodes __ioremap_at as we know from the callers
      the slab is available.  Switch pci_64 to also store the result as __iomem
      pointer, and unmap the result using iounmap instead of force casting and
      using vmalloc APIs.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Gao Xiang <xiang@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Laura Abbott <labbott@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Kelley <mikelley@microsoft.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
      Cc: Stephen Hemminger <sthemmin@microsoft.com>
      Cc: Sumit Semwal <sumit.semwal@linaro.org>
      Cc: Wei Liu <wei.liu@kernel.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Paul Mackerras <paulus@ozlabs.org>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will@kernel.org>
      Link: http://lkml.kernel.org/r/20200414131348.444715-7-hch@lst.deSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b274014c
    • C
      x86: fix vmap arguments in map_irq_stack · 03488011
      Christoph Hellwig 提交于
      vmap does not take a gfp_t, the flags argument is for VM_* flags.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Gao Xiang <xiang@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Laura Abbott <labbott@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Kelley <mikelley@microsoft.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
      Cc: Stephen Hemminger <sthemmin@microsoft.com>
      Cc: Sumit Semwal <sumit.semwal@linaro.org>
      Cc: Wei Liu <wei.liu@kernel.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Paul Mackerras <paulus@ozlabs.org>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will@kernel.org>
      Link: http://lkml.kernel.org/r/20200414131348.444715-3-hch@lst.deSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      03488011
    • C
      x86/hyperv: use vmalloc_exec for the hypercall page · 78bb17f7
      Christoph Hellwig 提交于
      Patch series "decruft the vmalloc API", v2.
      
      Peter noticed that with some dumb luck you can toast the kernel address
      space with exported vmalloc symbols.
      
      I used this as an opportunity to decruft the vmalloc.c API and make it
      much more systematic.  This also removes any chance to create vmalloc
      mappings outside the designated areas or using executable permissions
      from modules.  Besides that it removes more than 300 lines of code.
      
      This patch (of 29):
      
      Use the designated helper for allocating executable kernel memory, and
      remove the now unused PAGE_KERNEL_RX define.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: NMichael Kelley <mikelley@microsoft.com>
      Acked-by: NWei Liu <wei.liu@kernel.org>
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Gao Xiang <xiang@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Laura Abbott <labbott@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
      Cc: Stephen Hemminger <sthemmin@microsoft.com>
      Cc: Sumit Semwal <sumit.semwal@linaro.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@ozlabs.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Link: http://lkml.kernel.org/r/20200414131348.444715-1-hch@lst.de
      Link: http://lkml.kernel.org/r/20200414131348.444715-2-hch@lst.deSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      78bb17f7
    • S
      mm: ptdump: expand type of 'val' in note_page() · 99395ee3
      Steven Price 提交于
      The page table entry is passed in the 'val' argument to note_page(),
      however this was previously an "unsigned long" which is fine on 64-bit
      platforms.  But for 32 bit x86 it is not always big enough to contain a
      page table entry which may be 64 bits.
      
      Change the type to u64 to ensure that it is always big enough.
      
      [akpm@linux-foundation.org: fix riscv]
      Reported-by: NJan Beulich <jbeulich@suse.com>
      Signed-off-by: NSteven Price <steven.price@arm.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: <stable@vger.kernel.org>
      Link: http://lkml.kernel.org/r/20200521152308.33096-3-steven.price@arm.comSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      99395ee3
    • S
      x86: mm: ptdump: calculate effective permissions correctly · 1494e0c3
      Steven Price 提交于
      Patch series "Fix W+X debug feature on x86"
      
      Jan alerted me[1] that the W+X detection debug feature was broken in x86
      by my change[2] to switch x86 to use the generic ptdump infrastructure.
      
      Fundamentally the approach of trying to move the calculation of
      effective permissions into note_page() was broken because note_page() is
      only called for 'leaf' entries and the effective permissions are passed
      down via the internal nodes of the page tree.  The solution I've taken
      here is to create a new (optional) callback which is called for all
      nodes of the page tree and therefore can calculate the effective
      permissions.
      
      Secondly on some configurations (32 bit with PAE) "unsigned long" is not
      large enough to store the table entries.  The fix here is simple - let's
      just use a u64.
      
      [1] https://lore.kernel.org/lkml/d573dc7e-e742-84de-473d-f971142fa319@suse.com/
      [2] 2ae27137 ("x86: mm: convert dump_pagetables to use walk_page_range")
      
      This patch (of 2):
      
      By switching the x86 page table dump code to use the generic code the
      effective permissions are no longer calculated correctly because the
      note_page() function is only called for *leaf* entries.  To calculate
      the actual effective permissions it is necessary to observe the full
      hierarchy of the page tree.
      
      Introduce a new callback for ptdump which is called for every entry and
      can therefore update the prot_levels array correctly.  note_page() can
      then simply access the appropriate element in the array.
      
      [steven.price@arm.com: make the assignment conditional on val != 0]
        Link: http://lkml.kernel.org/r/430c8ab4-e7cd-6933-dde6-087fac6db872@arm.com
      Fixes: 2ae27137 ("x86: mm: convert dump_pagetables to use walk_page_range")
      Reported-by: NJan Beulich <jbeulich@suse.com>
      Signed-off-by: NSteven Price <steven.price@arm.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Cc: Qian Cai <cai@lca.pw>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: <stable@vger.kernel.org>
      Link: http://lkml.kernel.org/r/20200521152308.33096-1-steven.price@arm.com
      Link: http://lkml.kernel.org/r/20200521152308.33096-2-steven.price@arm.comSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      1494e0c3
    • A
      arch/parisc/include/asm/pgtable.h: remove unused `old_pte' · 78128fab
      Andrew Morton 提交于
      parisc's set_pte_at() macro has set-but-not-used variable:
      
        include/linux/pgtable.h: In function 'pte_clear_not_present_full':
        arch/parisc/include/asm/pgtable.h:96:9: warning: variable 'old_pte' set but not used [-Wunused-but-set-variable]
      Reported-by: Nkbuild test robot <lkp@intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Mike Rapoport <rppt@linux.ibm.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      78128fab
  2. 31 5月, 2020 1 次提交
  3. 29 5月, 2020 4 次提交
    • H
      parisc: Fix kernel panic in mem_init() · bf71bc16
      Helge Deller 提交于
      The Debian kernel v5.6 triggers this kernel panic:
      
       Kernel panic - not syncing: Bad Address (null pointer deref?)
       Bad Address (null pointer deref?): Code=26 (Data memory access rights trap) at addr 0000000000000000
       CPU: 0 PID: 0 Comm: swapper Not tainted 5.6.0-2-parisc64 #1 Debian 5.6.14-1
        IAOQ[0]: mem_init+0xb0/0x150
        IAOQ[1]: mem_init+0xb4/0x150
        RP(r2): start_kernel+0x6c8/0x1190
       Backtrace:
        [<0000000040101ab4>] start_kernel+0x6c8/0x1190
        [<0000000040108574>] start_parisc+0x158/0x1b8
      
      on a HP-PARISC rp3440 machine with this memory layout:
       Memory Ranges:
        0) Start 0x0000000000000000 End 0x000000003fffffff Size   1024 MB
        1) Start 0x0000004040000000 End 0x00000040ffdfffff Size   3070 MB
      
      Fix the crash by avoiding virt_to_page() and similar functions in
      mem_init() until the memory zones have been fully set up.
      Signed-off-by: NHelge Deller <deller@gmx.de>
      Cc: stable@vger.kernel.org # v5.0+
      bf71bc16
    • D
      powerpc/64s: Disable sanitisers for C syscall/interrupt entry/exit code · 2f26ed17
      Daniel Axtens 提交于
      syzkaller is picking up a bunch of crashes that look like this:
      
        Unrecoverable exception 380 at c00000000037ed60 (msr=8000000000001031)
        Oops: Unrecoverable exception, sig: 6 [#1]
        LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries
        Modules linked in:
        CPU: 0 PID: 874 Comm: syz-executor.0 Not tainted 5.7.0-rc7-syzkaller-00016-gb0c3ba31 #0
        NIP:  c00000000037ed60 LR: c00000000004bac8 CTR: c000000000030990
        REGS: c0000000555a7230 TRAP: 0380   Not tainted  (5.7.0-rc7-syzkaller-00016-gb0c3ba31)
        MSR:  8000000000001031 <SF,ME,IR,DR,LE>  CR: 48222882  XER: 20000000
        CFAR: c00000000004bac4 IRQMASK: 0
        GPR00: c00000000004bb68 c0000000555a74c0 c0000000024b3500 0000000000000005
        GPR04: 0000000000000000 0000000000000000 c00000000004bb88 c008000000910000
        GPR08: 00000000000b0000 c00000000004bac8 0000000000016000 c000000002503500
        GPR12: c000000000030990 c000000003190000 00000000106a5898 00000000106a0000
        GPR16: 00000000106a5890 c000000007a92000 c000000008180e00 c000000007a8f700
        GPR20: c000000007a904b0 0000000010110000 c00000000259d318 5deadbeef0000100
        GPR24: 5deadbeef0000122 c000000078422700 c000000009ee88b8 c000000078422778
        GPR28: 0000000000000001 800000000280b033 0000000000000000 c0000000555a75a0
        NIP [c00000000037ed60] __sanitizer_cov_trace_pc+0x40/0x50
        LR [c00000000004bac8] interrupt_exit_kernel_prepare+0x118/0x310
        Call Trace:
        [c0000000555a74c0] [c00000000004bb68] interrupt_exit_kernel_prepare+0x1b8/0x310 (unreliable)
        [c0000000555a7530] [c00000000000f9a8] interrupt_return+0x118/0x1c0
        --- interrupt: 900 at __sanitizer_cov_trace_pc+0x0/0x50
        ...<random previous call chain>...
      
      This is caused by __sanitizer_cov_trace_pc() causing an SLB fault
      after MSR[RI] has been cleared by __hard_EE_RI_disable(), which we
      can not recover from.
      
      Do not instrument the new syscall/interrupt entry/exit code with KCOV,
      GCOV or UBSAN.
      Reported-by: Nsyzbot-ppc64 <ozlabsyz@au1.ibm.com>
      Fixes: 68b34588 ("powerpc/64/sycall: Implement syscall entry/exit logic in C")
      Signed-off-by: NDaniel Axtens <dja@axtens.net>
      Acked-by: NAndrew Donnellan <ajd@linux.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      2f26ed17
    • J
      x86/ioperm: Prevent a memory leak when fork fails · 4bfe6cce
      Jay Lang 提交于
      In the copy_process() routine called by _do_fork(), failure to allocate
      a PID (or further along in the function) will trigger an invocation to
      exit_thread(). This is done to clean up from an earlier call to
      copy_thread_tls(). Naturally, the child task is passed into exit_thread(),
      however during the process, io_bitmap_exit() nullifies the parent's
      io_bitmap rather than the child's.
      
      As copy_thread_tls() has been called ahead of the failure, the reference
      count on the calling thread's io_bitmap is incremented as we would expect.
      However, io_bitmap_exit() doesn't accept any arguments, and thus assumes
      it should trash the current thread's io_bitmap reference rather than the
      child's. This is pretty sneaky in practice, because in all instances but
      this one, exit_thread() is called with respect to the current task and
      everything works out.
      
      A determined attacker can issue an appropriate ioctl (i.e. KDENABIO) to
      get a bitmap allocated, and force a clone3() syscall to fail by passing
      in a zeroed clone_args structure. The kernel handles the erroneous struct
      and the buggy code path is followed, and even though the parent's reference
      to the io_bitmap is trashed, the child still holds a reference and thus
      the structure will never be freed.
      
      Fix this by tweaking io_bitmap_exit() and its subroutines to accept a
      task_struct argument which to operate on.
      
      Fixes: ea5f1cd7 ("x86/ioperm: Remove bitmap if all permissions dropped")
      Signed-off-by: NJay Lang <jaytlang@mit.edu>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: stable#@vger.kernel.org
      Link: https://lkml.kernel.org/r/20200524162742.253727-1-jaytlang@mit.edu
      4bfe6cce
    • A
      x86/dma: Fix max PFN arithmetic overflow on 32 bit systems · 88743470
      Alexander Dahl 提交于
      The intermediate result of the old term (4UL * 1024 * 1024 * 1024) is
      4 294 967 296 or 0x100000000 which is no problem on 64 bit systems.
      The patch does not change the later overall result of 0x100000 for
      MAX_DMA32_PFN (after it has been shifted by PAGE_SHIFT). The new
      calculation yields the same result, but does not require 64 bit
      arithmetic.
      
      On 32 bit systems the old calculation suffers from an arithmetic
      overflow in that intermediate term in braces: 4UL aka unsigned long int
      is 4 byte wide and an arithmetic overflow happens (the 0x100000000 does
      not fit in 4 bytes), the in braces result is truncated to zero, the
      following right shift does not alter that, so MAX_DMA32_PFN evaluates to
      0 on 32 bit systems.
      
      That wrong value is a problem in a comparision against MAX_DMA32_PFN in
      the init code for swiotlb in pci_swiotlb_detect_4gb() to decide if
      swiotlb should be active.  That comparison yields the opposite result,
      when compiling on 32 bit systems.
      
      This was not possible before
      
        1b7e03ef ("x86, NUMA: Enable emulation on 32bit too")
      
      when that MAX_DMA32_PFN was first made visible to x86_32 (and which
      landed in v3.0).
      
      In practice this wasn't a problem, unless CONFIG_SWIOTLB is active on
      x86-32.
      
      However if one has set CONFIG_IOMMU_INTEL, since
      
        c5a5dc4c ("iommu/vt-d: Don't switch off swiotlb if bounce page is used")
      
      there's a dependency on CONFIG_SWIOTLB, which was not necessarily
      active before. That landed in v5.4, where we noticed it in the fli4l
      Linux distribution. We have CONFIG_IOMMU_INTEL active on both 32 and 64
      bit kernel configs there (I could not find out why, so let's just say
      historical reasons).
      
      The effect is at boot time 64 MiB (default size) were allocated for
      bounce buffers now, which is a noticeable amount of memory on small
      systems like pcengines ALIX 2D3 with 256 MiB memory, which are still
      frequently used as home routers.
      
      We noticed this effect when migrating from kernel v4.19 (LTS) to v5.4
      (LTS) in fli4l and got that kernel messages for example:
      
        Linux version 5.4.22 (buildroot@buildroot) (gcc version 7.3.0 (Buildroot 2018.02.8)) #1 SMP Mon Nov 26 23:40:00 CET 2018
        …
        Memory: 183484K/261756K available (4594K kernel code, 393K rwdata, 1660K rodata, 536K init, 456K bss , 78272K reserved, 0K cma-reserved, 0K highmem)
        …
        PCI-DMA: Using software bounce buffering for IO (SWIOTLB)
        software IO TLB: mapped [mem 0x0bb78000-0x0fb78000] (64MB)
      
      The initial analysis and the suggested fix was done by user 'sourcejedi'
      at stackoverflow and explicitly marked as GPLv2 for inclusion in the
      Linux kernel:
      
        https://unix.stackexchange.com/a/520525/50007
      
      The new calculation, which does not suffer from that overflow, is the
      same as for arch/mips now as suggested by Robin Murphy.
      
      The fix was tested by fli4l users on round about two dozen different
      systems, including both 32 and 64 bit archs, bare metal and virtualized
      machines.
      
       [ bp: Massage commit message. ]
      
      Fixes: 1b7e03ef ("x86, NUMA: Enable emulation on 32bit too")
      Reported-by: NAlan Jenkins <alan.christopher.jenkins@gmail.com>
      Suggested-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NAlexander Dahl <post@lespocky.de>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Reviewed-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: stable@vger.kernel.org
      Link: https://unix.stackexchange.com/q/520065/50007
      Link: https://web.nettworks.org/bugs/browse/FFL-2560
      Link: https://lkml.kernel.org/r/20200526175749.20742-1-post@lespocky.de
      88743470
  4. 28 5月, 2020 7 次提交
  5. 27 5月, 2020 2 次提交
  6. 26 5月, 2020 2 次提交
    • A
      x86/syscalls: Revert "x86/syscalls: Make __X32_SYSCALL_BIT be unsigned long" · 700d3a5a
      Andy Lutomirski 提交于
      Revert
      
        45e29d11 ("x86/syscalls: Make __X32_SYSCALL_BIT be unsigned long")
      
      and add a comment to discourage someone else from making the same
      mistake again.
      
      It turns out that some user code fails to compile if __X32_SYSCALL_BIT
      is unsigned long. See, for example [1] below.
      
       [ bp: Massage and do the same thing in the respective tools/ header. ]
      
      Fixes: 45e29d11 ("x86/syscalls: Make __X32_SYSCALL_BIT be unsigned long")
      Reported-by: NThorsten Glaser <t.glaser@tarent.de>
      Signed-off-by: NAndy Lutomirski <luto@kernel.org>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Cc: stable@kernel.org
      Link: [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=954294
      Link: https://lkml.kernel.org/r/92e55442b744a5951fdc9cfee10badd0a5f7f828.1588983892.git.luto@kernel.org
      700d3a5a
    • M
      powerpc/64s: Fix restore of NV GPRs after facility unavailable exception · 595d153d
      Michael Ellerman 提交于
      Commit 702f0980 ("powerpc/64s/exception: Remove lite interrupt
      return") changed the interrupt return path to not restore non-volatile
      registers by default, and explicitly restore them in paths where it is
      required.
      
      But it missed that the facility unavailable exception can sometimes
      modify user registers, ie. when it does emulation of move from DSCR.
      
      This is seen as a failure of the dscr_sysfs_thread_test:
        test: dscr_sysfs_thread_test
        [cpu 0] User DSCR should be 1 but is 0
        failure: dscr_sysfs_thread_test
      
      So restore non-volatile GPRs after facility unavailable exceptions.
      
      Currently the hypervisor facility unavailable exception is also wired
      up to call facility_unavailable_exception().
      
      In practice we should never take a hypervisor facility unavailable
      exception for the DSCR. On older bare metal systems we set HFSCR_DSCR
      unconditionally in __init_HFSCR, or on newer systems it should be
      enabled via the "data-stream-control-register" device tree CPU
      feature.
      
      Even if it's not, since commit f3c99f97 ("KVM: PPC: Book3S HV:
      Don't access HFSCR, LPIDR or LPCR when running nested"), the KVM code
      has unconditionally set HFSCR_DSCR when running guests.
      
      So we should only get a hypervisor facility unavailable for the DSCR
      if skiboot has disabled the "data-stream-control-register" feature,
      and we are somehow in guest context but not via KVM.
      
      Given all that, it should be unnecessary to add a restore of
      non-volatile GPRs after the hypervisor facility exception, because we
      never expect to hit that path. But equally we may as well add the
      restore, because we never expect to hit that path, and if we ever did,
      at least we would correctly restore the registers to their post
      emulation state.
      
      In future we can split the non-HV and HV facility unavailable handling
      so that there is no emulation in the HV handler, and then remove the
      restore for the HV case.
      
      Fixes: 702f0980 ("powerpc/64s/exception: Remove lite interrupt return")
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20200526061808.2472279-1-mpe@ellerman.id.au
      595d153d
  7. 24 5月, 2020 4 次提交
  8. 23 5月, 2020 1 次提交
    • J
      x86/unwind/orc: Fix unwind_get_return_address_ptr() for inactive tasks · 187b96db
      Josh Poimboeuf 提交于
      Normally, show_trace_log_lvl() scans the stack, looking for text
      addresses to print.  In parallel, it unwinds the stack with
      unwind_next_frame().  If the stack address matches the pointer returned
      by unwind_get_return_address_ptr() for the current frame, the text
      address is printed normally without a question mark.  Otherwise it's
      considered a breadcrumb (potentially from a previous call path) and it's
      printed with a question mark to indicate that the address is unreliable
      and typically can be ignored.
      
      Since the following commit:
      
        f1d9a2ab ("x86/unwind/orc: Don't skip the first frame for inactive tasks")
      
      ... for inactive tasks, show_trace_log_lvl() prints *only* unreliable
      addresses (prepended with '?').
      
      That happens because, for the first frame of an inactive task,
      unwind_get_return_address_ptr() returns the wrong return address
      pointer: one word *below* the task stack pointer.  show_trace_log_lvl()
      starts scanning at the stack pointer itself, so it never finds the first
      'reliable' address, causing only guesses to being printed.
      
      The first frame of an inactive task isn't a normal stack frame.  It's
      actually just an instance of 'struct inactive_task_frame' which is left
      behind by __switch_to_asm().  Now that this inactive frame is actually
      exposed to callers, fix unwind_get_return_address_ptr() to interpret it
      properly.
      
      Fixes: f1d9a2ab ("x86/unwind/orc: Don't skip the first frame for inactive tasks")
      Reported-by: NTetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
      Signed-off-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lkml.kernel.org/r/20200522135435.vbxs7umku5pyrdbk@treble
      187b96db
  9. 22 5月, 2020 3 次提交