• Helge Deller's avatar
    parisc: Fix userspace graphics card breakage due to pgtable special bit · 70be49f2
    Helge Deller authored
    Commit df24e178 ("parisc: Add vDSO support") introduced the vDSO
    support, for which a _PAGE_SPECIAL page table flag was needed.  Since we
    wanted to keep every page table entry in 32-bits, this patch re-used the
    existing - but yet unused - _PAGE_DMB flag (which triggers a hardware break
    if a page is accessed) to store the special bit.
    
    But when graphics card memory is mmapped into userspace, the kernel uses
    vm_iomap_memory() which sets the the special flag. So, with the DMB bit
    set, every access to the graphics memory now triggered a hardware
    exception and segfaulted the userspace program.
    
    Fix this breakage by dropping the DMB bit when writing the page
    protection bits to the CPU TLB.
    
    In addition this patch adds a small optimization: if huge pages aren't
    configured (which is at least the case for 32-bit kernels), then the
    special bit is stored in the hpage (HUGE PAGE) bit instead. That way we
    can skip to reset the DMB bit.
    
    Fixes: df24e178 ("parisc: Add vDSO support")
    Cc: <stable@vger.kernel.org> # 5.18+
    Signed-off-by: default avatarHelge Deller <deller@gmx.de>
    70be49f2
entry.S 53.4 KB