bug: sleep in atomic context
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
AppArmor |
New
|
Undecided
|
Unassigned |
Bug Description
mutex_lock in app_new_
profile_
apparmor_
is with preempt disabled thus in atomic context. This as it is in between get_buffers and put_buffers in apparmor_
I am dubious about switching to spinlock to fix this issue. The aim of commit 4227c333f65cddc6c2 which switched this code to get_buffers was to limit failure and improve performance.
Cheers
Alban
nov. 14 14:09:09 cyclope audit[7152]: AVC apparmor="ALLOWED" operation="exec" profile=
nov. 14 14:09:09 cyclope kernel: BUG: sleeping function called from invalid context at kernel/
nov. 14 14:09:09 cyclope kernel: in_atomic(): 1, irqs_disabled(): 0, pid: 7152, name: sssd_be
nov. 14 14:09:09 cyclope kernel: 1 lock held by sssd_be/7152:
nov. 14 14:09:09 cyclope kernel: #0: (&sig->
nov. 14 14:09:09 cyclope kernel: CPU: 3 PID: 7152 Comm: sssd_be Not tainted 4.14.0prahal+intel #150
nov. 14 14:09:09 cyclope kernel: Hardware name: LENOVO 20CDCTO1WW/
nov. 14 14:09:09 cyclope kernel: Call Trace:
nov. 14 14:09:09 cyclope kernel: dump_stack+
nov. 14 14:09:09 cyclope kernel: ? _atomic_
nov. 14 14:09:09 cyclope kernel: ? lockdep_
nov. 14 14:09:09 cyclope kernel: ___might_
nov. 14 14:09:09 cyclope kernel: ? rq_clock+0xf0/0xf0
nov. 14 14:09:09 cyclope kernel: ? __kernel_
nov. 14 14:09:09 cyclope kernel: __might_
nov. 14 14:09:09 cyclope kernel: ? aa_new_
nov. 14 14:09:09 cyclope kernel: __mutex_
nov. 14 14:09:09 cyclope kernel: ? aa_new_
nov. 14 14:09:09 cyclope kernel: ? save_stack+
nov. 14 14:09:09 cyclope kernel: ? kmem_cache_
nov. 14 14:09:09 cyclope kernel: ? mutex_lock_
nov. 14 14:09:09 cyclope kernel: ? profile_
nov. 14 14:09:09 cyclope kernel: ? apparmor_
nov. 14 14:09:09 cyclope kernel: ? security_
nov. 14 14:09:09 cyclope kernel: ? prepare_
nov. 14 14:09:09 cyclope kernel: ? do_execveat_
nov. 14 14:09:09 cyclope kernel: ? SyS_execve+
nov. 14 14:09:09 cyclope kernel: ? do_syscall_
nov. 14 14:09:09 cyclope kernel: ? entry_SYSCALL64
nov. 14 14:09:09 cyclope kernel: ? deactivate_
nov. 14 14:09:09 cyclope kernel: ? save_stack_
nov. 14 14:09:09 cyclope kernel: ? init_object+
nov. 14 14:09:09 cyclope kernel: ? ___slab_
nov. 14 14:09:09 cyclope kernel: ? ___slab_
nov. 14 14:09:09 cyclope kernel: ? aa_alloc_
nov. 14 14:09:09 cyclope kernel: ? lock_downgrade+
nov. 14 14:09:09 cyclope kernel: ? memcg_kmem_
nov. 14 14:09:09 cyclope kernel: ? kasan_unpoison_
nov. 14 14:09:09 cyclope kernel: ? kasan_unpoison_
nov. 14 14:09:09 cyclope kernel: ? kasan_kmalloc+
nov. 14 14:09:09 cyclope kernel: ? aa_alloc_
nov. 14 14:09:09 cyclope kernel: ? kmem_cache_
nov. 14 14:09:09 cyclope kernel: ? aa_alloc_
nov. 14 14:09:09 cyclope kernel: ? aa_alloc_
nov. 14 14:09:09 cyclope kernel: ? _raw_spin_
nov. 14 14:09:09 cyclope kernel: ? vec_find+0xa0/0xa0
nov. 14 14:09:09 cyclope kernel: ? aa_label_
nov. 14 14:09:09 cyclope kernel: ? __label_
nov. 14 14:09:09 cyclope kernel: ? kmem_cache_
nov. 14 14:09:09 cyclope kernel: ? aa_alloc_
nov. 14 14:09:09 cyclope kernel: mutex_lock_
nov. 14 14:09:09 cyclope kernel: ? mutex_lock_
nov. 14 14:09:09 cyclope kernel: aa_new_
nov. 14 14:09:09 cyclope kernel: ? aa_fqlookupn_
nov. 14 14:09:09 cyclope kernel: ? aa_compute_
nov. 14 14:09:09 cyclope kernel: ? disconnect.
nov. 14 14:09:09 cyclope kernel: ? aa_str_
nov. 14 14:09:09 cyclope kernel: profile_
nov. 14 14:09:09 cyclope kernel: ? up_read+0x1a/0x40
nov. 14 14:09:09 cyclope kernel: ? ext4_xattr_
nov. 14 14:09:09 cyclope kernel: ? x_table_
nov. 14 14:09:09 cyclope kernel: ? ext4_xattr_
nov. 14 14:09:09 cyclope kernel: ? sched_clock+
nov. 14 14:09:09 cyclope kernel: ? sched_clock+
nov. 14 14:09:09 cyclope kernel: ? ext4_xattr_
nov. 14 14:09:09 cyclope kernel: ? __vfs_getxattr+
nov. 14 14:09:09 cyclope kernel: ? get_vfs_
nov. 14 14:09:09 cyclope kernel: ? sched_clock+
nov. 14 14:09:09 cyclope kernel: ? sched_clock+
nov. 14 14:09:09 cyclope kernel: ? tsc_resume+
nov. 14 14:09:09 cyclope kernel: ? get_vfs_
nov. 14 14:09:09 cyclope kernel: ? native_
nov. 14 14:09:09 cyclope kernel: ? sched_clock+
nov. 14 14:09:09 cyclope kernel: ? sched_clock_
nov. 14 14:09:09 cyclope kernel: ? find_held_
nov. 14 14:09:09 cyclope kernel: ? rb_insert_
nov. 14 14:09:09 cyclope kernel: apparmor_
nov. 14 14:09:09 cyclope kernel: ? sched_clock+
nov. 14 14:09:09 cyclope kernel: ? handle_
nov. 14 14:09:09 cyclope kernel: ? tsc_resume+
nov. 14 14:09:09 cyclope kernel: ? graph_lock+
nov. 14 14:09:09 cyclope kernel: ? tsc_resume+
nov. 14 14:09:09 cyclope kernel: ? sched_clock_
nov. 14 14:09:09 cyclope kernel: ? sched_clock+
nov. 14 14:09:09 cyclope kernel: ? sched_clock+
nov. 14 14:09:09 cyclope kernel: ? sched_clock_
nov. 14 14:09:09 cyclope kernel: ? find_held_
nov. 14 14:09:09 cyclope kernel: security_
nov. 14 14:09:09 cyclope kernel: prepare_
nov. 14 14:09:09 cyclope kernel: ? install_
nov. 14 14:09:09 cyclope kernel: ? __might_
nov. 14 14:09:09 cyclope kernel: ? up_read+0x40/0x40
nov. 14 14:09:09 cyclope kernel: ? get_user_
nov. 14 14:09:09 cyclope kernel: ? count.isra.
nov. 14 14:09:09 cyclope kernel: do_execveat_
nov. 14 14:09:09 cyclope kernel: ? prepare_
nov. 14 14:09:09 cyclope kernel: ? _raw_spin_
nov. 14 14:09:09 cyclope kernel: ? deactivate_
nov. 14 14:09:09 cyclope kernel: ? save_stack_
nov. 14 14:09:09 cyclope kernel: ? init_object+
nov. 14 14:09:09 cyclope kernel: ? ___slab_
nov. 14 14:09:09 cyclope kernel: ? ___slab_
nov. 14 14:09:09 cyclope kernel: ? kasan_check_
nov. 14 14:09:09 cyclope kernel: ? memcg_kmem_
nov. 14 14:09:09 cyclope kernel: ? kasan_unpoison_
nov. 14 14:09:09 cyclope kernel: ? glob_match+
nov. 14 14:09:09 cyclope kernel: ? kmem_cache_
nov. 14 14:09:09 cyclope kernel: ? getname_
nov. 14 14:09:09 cyclope kernel: ? mm_fault_
nov. 14 14:09:09 cyclope kernel: ? getname_
nov. 14 14:09:09 cyclope kernel: ? ptregs_
nov. 14 14:09:09 cyclope kernel: SyS_execve+
nov. 14 14:09:09 cyclope kernel: do_syscall_
nov. 14 14:09:09 cyclope kernel: ? syscall_
nov. 14 14:09:09 cyclope kernel: ? syscall_
nov. 14 14:09:09 cyclope kernel: ? prepare_
nov. 14 14:09:09 cyclope kernel: ? prepare_
nov. 14 14:09:09 cyclope kernel: ? perf_trace_
nov. 14 14:09:09 cyclope kernel: ? __put_user_
nov. 14 14:09:09 cyclope kernel: entry_SYSCALL64
nov. 14 14:09:09 cyclope kernel: RIP: 0033:0x7f9320f23637
nov. 14 14:09:09 cyclope kernel: RSP: 002b:00007fff78
nov. 14 14:09:09 cyclope kernel: RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f9320f23637
nov. 14 14:09:09 cyclope kernel: RDX: 0000558c35002a70 RSI: 0000558c3505bd10 RDI: 0000558c35018b90
nov. 14 14:09:09 cyclope kernel: RBP: 0000558c34b63ae8 R08: 0000558c3505bd10 R09: 0000000000000080
nov. 14 14:09:09 cyclope kernel: R10: 0000000000000095 R11: 0000000000000202 R12: 0000000000000001
nov. 14 14:09:09 cyclope kernel: R13: 0000558c35018b90 R14: 0000558c3505bd18 R15: 0000558c3505bd10
Hi Alban, nice find, thanks for reporting this bug to us.