Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • L linux-iv
  • 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-iv
  • Repository
Switch branch/tag
  • linux-iv
  • include
  • linux
  • kasan.h
Find file BlameHistoryPermalink
  • Andrey Ryabinin's avatar
    mm: mempool: kasan: don't poot mempool objects in quarantine · 9b75a867
    Andrey Ryabinin authored Jun 24, 2016
    Currently we may put reserved by mempool elements into quarantine via
    kasan_kfree().  This is totally wrong since quarantine may really free
    these objects.  So when mempool will try to use such element,
    use-after-free will happen.  Or mempool may decide that it no longer
    need that element and double-free it.
    
    So don't put object into quarantine in kasan_kfree(), just poison it.
    Rename kasan_kfree() to kasan_poison_kfree() to respect that.
    
    Also, we shouldn't use kasan_slab_alloc()/kasan_krealloc() in
    kasan_unpoison_element() because those functions may update allocation
    stacktrace.  This would be wrong for the most of the remove_element call
    sites.
    
    (The only call site where we may want to update alloc stacktrace is
     in mempool_alloc(). Kmemleak solves this by calling
     kmemleak_update_trace(), so we could make something like that too.
     But this is out of scope of this patch).
    
    Fixes: 55834c59 ("mm: kasan: initial memory quarantine implementation")
    Link: http://lkml.kernel.org/r/575977C3.1010905@virtuozzo.com
    
    
    Signed-off-by: default avatarAndrey Ryabinin <aryabinin@virtuozzo.com>
    Reported-by: default avatarKuthonuzo Luruo <kuthonuzo.luruo@hpe.com>
    Acked-by: default avatarAlexander Potapenko <glider@google.com>
    Cc: Dmitriy Vyukov <dvyukov@google.com>
    Cc: Kostya Serebryany <kcc@google.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    9b75a867