← Back to team overview

kernel-packages team mailing list archive

[Bug 1323526] [NEW] apparmor spam log with warnings on Preempt kernels

 

Public bug reported:

    The apparmor/dbus support needs to allocate buffers in
    atomic context (i.e: holding a spinlock) since that is
    not possible, it declares a static per cpu array of
    buffers and has accessor macros to get and put buffers.
    
    Since the buffer array is a per cpu variable, it can
    only be concurrently accessed by the same cpu and this
    can only happen if the kernel is preempted.
    
    So the get_buffers() macro disables preemption with
    preempt_disable() so the buffer can be accessed safely.
    
    Grabbing a spinlock also makes the kernel to disable
    preemption so a raw __get_buffers() function can be used
    in this case that does not call preempt_disable().
    
    The raw __get_buffers() function was called from file_path_perm()
    since a spinlock was held by the calling revalidate_tty() function.
    
    But this is not the only place where file_path_perm() is called,
    it is also called by match_file() which is not in atomic context
    and thus doesn't disable preemption before so the __get_buffers()
    macro was complaining with a WARN_ON(preempt_count() <= 0) and
    spamming the console constantly.
    
    This patch fix the issue by always calling {get,put}_buffers() since
    preempt_{disable,enable}() functions are nestable.

** Affects: linux (Ubuntu)
     Importance: Undecided
     Assignee: John Johansen (jjohansen)
         Status: Confirmed

** Affects: linux (Ubuntu Trusty)
     Importance: Undecided
         Status: Confirmed

** Affects: linux (Ubuntu Utopic)
     Importance: Undecided
     Assignee: John Johansen (jjohansen)
         Status: Confirmed

** Also affects: linux (Ubuntu Trusty)
   Importance: Undecided
       Status: New

** Also affects: linux (Ubuntu Utopic)
   Importance: Undecided
     Assignee: John Johansen (jjohansen)
       Status: Confirmed

** Changed in: linux (Ubuntu Trusty)
       Status: New => Confirmed

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1323526

Title:
  apparmor spam log with warnings on Preempt kernels

Status in “linux” package in Ubuntu:
  Confirmed
Status in “linux” source package in Trusty:
  Confirmed
Status in “linux” source package in Utopic:
  Confirmed

Bug description:
      The apparmor/dbus support needs to allocate buffers in
      atomic context (i.e: holding a spinlock) since that is
      not possible, it declares a static per cpu array of
      buffers and has accessor macros to get and put buffers.
      
      Since the buffer array is a per cpu variable, it can
      only be concurrently accessed by the same cpu and this
      can only happen if the kernel is preempted.
      
      So the get_buffers() macro disables preemption with
      preempt_disable() so the buffer can be accessed safely.
      
      Grabbing a spinlock also makes the kernel to disable
      preemption so a raw __get_buffers() function can be used
      in this case that does not call preempt_disable().
      
      The raw __get_buffers() function was called from file_path_perm()
      since a spinlock was held by the calling revalidate_tty() function.
      
      But this is not the only place where file_path_perm() is called,
      it is also called by match_file() which is not in atomic context
      and thus doesn't disable preemption before so the __get_buffers()
      macro was complaining with a WARN_ON(preempt_count() <= 0) and
      spamming the console constantly.
      
      This patch fix the issue by always calling {get,put}_buffers() since
      preempt_{disable,enable}() functions are nestable.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1323526/+subscriptions


Follow ups

References