Re: errors/oopses when turning off a swap file

Michel Kaempf (maxx@via.ecp.fr)
Sat, 29 May 1999 02:59:36 +0200


I discovered a similar and repeatably problem. It occurs when using
swapfiles with the `swapon' and `swapoff' command.

[1.] One line summary of the problem :
--------------------------------------
Oops/Segfault while running `swapon'

[2.] Full description of the problem/report :
---------------------------------------------
I was creating a swapfile when the command `swapon' crashed
(segfault+oops). I managed to recreate this oops on kernel 2.2.4 and
2.2.9, on scsi and non-scsi i386 singleprocessor machines, on a
multiprocessor pentium machine and on a linux-ppc machine. Here is
the guilty commands sequence and its output (on my i686 (kernel 2.2.4)
machine) :

# cd /usr/local

# dd if=/dev/zero of=swap bs=1024 count=1024
1024+0 enregistrements lus.
1024+0 enregistrements écrits.

# mkswap swap
Setting up swapspace version 0, size = 1044480 bytes

# free
total used free shared buffers cached
Mem: 128192 16816 111376 13304 2688 7400
-/+ buffers/cache: 6728 121464
Swap: 128516 0 128516

# swapon swap
swapon: warning: swap has insecure permissions 0664, 0600 suggested

# free
total used free shared buffers cached
Mem: 128192 16836 111356 13328 2688 7400
-/+ buffers/cache: 6748 121444
Swap: 129536 0 129536

# swapon swap
swapon: warning: swap has insecure permissions 0664, 0600 suggested
swapon: swap: Périphérique ou ressource occupé
zsh: 210 exit 255 swapon swap

# swapoff swap

# free
total used free shared buffers cached
Mem: 128192 16904 111288 13328 2692 7464
-/+ buffers/cache: 6748 121444
Swap: 128516 0 128516

# swapon swap
swapon: warning: swap has insecure permissions 0664, 0600 suggested
Unable to handle kernel NULL pointer dereference at virtual address 00000008
current->tss.cr3 = 07383000, %cr3 = 07383000
*pde = 00000000
Oops: 0000
CPU: 0
EIP: 0010:[<c0120b1d>]
EFLAGS: 00010202
eax: 00000000 ebx: c02191d4 ecx: fffffffe edx: 00000002
esi: fffffff0 edi: c72e2bb0 ebp: 00000001 esp: c7369f1c
ds: 0018 es: 0018 ss: 0018
Process swapon (pid: 214, process nr: 37, stackpage=c7369000)
Stack: 08048eb2 bffff9f3 00000000 c7381314 00000000 000000a9 0c7feb32 c02180e0
c7feb320 c7165080 c02191d4 00000003 00000003 00001025 c7369f68 00000000
00001000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Call Trace: [<c0109584>]
Code: 3b 78 08 0f 84 22 04 00 00 42 3b 54 24 34 72 df 31 d2 b8 13
zsh: 214 segmentation fault swapon swap

# free
total used free shared buffers cached
Mem: 128192 16844 111348 12952 2692 7464
-/+ buffers/cache: 6688 121504
Swap: 128516 0 128516

# cat /proc/swaps
Unable to handle kernel NULL pointer dereference at virtual address 00000000
current->tss.cr3 = 07da8000, %cr3 = 07da8000
*pde = 00000000
Oops: 0000
CPU: 0
EIP: 0010:[<c012082a>]
EFLAGS: 00010246
eax: 00000000 ebx: 00000080 ecx: 00000000 edx: 00000000
esi: c7a37000 edi: 00000000 ebp: c02191d4 esp: c7369f3c
ds: 0018 es: 0018 ss: 0018
Process cat (pid: 216, process nr: 37, stackpage=c7369000)
Stack: c01e5460 00000c00 00000001 00000001 c7a37000 c01478c6 c7e82000 c0147aee
c7e82000 0000001d c7369f98 00000000 00000c00 c74ad4e0 ffffffea 00000000
00001000 00000000 00001008 c7368000 c010e872 c7368000 c7e82000 00000000
Call Trace: [<c01478c6>] [<c0147aee>] [<c010e872>] [<c012221a>] [<c0109584>]
Code: 66 8b 04 57 85 c0 74 08 3d 00 80 00 00 74 01 41 42 3b 54 24
zsh: 216 segmentation fault cat /proc/swaps

[4.] Kernel version (from /proc/version) :
------------------------------------------
The previous sequence was obtained with the following kernel :

Linux version 2.2.4 (root@julie) (gcc version egcs-2.91.63 19990224 (egcs-1.1.2 pre-release-3)) #1 jeu mar 25 15:51:08 CET 1999

[5.] Output of Oops.. message :
-------------------------------
Here is the Oops message on the same machine, kernel 2.2.9 this time :

Unable to handle kernel NULL pointer dereference at virtual address 00000008
current->tss.cr3 = 07312000, %cr3 = 07312000
*pde = 00000000
Oops: 0000
CPU: 0
EIP: 0010:[<c0122a6d>]
EFLAGS: 00010202
eax: 00000000 ebx: c01e04b4 ecx: fffffffe edx: 00000002
esi: fffffff0 edi: c6e23cb0 ebp: 00000001 esp: c72fdf1c
ds: 0018 es: 0018 ss: 0018
Process swapon (pid: 312, process nr: 37, stackpage=c72fd000)
Stack: 0804912c ffffffff 00000000 c7310318 00000000 000000aa 0c000f10 c01e0348
c000f100 c71fac80 c01e04b4 00000003 00000003 00007025 c72fdf68 00000000
00001000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Call Trace: [<c0109b84>]
Code: 3b 78 08 0f 84 22 04 00 00 42 3b 54 24 34 72 df 31 d2 b8 13

And the symbolic information resolved (still kernel 2.2.9) :

>>EIP: c0122a6d <__get_free_pages+15f9/2784>
Trace: c0109b84 <dump_thread+126c/23c8>
Code: c0122a6d <__get_free_pages+15f9/2784> 00000000 <_EIP>: <===
Code: c0122a6d <__get_free_pages+15f9/2784> 0: 3b 78 08 cmpl 0x8(%eax),%edi <===
Code: c0122a70 <__get_free_pages+15fc/2784> 3: 0f 84 22 04 00 00 je c0122e98 <__get_free_pages+1a24/2784>
Code: c0122a76 <__get_free_pages+1602/2784> 9: 42 incl %edx
Code: c0122a77 <__get_free_pages+1603/2784> a: 3b 54 24 34 cmpl 0x34(%esp,1),%edx
Code: c0122a7b <__get_free_pages+1607/2784> e: 72 df jb c0122a5c <__get_free_pages+15e8/2784>
Code: c0122a7d <__get_free_pages+1609/2784> 10: 31 d2 xorl %edx,%edx
Code: c0122a7f <__get_free_pages+160b/2784> 12: b8 13 00 00 00 movl $0x13,%eax
3 warnings and 1 error issued. Results may not be reliable.

[6.] A small shell script or example program which triggers the problem :
-------------------------------------------------------------------------
#! /bin/sh

cd /usr/local
dd if=/dev/zero of=swap bs=1024 count=1024
mkswap swap
swapon swap
swapon swap
swapoff swap
swapon swap

(and after this `cat /proc/swaps' produces an oops too)

[7.] Environment
----------------
[7.1.] Software

Linux julie 2.2.4 #1 jeu mar 25 15:51:08 CET 1999 i686 unknown
Kernel modules 2.1.121
Gnu C egcs-2.91.66
Binutils 2.9.1.0.24
Linux C Library 2.1.1
Dynamic linker ldd (GNU libc) 2.1.1
Procps 2.0.2
Mount 2.9r
Net-tools 2.01
Kbd 0.96
Sh-utils 1.16

[7.2.] Processor information

processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 6
model name : Celeron (Mendocino)
stepping : 0
cpu MHz : 451.032777
cache size : 128 KB
fdiv_bug : no
hlt_bug : no
sep_bug : no
f00f_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 2
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca cmov pat pse36 mmx osfxsr
bogomips : 450.56

-- 
Michel "MaXX" Kaempf

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/