Bug 180164 - [patch][regression] swapon segfault after r252310
Summary: [patch][regression] swapon segfault after r252310
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: Xin LI
Depends on:
Reported: 2013-07-01 13:10 UTC by Fabian Keil
Modified: 2013-07-01 22:20 UTC (History)
0 users

See Also:

file.txt (709 bytes, text/plain)
2013-07-01 13:10 UTC, Fabian Keil
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Fabian Keil 2013-07-01 13:10:00 UTC
The attached patch fixes a swapon segfault after r252310.

BTW, I was surprised that the meaning of my fstab entry:
/dev/ada0s1b.eli  none  swap  sw  0  0

It now enables authentication which reduces the available swap space.
If this change is kept, I think it might be worth an UPDATING entry.

Fix: Patch attached with submission follows:
How-To-Repeat: fk@r500 ~ $sudo gdb76 --args swapon /dev/ada0s1b.eli 
GNU gdb (GDB) 7.6 [GDB v7.6 for FreeBSD]
(gdb) r
Starting program: /sbin/swapon /dev/ada0s1b.eli

Program received signal SIGSEGV, Segmentation fault.
strlen (str=0x0) at /usr/src/lib/libc/string/strlen.c:100
100		va = (*lp - mask01);
(gdb) where
#0  strlen (str=0x0) at /usr/src/lib/libc/string/strlen.c:100
#1  0x0000000800ab1562 in strdup (str=0x0) at /usr/src/lib/libc/string/strdup.c:46
#2  0x0000000000402351 in swap_on_off_geli (mntops=0x0, name=0x7fffffffdb6d "/dev/ada0s1b.eli", doingall=<optimized out>) at /usr/src/sbin/swapon/swapon.c:339
#3  swap_on_off (name=0x7fffffffdb6d "/dev/ada0s1b.eli", doingall=0, mntops=0x0) at /usr/src/sbin/swapon/swapon.c:242
#4  0x000000000040205c in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/sbin/swapon/swapon.c:200
Comment 1 Xin LI freebsd_committer 2013-07-01 22:18:54 UTC
State Changed
From-To: open->closed

I believe I have fixed this with in the refactor done in 
r252388.  Please retest a newer -CURRENT version and let 
me know if the problem still persists. 

Comment 2 Xin LI freebsd_committer 2013-07-01 22:18:54 UTC
Responsible Changed
From-To: freebsd-bugs->delphij