Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • L linux-coresight-backports
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • linux-arm
  • linux-coresight-backports
  • Repository
Switch branch/tag
  • linux-coresight-backports
  • arch
  • x86
  • mm
  • init.c
Find file BlameHistoryPermalink
  • Dan Williams's avatar
    mm: fix devmem_is_allowed() for sub-page System RAM intersections · 2bdce744
    Dan Williams authored Jun 14, 2018
    Hussam reports:
    
        I was poking around and for no real reason, I did cat /dev/mem and
        strings /dev/mem.  Then I saw the following warning in dmesg. I saved it
        and rebooted immediately.
    
         memremap attempted on mixed range 0x000000000009c000 size: 0x1000
         ------------[ cut here ]------------
         WARNING: CPU: 0 PID: 11810 at kernel/memremap.c:98 memremap+0x104/0x170
         [..]
         Call Trace:
          xlate_dev_mem_ptr+0x25/0x40
          read_mem+0x89/0x1a0
          __vfs_read+0x36/0x170
    
    The memremap() implementation checks for attempts to remap System RAM
    with MEMREMAP_WB and instead redirects those mapping attempts to the
    linear map.  However, that only works if the physical address range
    being remapped is page aligned.  In low memory we have situations like
    the following:
    
        00000000-00000fff : Reserved
        00001000-0009fbff : System RAM
        0009fc00-0009ffff : Reserved
    
    ...where System RAM intersects Reserved ranges on a sub-page page
    granularity.
    
    Given that devmem_is_allowed() special cases any attempt to map System
    RAM in the first 1MB of memory, replace page_is_ram() with the more
    precise region_intersects() to trap attempts to map disallowed ranges.
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=199999
    Link: http://lkml.kernel.org/r/152856436164.18127.2847888121707136898.stgit@dwillia2-desk3.amr.corp.intel.com
    Fixes: 92281dee
    
     ("arch: introduce memremap()")
    Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
    Reported-by: default avatarHussam Al-Tayeb <me@hussam.eu.org>
    Tested-by: default avatarHussam Al-Tayeb <me@hussam.eu.org>
    Cc: Christoph Hellwig <hch@lst.de>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    2bdce744