• Andrew Morton's avatar
    [PATCH] atomic copy_*_user infrastructure · 4b19c940
    Andrew Morton authored
    The patch implements the atomic copy_*_user() function.
    
    If the kernel takes a pagefault while running copy_*_user() in an
    atomic region, the copy_*_user() will fail (return a short value).
    
    And with this patch, holding an atomic kmap() puts the CPU into an
    atomic region.
    
    - Increment preempt_count() in kmap_atomic() regardless of the
      setting of CONFIG_PREEMPT.  The pagefault handler recognises this as
      an atomic region and refuses to service the fault.  copy_*_user will
      return a non-zero value.
    
    - Attempts to propagate the in_atomic() predicate to all the other
      highmem-capable architectures' pagefault handlers.  But the code is
      only tested on x86.
    
    - Fixed a PPC bug in kunmap_atomic(): it forgot to reenable
      preemption if HIGHMEM_DEBUG is turned on.
    
    - Fixed a sparc bug in kunmap_atomic(): it forgot to reenable
      preemption all the time, for non-fixmap pages.
    
    - Fix an error in <linux/highmem.h> - in the CONFIG_HIGHMEM=n case,
      kunmap_atomic() takes an address, not a page *.
    4b19c940
hardirq.h 4.59 KB