Bug 180164

Summary: [patch][regression] swapon segfault after r252310
Product: Base System Reporter: Fabian Keil <fk>
Component: binAssignee: Xin LI <delphij>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.txt none

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
changed.

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 freebsd_triage 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 freebsd_triage 2013-07-01 22:18:54 UTC
Responsible Changed
From-To: freebsd-bugs->delphij

Track.