• Christophe Leroy's avatar
    powerpc/fixmap: fix crash with HIGHMEM · 2807273f
    Christophe Leroy authored
    Commit f2bb8693 ("powerpc/fixmap: don't clear fixmap area in
    paging_init()") removed the clearing of fixmap area in order to
    avoid clearing fixmapped areas set earlier.
    
    However unlike all other users of fixmap which use __set_fixmap(),
    HIGHMEM functions directly use __set_pte_at(). This means
    the page table must pre-exist, otherwise the following crash
    can be encoutered due to the lack of entry in the PGD.
    
    Oops: Kernel access of bad area, sig: 11 [#1]
    BE PAGE_SIZE=4K MMU=Hash PowerMac
    Modules linked in:
    CPU: 0 PID: 1 Comm: swapper Not tainted 5.4.0+ #2528
    NIP:  c0144ce8 LR: c0144ccc CTR: 00000080
    REGS: ef0b5aa0 TRAP: 0300   Not tainted  (5.4.0+)
    MSR:  00009032 <EE,ME,IR,DR,RI>  CR: 44282842  XER: 00000000
    DAR: fffdf000 DSISR: 42000000
    GPR00: c0144ccc ef0b5b58 ef0b0000 fffdf000 fffdf000 00000000 c0000f7c 00000000
    GPR08: c0833000 fffdf000 00000000 ef1c53c9 24042842 00000000 00000000 00000000
    GPR16: 00000000 00000000 ef7e7358 effe8160 00000000 c08a9660 c0851644 00000004
    GPR24: c08c70a8 00002dc2 00000000 00000001 00000201 effe8160 effe8160 00000000
    NIP [c0144ce8] prep_new_page+0x138/0x178
    LR [c0144ccc] prep_new_page+0x11c/0x178
    Call Trace:
    [ef0b5b58] [c0144ccc] prep_new_page+0x11c/0x178 (unreliable)
    [ef0b5b88] [c0147218] get_page_from_freelist+0x1fc/0xd88
    [ef0b5c38] [c0148328] __alloc_pages_nodemask+0xd4/0xbb4
    [ef0b5cf8] [c0142ba8] __vmalloc_node_range+0x1b4/0x2e0
    [ef0b5d38] [c0142dd0] vzalloc+0x48/0x58
    [ef0b5d58] [c0301c8c] check_partition+0x58/0x244
    [ef0b5d78] [c02ffe80] blk_add_partitions+0x44/0x2cc
    [ef0b5db8] [c01a32d8] bdev_disk_changed+0x68/0xfc
    [ef0b5de8] [c01a4494] __blkdev_get+0x290/0x460
    [ef0b5e28] [c02fdd40] __device_add_disk+0x480/0x4d8
    [ef0b5e68] [c0810688] brd_init+0xc0/0x188
    [ef0b5e88] [c0005194] do_one_initcall+0x40/0x19c
    [ef0b5ee8] [c07dd4dc] kernel_init_freeable+0x164/0x230
    [ef0b5f28] [c0005408] kernel_init+0x18/0x10c
    [ef0b5f38] [c0014274] ret_from_kernel_thread+0x14/0x1c
    
    Partially revert that commit to still clear the fixmap area dedicated
    to HIGHMEM.
    
    Fixes: f2bb8693 ("powerpc/fixmap: don't clear fixmap area in paging_init()")
    Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/d42fa9747df5afa41e67b08e374c98d3b40529c9.1574927918.git.christophe.leroy@c-s.fr
    2807273f
mem.c 16.3 KB