Description of problem: Running mkswap -p 1024 swap.file Causes Abortion on a swap.file of size 2 GigaBytes. Version-Release number of selected component (if applicable): util-linux-ng-2.17.2-5.fc13.i686 How reproducible: 100% Steps to Reproduce: 1. dd if=/dev/zero of=swap.file bs=1024 count=2000000 2. mkswap -p 1024 swap.file 3. Actual results: Expected results: Additional info: [root@localhost swap]# dd if=/dev/zero of=swap.file bs=1024 count=2000000 2000000+0 records in 2000000+0 records out 2048000000 bytes (2.0 GB) copied, 39.8615 s, 51.4 MB/s [root@localhost swap]# mkswap -p 1024 swap.file Using user-specified page size 1024, instead of the system value 4096 mkswap: swap.file: warning: don't erase bootbits sectors on whole disk. Use -f to force. Setting up swapspace version 1, size = 1999999 KiB no label, UUID=285062a6-be05-4118-8bc7-aa2e1ac7302d *** glibc detected *** mkswap: free(): invalid next size (normal): 0x085e2ce0 *** ======= Backtrace: ========= /lib/libc.so.6(+0x6f1a1)[0xeb01a1] /lib/libselinux.so.1(is_selinux_enabled+0x145)[0xc890c5] mkswap[0x8049e5a] /lib/libc.so.6(__libc_start_main+0xe6)[0xe57cc6] mkswap[0x80490c1] ======= Memory map: ======== 002c9000-002cc000 r-xp 00000000 08:02 6053934 /lib/libdl-2.12.so 002cc000-002cd000 r--p 00002000 08:02 6053934 /lib/libdl-2.12.so 002cd000-002ce000 rw-p 00003000 08:02 6053934 /lib/libdl-2.12.so 002ff000-0031e000 r-xp 00000000 08:02 6054027 /lib/libblkid.so.1.1.0 0031e000-00320000 rw-p 0001f000 08:02 6054027 /lib/libblkid.so.1.1.0 003ad000-003ca000 r-xp 00000000 08:02 6053890 /lib/libgcc_s-4.4.4-20100503.so.1 003ca000-003cb000 rw-p 0001d000 08:02 6053890 /lib/libgcc_s-4.4.4-20100503.so.1 0056e000-0056f000 r-xp 00000000 00:00 0 [vdso] 006f2000-006f6000 r-xp 00000000 08:02 6054014 /lib/libuuid.so.1.3.0 006f6000-006f7000 rw-p 00003000 08:02 6054014 /lib/libuuid.so.1.3.0 00ad5000-00af3000 r-xp 00000000 08:02 6053921 /lib/ld-2.12.so 00af3000-00af4000 r--p 0001d000 08:02 6053921 /lib/ld-2.12.so 00af4000-00af5000 rw-p 0001e000 08:02 6053921 /lib/ld-2.12.so 00c7f000-00c9b000 r-xp 00000000 08:02 6053985 /lib/libselinux.so.1 00c9b000-00c9c000 r--p 0001b000 08:02 6053985 /lib/libselinux.so.1 00c9c000-00c9d000 rw-p 0001c000 08:02 6053985 /lib/libselinux.so.1 00e41000-00fc6000 r-xp 00000000 08:02 6053928 /lib/libc-2.12.so 00fc6000-00fc7000 ---p 00185000 08:02 6053928 /lib/libc-2.12.so 00fc7000-00fc9000 r--p 00185000 08:02 6053928 /lib/libc-2.12.so 00fc9000-00fca000 rw-p 00187000 08:02 6053928 /lib/libc-2.12.so 00fca000-00fcd000 rw-p 00000000 00:00 0 08048000-0804c000 r-xp 00000000 08:02 1720429 /sbin/mkswap 0804c000-0804d000 rw-p 00003000 08:02 1720429 /sbin/mkswap 085e1000-08602000 rw-p 00000000 00:00 0 [heap] b769c000-b789c000 r--p 00000000 08:02 8069670 /usr/lib/locale/locale-archive b789c000-b789e000 rw-p 00000000 00:00 0 b78a5000-b78a8000 rw-p 00000000 00:00 0 bfea1000-bfeb6000 rw-p 00000000 00:00 0 [stack] Aborted [root@localhost swap]#
It probably shouldn't crash when invoked in this manner, but the native page size on x86 and x86_64 hardware is 4kB, so forcing the page size of the swap file to something smaller than that doesn't make any sense whatsoever.
I agree if the native page size is meant to be used with mkswap, then it should not even have an option to specify it. So, this is a confusing aspect of the ability to even specify it at all. In any event it shouldn't crash that I agree..
Fixed in upstream tree, commit 630161f2715af033667a1398c9f1d2b87eaf61f9. The bugfix will be available in Fedora-14. Thanks.