Bugzilla – Bug 557302
AppArmor causes BUG: scheduling while atomic and exited with preempt_count messages
Last modified: 2010-01-26 13:16:24 UTC
A missing put_cpu_var in an error path causes AppArmor to leave a process's preempt_count value incorrectly incremented. This will cause messages like BUG: scheduling while atomic: process/pid/flags .. followed by a stack trace. Ultimately the following message will be seen: note: process[pid] exited with preempt_count 1
Created attachment 328730 [details] AppArmor: Fix cap audit_caching preemption disabling The auditing code of capabilities, has a simple cache to reduce capability messages flooding the audit logs. Checking and updating the cache disables kernel preemption. One potential exit path does not properly put the per cpu var, thus not reenabling preemption.
This patch was included in the 11.2 repo as commit b5dda4b1.
*** Bug 555653 has been marked as a duplicate of this bug. ***
*** Bug 557532 has been marked as a duplicate of this bug. ***
*** Bug 544181 has been marked as a duplicate of this bug. ***
*** Bug 564084 has been marked as a duplicate of this bug. ***
Unsure whether this is actually fixed: In kernel "2.6.31.8-0.1-desktop" (built after the last comment) I saw the message during boot _before_ the audit system was set up: klogd 1.4.1, log source = ksyslog started. <5>[ 0.000000] Linux version 2.6.31.8-0.1-desktop (geeko@buildhost) (gcc vers ion 4.4.1 [gcc-4_4-branch revision 150839] (SUSE Linux) ) #1 SMP PREEMPT 2009-12 -15 23:55:40 +0100 [...] <6>[ 0.006378] using C1E aware idle routine <6>[ 0.006383] Performance Counters: AMD PMU driver. <6>[ 0.006388] ... version: 0 <6>[ 0.006391] ... bit width: 48 <6>[ 0.006393] ... generic counters: 4 <6>[ 0.006396] ... value mask: 0000ffffffffffff <6>[ 0.006400] ... max period: 00007fffffffffff <6>[ 0.006403] ... fixed-purpose counters: 0 <6>[ 0.006406] ... counter mask: 000000000000000f <6>[ 0.006411] Checking 'hlt' instruction... OK. <6>[ 0.010745] Unpacking initramfs... <3>[ 0.018131] BUG: scheduling while atomic: swapper/0/0x10000002 <4>[ 0.018138] Modules linked in: <4>[ 0.018143] Pid: 0, comm: swapper Not tainted 2.6.31.8-0.1-desktop #1 <4>[ 0.018147] Call Trace: <4>[ 0.018159] [<c020845a>] try_stack_unwind+0x17a/0x1a0 <4>[ 0.018166] [<c020708c>] dump_trace+0x6c/0x130 <4>[ 0.018172] [<c0208008>] show_trace_log_lvl+0x58/0x80 <4>[ 0.018178] [<c0208056>] show_trace+0x26/0x40 <4>[ 0.018184] [<c0692e53>] dump_stack+0x79/0x91 <4>[ 0.018190] [<c023f137>] __schedule_bug+0x87/0x90 <4>[ 0.018196] [<c0693b88>] schedule+0x688/0x7a0 <4>[ 0.018201] [<c02480eb>] __cond_resched+0x2b/0x60 <4>[ 0.018206] [<c0693dfd>] _cond_resched+0x3d/0x50 <4>[ 0.018212] [<c02d3adc>] generic_perform_write+0x13c/0x1e0 <4>[ 0.018218] [<c02d3bfb>] generic_file_buffered_write+0x7b/0x150 <4>[ 0.018224] [<c02d55c3>] __generic_file_aio_write_nolock+0x213/0x530 <4>[ 0.018229] [<c02d5a15>] generic_file_aio_write+0x65/0xe0 <4>[ 0.018235] [<c031538c>] do_sync_write+0xdc/0x130 <4>[ 0.018240] [<c03156ba>] vfs_write+0xba/0x1b0 <4>[ 0.018245] [<c03160c3>] sys_write+0x53/0xa0 <4>[ 0.018250] [<c0981627>] do_copy+0xa1/0xe6 <4>[ 0.018255] [<c0980f6b>] flush_buffer+0x81/0xb8 <4>[ 0.018261] [<c09a770d>] gunzip+0x374/0x428 <4>[ 0.018266] [<c098147b>] unpack_to_rootfs+0x29f/0x3aa <4>[ 0.018272] [<c0981ef9>] populate_rootfs+0x59/0x87 <4>[ 0.018277] [<c097fcd3>] start_kernel+0x38d/0x3ae <4>[ 0.018282] [<c097f087>] i386_start_kernel+0x87/0x9f <3>[ 0.027082] BUG: scheduling while atomic: swapper/0/0x10000002 <4>[ 0.027089] Modules linked in: <4>[ 0.027093] Pid: 0, comm: swapper Not tainted 2.6.31.8-0.1-desktop #1 [...]