Revision 6d5b5acca9e566515ef3f1ed617e7295c4f94345 authored by Heiko Carstens on 09 March 2009, 12:31:59 UTC, committed by Linus Torvalds on 09 March 2009, 15:13:35 UTC
Frans Pop reported the crash below when running an s390 kernel under Hercules:

  Kernel BUG at 000738b4  verbose debug info unavailable!
  fixpoint divide exception: 0009  #1! SMP
  Modules linked in: nfs lockd nfs_acl sunrpc ctcm fsm tape_34xx
     cu3088 tape ccwgroup tape_class ext3 jbd mbcache dm_mirror dm_log dm_snapshot
     dm_mod dasd_eckd_mod dasd_mod
  CPU: 0 Not tainted 2.6.27.19 #13
  Process awk (pid: 2069, task: 0f9ed9b8, ksp: 0f4f7d18)
  Krnl PSW : 070c1000 800738b4 (acct_update_integrals+0x4c/0x118)
             R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:0 CC:1 PM:0
  Krnl GPRS: 00000000 000007d0 7fffffff fffff830
             00000000 ffffffff 00000002 0f9ed9b8
             00000000 00008ca0 00000000 0f9ed9b8
             0f9edda4 8007386e 0f4f7ec8 0f4f7e98
  Krnl Code: 800738aa: a71807d0         lhi     %r1,2000
             800738ae: 8c200001         srdl    %r2,1
             800738b2: 1d21             dr      %r2,%r1
            >800738b4: 5810d10e         l       %r1,270(%r13)
             800738b8: 1823             lr      %r2,%r3
             800738ba: 4130f060         la      %r3,96(%r15)
             800738be: 0de1             basr    %r14,%r1
             800738c0: 5800f060         l       %r0,96(%r15)
  Call Trace:
  ( <000000000004fdea>! blocking_notifier_call_chain+0x1e/0x2c)
    <0000000000038502>! do_exit+0x106/0x7c0
    <0000000000038c36>! do_group_exit+0x7a/0xb4
    <0000000000038c8e>! SyS_exit_group+0x1e/0x30
    <0000000000021c28>! sysc_do_restart+0x12/0x16
    <0000000077e7e924>! 0x77e7e924

Reason for this is that cpu time accounting usually only happens from
interrupt context, but acct_update_integrals gets also called from
process context with interrupts enabled.

So in acct_update_integrals we may end up with the following scenario:

Between reading tsk->stime/tsk->utime and tsk->acct_timexpd an interrupt
happens which updates accouting values.  This causes acct_timexpd to be
greater than the former stime + utime.  The subsequent calculation of

	dtime = cputime_sub(time, tsk->acct_timexpd);

will be negative and the division performed by

	cputime_to_jiffies(dtime)

will generate an exception since the result won't fit into a 32 bit
register.

In order to fix this just always disable interrupts while accessing any
of the accounting values.

Reported by: Frans Pop <elendil@planet.nl>
Tested by: Frans Pop <elendil@planet.nl>
Cc: stable@kernel.org
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 7a203f3
History
File Mode Size
Kconfig -rw-r--r-- 6.5 KB
Makefile -rw-r--r-- 1.3 KB
allocpercpu.c -rw-r--r-- 4.0 KB
backing-dev.c -rw-r--r-- 7.0 KB
bootmem.c -rw-r--r-- 17.8 KB
bounce.c -rw-r--r-- 6.5 KB
dmapool.c -rw-r--r-- 12.9 KB
fadvise.c -rw-r--r-- 3.3 KB
failslab.c -rw-r--r-- 1.3 KB
filemap.c -rw-r--r-- 65.0 KB
filemap_xip.c -rw-r--r-- 11.0 KB
fremap.c -rw-r--r-- 6.7 KB
highmem.c -rw-r--r-- 8.7 KB
hugetlb.c -rw-r--r-- 61.0 KB
internal.h -rw-r--r-- 7.9 KB
maccess.c -rw-r--r-- 1.4 KB
madvise.c -rw-r--r-- 9.5 KB
memcontrol.c -rw-r--r-- 56.9 KB
memory.c -rw-r--r-- 86.1 KB
memory_hotplug.c -rw-r--r-- 20.8 KB
mempolicy.c -rw-r--r-- 59.3 KB
mempool.c -rw-r--r-- 9.0 KB
migrate.c -rw-r--r-- 25.7 KB
mincore.c -rw-r--r-- 5.7 KB
mlock.c -rw-r--r-- 16.7 KB
mm_init.c -rw-r--r-- 3.7 KB
mmap.c -rw-r--r-- 64.3 KB
mmu_notifier.c -rw-r--r-- 8.2 KB
mmzone.c -rw-r--r-- 1.5 KB
mprotect.c -rw-r--r-- 7.6 KB
mremap.c -rw-r--r-- 11.1 KB
msync.c -rw-r--r-- 2.4 KB
nommu.c -rw-r--r-- 45.9 KB
oom_kill.c -rw-r--r-- 16.4 KB
page-writeback.c -rw-r--r-- 39.5 KB
page_alloc.c -rw-r--r-- 130.6 KB
page_cgroup.c -rw-r--r-- 10.6 KB
page_io.c -rw-r--r-- 3.5 KB
page_isolation.c -rw-r--r-- 3.6 KB
pagewalk.c -rw-r--r-- 3.2 KB
pdflush.c -rw-r--r-- 6.6 KB
prio_tree.c -rw-r--r-- 6.3 KB
quicklist.c -rw-r--r-- 2.4 KB
readahead.c -rw-r--r-- 13.4 KB
rmap.c -rw-r--r-- 34.2 KB
shmem.c -rw-r--r-- 68.0 KB
shmem_acl.c -rw-r--r-- 4.6 KB
slab.c -rw-r--r-- 115.1 KB
slob.c -rw-r--r-- 16.0 KB
slub.c -rw-r--r-- 105.9 KB
sparse-vmemmap.c -rw-r--r-- 4.2 KB
sparse.c -rw-r--r-- 16.2 KB
swap.c -rw-r--r-- 14.5 KB
swap_state.c -rw-r--r-- 10.1 KB
swapfile.c -rw-r--r-- 50.5 KB
thrash.c -rw-r--r-- 2.0 KB
truncate.c -rw-r--r-- 13.0 KB
util.c -rw-r--r-- 4.2 KB
vmalloc.c -rw-r--r-- 43.5 KB
vmscan.c -rw-r--r-- 72.6 KB
vmstat.c -rw-r--r-- 22.8 KB

back to top