summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/task-analyzer.py
diff options
context:
space:
mode:
authorAndrea Arcangeli <aarcange@redhat.com>2013-02-22 15:11:51 -0800
committerIngo Molnar <mingo@kernel.org>2013-02-24 13:01:45 +0100
commita8aed3e0752b4beb2e37cbed6df69faae88268da (patch)
tree52ebb4885c99772d317dc51e9abdca83a1dd150f /tools/perf/scripts/python/task-analyzer.py
parent954f857187033ee3d3704a8206715cf354c38898 (diff)
downloadkernel-a8aed3e0752b4beb2e37cbed6df69faae88268da.tar.gz
x86/mm/pageattr: Prevent PSE and GLOABL leftovers to confuse pmd/pte_present and pmd_huge
Without this patch any kernel code that reads kernel memory in non present kernel pte/pmds (as set by pageattr.c) will crash. With this kernel code: static struct page *crash_page; static unsigned long *crash_address; [..] crash_page = alloc_pages(GFP_KERNEL, 9); crash_address = page_address(crash_page); if (set_memory_np((unsigned long)crash_address, 1)) printk("set_memory_np failure\n"); [..] The kernel will crash if inside the "crash tool" one would try to read the memory at the not present address. crash> p crash_address crash_address = $8 = (long unsigned int *) 0xffff88023c000000 crash> rd 0xffff88023c000000 [ *lockup* ] The lockup happens because _PAGE_GLOBAL and _PAGE_PROTNONE shares the same bit, and pageattr leaves _PAGE_GLOBAL set on a kernel pte which is then mistaken as _PAGE_PROTNONE (so pte_present returns true by mistake and the kernel fault then gets confused and loops). With THP the same can happen after we taught pmd_present to check _PAGE_PROTNONE and _PAGE_PSE in commit 027ef6c87853b0a9df5317 ("mm: thp: fix pmd_present for split_huge_page and PROT_NONE with THP"). THP has the same problem with _PAGE_GLOBAL as the 4k pages, but it also has a problem with _PAGE_PSE, which must be cleared too. After the patch is applied copy_user correctly returns -EFAULT and doesn't lockup anymore. crash> p crash_address crash_address = $9 = (long unsigned int *) 0xffff88023c000000 crash> rd 0xffff88023c000000 rd: read error: kernel virtual address: ffff88023c000000 type: "64-bit KVADDR" Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Shaohua Li <shaohua.li@intel.com> Cc: "H. Peter Anvin" <hpa@linux.intel.com> Cc: Mel Gorman <mgorman@suse.de> Cc: Hugh Dickins <hughd@google.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/task-analyzer.py')
0 files changed, 0 insertions, 0 deletions
r> 2023-06-09backing_dev: remove current->backing_dev_infoChristoph Hellwig 2023-05-24xfs: Provide a splice-read wrapperDavid Howells 2023-04-27Merge tag 'mm-stable-2023-04-27-15-30' of git://git.kernel.org/pub/scm/linux/...Linus Torvalds 2023-04-05xfs: remove xfs_filemap_map_pages() wrapperMatthew Wilcox (Oracle) 2023-04-03fs: add FMODE_DIO_PARALLEL_WRITE flagJens Axboe 2023-02-23Merge tag 'mm-stable-2023-02-20-13-37' of git://git.kernel.org/pub/scm/linux/...Linus Torvalds 2023-02-09mm: replace vma->vm_flags direct modifications with modifier callsSuren Baghdasaryan 2023-01-19fs: port ->setattr() to pass mnt_idmapChristian Brauner 2022-11-07xfs: write page faults in iomap are not buffered writesDave Chinner 2022-10-31xfs: fix incorrect return type for fsdax fault handlersDarrick J. Wong 2022-08-13Merge tag 'xfs-5.20-merge-8' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linuxLinus Torvalds 2022-08-05xfs: check return codes when flushing block devicesDarrick J. Wong 2022-08-05Merge tag 'mm-stable-2022-08-03' of git://git.kernel.org/pub/scm/linux/kernel...Linus Torvalds 2022-07-24xfs: Add async buffered write supportStefan Roesch 2022-07-17xfs: add dax dedupe supportShiyang Ruan 2022-07-17xfs: support CoW in fsdax modeShiyang Ruan 2022-06-01Merge tag 'xfs-5.19-for-linus-2' of git://git.kernel.org/pub/scm/fs/xfs/xfs-l...Linus Torvalds 2022-05-25Merge tag 'xfs-5.19-for-linus' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linuxLinus Torvalds