Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 1355722

Summary: when running the fcoeadm command it seg faults.
Product: Red Hat Enterprise Linux 7 Reporter: nikhil <nkshirsa>
Component: fcoe-utilsAssignee: Chris Leech <cleech>
Status: NEW --- QA Contact: guazhang <guazhang>
Severity: high Docs Contact:
Priority: unspecified    
Version: 7.2CC: cleech, guazhang, xhe
Target Milestone: rcFlags: nkshirsa: needinfo? (cleech)
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1420851    

Description nikhil 2016-07-12 10:47:55 UTC
Description of problem:

when running the fcoeadm command it seg faults. 

Here is the detailed report from abrt-cli:                                                              
                                                                                   
[root@hlxtil114a ~]# abrt-cli info --detailed /var/spool/abrt/ccpp-2016-           
07-08-08:03:09-228562                                                              
reason:         fcoeadm killed by SIGSEGV                                          
time:           Fri 08 Jul 2016 08:03:09 AM PDT                                    
cmdline:        fcoeadm -i                                                         
package:        fcoe-utils-1.0.30-3.git91c0c8c.el7                                 
uid:            0 (root)                                                           
count:          1                                                                  
Directory:      /var/spool/abrt/ccpp-2016-07-08-08:03:09-228562                    
abrt_version:   2.1.11                                                             
analyzer:       CCpp                                                               
architecture:   x86_64                                                             
comment:                                                                           
component:      fcoe-utils                                                         
event_log:                                                                         
executable:     /usr/sbin/fcoeadm                                                  
global_pid:     228562                                                             
hostname:       hlxtil114a                                                         
kernel:         3.10.0-327.10.1.el7.x86_64                                         
last_occurrence: 1467990189                                                        
os_release:     Red Hat Enterprise Linux Server release 7.2 (Maipo)                
pid:            228562                                                             
pkg_arch:       x86_64                                                             
pkg_epoch:      0                                                                  
pkg_name:       fcoe-utils                                                         
pkg_release:    3.git91c0c8c.el7                                                   
pkg_version:    1.0.30                                                             
pwd:            /root                                                              
runlevel:       N 3                                                                
type:           CCpp                                                               
username:       root                                                               
uuid:           71f5167dea1212f37d0538f47f729e542e684ddc                           
                                                                                   
coredump:       Binary file, 614400 bytes                                          
maps:           Text file, 8012 bytes                                              
                     
                                                                                   
core_backtrace:                                                                    
:{   "signal": 11                                                                  
:,   "executable": "/usr/sbin/fcoeadm"                                             
:,   "stacktrace":                                                                 
:      [ {   "crash_thread": true                                                  
:        ,   "frames":                                                             
:              [ {   "address": 140209109666145                                    
:                ,   "build_id":                                                   
"d164218e7a226d18497e39e2f3dabb49b40f35f6"                                         
:                ,   "build_id_offset": 1452385                                    
:                ,   "function_name": "__strlen_sse2_pminub"                       
:                ,   "file_name": "/lib64/libc.so.6"                               
:                }                                                                 
:              , {   "address": 140209106090688                                    
:                ,   "build_id":                                                   
"6da5376c8828daffd4e8f7d5a64e48ba2390ba5f"                                         
:                ,   "build_id_offset": 19136                                      
:                ,   "function_name": "sysfs_scan"                                 
:                ,   "file_name": "/usr/lib64/libhbalinux.so.2.0.2"                
:                }                                                                 
:              , {   "address": 140209106094323                                    
:                ,   "build_id":                                                   
"6da5376c8828daffd4e8f7d5a64e48ba2390ba5f"                                         
:                ,   "build_id_offset": 22771                                      
:                ,   "function_name": "adapter_init"                               
:                ,   "file_name": "/usr/lib64/libhbalinux.so.2.0.2"                
:                }                                                                 
:              , {   "address": 140209106089625                                    
:                ,   "build_id":                                                   
"6da5376c8828daffd4e8f7d5a64e48ba2390ba5f"                                         
:                ,   "build_id_offset": 18073                                      
:                ,   "function_name": "load_library"                               
:                ,   "file_name": "/usr/lib64/libhbalinux.so.2.0.2"                
:                }                                                                 
:              , {   "address": 140209114272990                                    
:                ,   "build_id":                                                   
"b60f295d8512fb91de4e84d8bbc05220e933d038"                                         
:                ,   "build_id_offset": 9438                                       
:                ,   "function_name": "HBA_LoadLibrary"                            
:                ,   "file_name": "/lib64/libHBAAPI.so.2"                          
:                }                                                                 
:              , {   "address": 140209118649535                                    
:                ,   "build_id":                                                   
"fd1c25991da40227e9bc8c3fd7d6f2eebe2f9b23"                                         
:                ,   "build_id_offset": 15551                                      
:                ,   "function_name": "display_adapter_info"                       
:                ,   "file_name": "/usr/sbin/fcoeadm"                              
:                }                                                                 
:              , {   "address": 140209118643835                                    
:                ,   "build_id":                                                   
"fd1c25991da40227e9bc8c3fd7d6f2eebe2f9b23"                                         
:                ,   "build_id_offset": 9851                                       
:                ,   "function_name": "main"                                       
:                ,   "file_name": "/usr/sbin/fcoeadm"                              
:                } ]                                                               
:        } ]                                                                       
:}                                                                                 
                                                                                   
dso_list:                                                                          
:/usr/lib64/libz.so.1.2.7 zlib-1.2.7-15.el7.x86_64 (Red Hat, Inc.)                 
1458571090                                                                         
:/usr/lib64/libgcc_s-4.8.5-20150702.so.1 libgcc-4.8.5-4.el7.x86_64 (Red            
Hat, Inc.) 1458571074                                                              
:/usr/lib64/libc-2.17.so glibc-2.17-106.el7_2.4.x86_64 (Red Hat, Inc.)             
1458652460                                                                         
:/usr/lib64/libpthread-2.17.so glibc-2.17-106.el7_2.4.x86_64 (Red Hat,             
Inc.) 1458652460                                                                   
:/usr/lib64/liblzma.so.5.0.99 xz-libs-5.1.2-12alpha.el7.x86_64 (Red                
Hat, Inc.) 1458571090                                                              
:/usr/lib64/libpciaccess.so.0.11.1 libpciaccess-0.13.4-2.el7.x86_64                
(Red Hat, Inc.) 1458571151                                                         
:/usr/lib64/ld-2.17.so glibc-2.17-106.el7_2.4.x86_64 (Red Hat, Inc.)               
1458652460                                                                         
:/usr/lib64/libudev.so.1.6.2 systemd-libs-219-19.el7_2.4.x86_64 (Red               
Hat, Inc.) 1458652465                                                              
:/usr/lib64/libbz2.so.1.0.6 bzip2-libs-1.0.6-13.el7.x86_64 (Red Hat,               
Inc.) 1458571091                                                                   
:/usr/lib64/librt-2.17.so glibc-2.17-106.el7_2.4.x86_64 (Red Hat, Inc.)            
1458652460                                                                         
:/usr/lib64/libdl-2.17.so glibc-2.17-106.el7_2.4.x86_64 (Red Hat, Inc.)            
1458652460                                                                         
:/usr/lib64/libHBAAPI.so.2.0.2 libhbaapi-2.2.9-6.el7.x86_64 (Red Hat,              
Inc.) 1458571102                                                                   
:/usr/lib64/libelf-0.163.so elfutils-libelf-0.163-3.el7.x86_64 (Red                
Hat, Inc.) 1458571091                                                              
:/usr/lib64/libdw-0.163.so elfutils-libs-0.163-3.el7.x86_64 (Red Hat,              
Inc.) 1458571093                                                                   
:/usr/sbin/fcoeadm fcoe-utils-1.0.30-3.git91c0c8c.el7.x86_64 (Red Hat,             
Inc.) 1458571177                                                                   
:/usr/lib64/libhbalinux.so.2.0.2 libhbalinux-1.0.17-2.el7.x86_64 (Red              
Hat, Inc.) 1458571164                                                              
:/usr/lib64/libcap.so.2.22 libcap-2.22-8.el7.x86_64 (Red Hat, Inc.)                
1458571092                                                                         
:/usr/lib64/libm-2.17.so glibc-2.17-106.el7_2.4.x86_64 (Red Hat, Inc.)             
1458652460                                                                         
:/usr/lib64/libattr.so.1.1.0 libattr-2.4.46-12.el7.x86_64 (Red Hat,                
Inc.) 1458571092                                                                   
                                                                                   
environ:                                                                           
:XDG_SESSION_ID=8079                                                               
:HOSTNAME=hlxtil114a                                                               
:TERM=xterm-256color                                                               
:SHELL=/bin/bash                                                                   
:HISTSIZE=1000                                                                     
:'SSH_CLIENT=130.10.204.82 57222 22'                                               
:SSH_TTY=/dev/pts/0                                                                
:USER=root                                                                         
:LS_COLORS=rs=0:di=38;5;27:ln=38;5;51:mh=44;38;5;15:pi=40;38;5;11:so=38;           
5;13:do=38;5;5:bd=48;5;232;38;5;11:cd=48;5;232;38;5;3:or=48;5;232;38;5;            
9:mi=05;48;5;232;38;5;15:su=48;5;196;38;5;15:sg=48;5;11;38;5;16:ca=48;5;           
196;38;5;226:tw=48;5;10;38;5;16:ow=48;5;10;38;5;21:st=48;5;21;38;5;15:             
ex=38;5;34:*.tar=38;5;9:*.tgz=38;5;9:*.arc=38;5;9:*.arj=38;5;9:*.taz=38;           
5;9:*.lha=38;5;9:*.lz4=38;5;9:*.lzh=38;5;9:*.lzma=38;5;9:*.tlz=38;5;9:*.           
txz=38;5;9:*.tzo=38;5;9:*.t7z=38;5;9:*.zip=38;5;9:*.z=38;5;9:*.Z=38;5;9:           
*.dz=38;5;9:*.gz=38;5;9:*.lrz=38;5;9:*.lz=38;5;9:*.lzo=38;5;9:*.xz=38;5;           
9:*.bz2=38;5;9:*.bz=38;5;9:*.tbz=38;5;9:*.tbz2=38;5;9:*.tz=38;5;9:*.               
deb=38;5;9:*.rpm=38;5;9:*.jar=38;5;9:*.war=38;5;9:*.ear=38;5;9:*.sar=38;           
5;9:*.rar=38;5;9:*.alz=38;5;9:*.ace=38;5;9:*.zoo=38;5;9:*.cpio=38;5;9:*.           
7z=38;5;9:*.rz=38;5;9:*.cab=38;5;9:*.jpg=38;5;13:*.jpeg=38;5;13:*.                 
gif=38;5;13:*.bmp=38;5;13:*.pbm=38;5;13:*.pgm=38;5;13:*.ppm=38;5;13:*.             
tga=38;5;13:*.xbm=38;5;13:*.xpm=38;5;13:*.tif=38;5;13:*.tiff=38;5;13:*.            
png=38;5;13:*.svg=38;5;13:*.svgz=38;5;13:*.mng=38;5;13:*.pcx=38;5;13:*.            
mov=38;5;13:*.mpg=38;5;13:*.mpeg=38;5;13:*.m2v=38;5;13:*.mkv=38;5;13:*.            
webm=38;5;13:*.ogm=38;5;13:*.mp4=38;5;13:*.m4v=38;5;13:*.mp4v=38;5;13:*.           
vob=38;5;13:*.qt=38;5;13:*.nuv=38;5;13:*.wmv=38;5;13:*.asf=38;5;13:*.              
rm=38;5;13:*.rmvb=38;5;13:*.flc=38;5;13:*.avi=38;5;13:*.fli=38;5;13:*.             
flv=38;5;13:*.gl=38;5;13:*.dl=38;5;13:*.xcf=38;5;13:*.xwd=38;5;13:*.               
yuv=38;5;13:*.cgm=38;5;13:*.emf=38;5;13:*.axv=38;5;13:*.anx=38;5;13:*.             
ogv=38;5;13:*.ogx=38;5;13:*.aac=38;5;45:*.au=38;5;45:*.flac=38;5;45:*.             
mid=38;5;45:*.midi=38;5;45:*.mka=38;5;45:*.mp3=38;5;45:*.mpc=38;5;45:*.            
ogg=38;5;45:*.ra=38;5;45:*.wav=38;5;45:*.axa=38;5;45:*.oga=38;5;45:*.              
spx=38;5;45:*.xspf=38;5;45:                                                        
:TMOUT=900                                                                         
:MAIL=/var/spool/mail/root                                                         
:PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin                  
:PWD=/root                                                                         
:LANG=en_US.utf8                                                                   
:HISTCONTROL=ignoredups                                                            
:SHLVL=1                                                                           
:HOME=/root                                                                        
:LOGNAME=root                                                                      
:'SSH_CONNECTION=130.10.204.82 57222 135.165.233.93 22'                            
:'LESSOPEN=||/usr/bin/lesspipe.sh %s'                                              
:XDG_RUNTIME_DIR=/run/user/0                                                       
:'HISTTIMEFORMAT=%D %R '                                                           
:_=/usr/sbin/fcoeadm                                                               
                                                                                   
exploitable:                                                                       
:Likely crash reason: Jump to an invalid address                                   
:Exploitable rating (0-9 scale): 6                                                 
                                                                                   
limits:                                                                            
:Limit                     Soft Limit           Hard Limit                         
Units                                                                              
:Max cpu time              unlimited            unlimited                          
seconds                                                                            
:Max file size             unlimited            unlimited                          
bytes                                                                              
:Max data size             unlimited            unlimited                          
bytes                                                                              
:Max stack size            8388608              unlimited                          
bytes                                                                              
:Max core file size        0                    unlimited                          
bytes                                                                              
:Max resident set          unlimited            unlimited                          
bytes                                                                              
:Max processes             2060662              2060662                            
processes                                                                          
:Max open files            1024                 4096                               
files                                                                              
:Max locked memory         65536                65536                              
bytes                                                                              
:Max address space         unlimited            unlimited                          
bytes                                                                              
:Max file locks            unlimited            unlimited                          
locks                                                                              
:Max pending signals       2060662              2060662                            
signals                                                                            
:Max msgqueue size         819200               819200                             
bytes                                                                              
:Max nice priority         0                    0                                  
:Max realtime priority     0                    0                                  
:Max realtime timeout      unlimited            unlimited                          
us                                                                                 
                                                                                   
machineid:                                                                         
:systemd=31ff0ec0803e467fb2ac5f6a0e5b915c                                          
:sosreport_uploader-                                                               
dmidecode=879a971357ee0d3b960517d4a4713dd44dab6fb6f4d479a61e52566760779d           
39                                                                                 
                                                                                   
open_fds:                                                                          
:0:/dev/pts/0                                                                      
:pos: 0                                                                            
:flags: 0100002                                                                    
:mnt_id: 23                                                                        
:1:/dev/pts/0                                                                      
:pos: 0                                                                            
:flags: 0100002                                                                    
:mnt_id: 23                                                                        
:2:/dev/pts/0                                                                      
:pos: 0                                                                            
:flags: 0100002                                                                    
:mnt_id: 23                                                                        
:3:/etc/hba.conf                                                                   
:pos: 871                                                                          
:flags: 0100000                                                                    
:mnt_id: 60                                                                        
                                                                                   
os_info:                                                                           
:NAME="Red Hat Enterprise Linux Server"                                            
:VERSION="7.2 (Maipo)"                                                             
:ID="rhel"                                                                         
:ID_LIKE="fedora"                                                                  
:VERSION_ID="7.2"                                                                  
:PRETTY_NAME="Red Hat Enterprise Linux Server 7.2 (Maipo)"                         
:ANSI_COLOR="0;31"                                                                 
:CPE_NAME="cpe:/o:redhat:enterprise_linux:7.2:GA:server"                           
:HOME_URL="https://www.redhat.com/"                                                
:BUG_REPORT_URL="https://bugzilla.redhat.com/"                                     
:                                                                                  
:REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"                              
:REDHAT_BUGZILLA_PRODUCT_VERSION=7.2                                               
:REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"                                 
:REDHAT_SUPPORT_PRODUCT_VERSION="7.2"                                              
                                                                                   
proc_pid_status:                                                                   
:Name: fcoeadm                                                                     
:State: S (sleeping)                                                               
:Tgid: 228562                                                                      
:Ngid: 0                                                                           
:Pid: 228562                                                                       
:PPid: 228523                                                                      
:TracerPid: 0                                                                      
:Uid: 0 0 0 0                                                                      
:Gid: 0 0 0 0                                                                      
:FDSize: 256                                                                       
:Groups: 0                                                                         
:VmPeak:    37292 kB                                                               
:VmSize:    37240 kB                                                               
:VmLck:        0 kB                                                                
:VmPin:        0 kB                                                                
:VmHWM:     1096 kB                                                                
:VmRSS:     1096 kB                                                                
:VmData:      200 kB                                                               
:VmStk:      136 kB                                                                
:VmExe:       40 kB                                                                
:VmLib:     3972 kB                                                                
:VmPTE:       92 kB                                                                
:VmSwap:        0 kB                                                               
:Threads: 1                                                                        
:SigQ: 1/2060662                                                                   
:SigPnd: 0000000000000000                                                          
:ShdPnd: 0000000000000000                                                          
:SigBlk: 0000000000000000                                                          
:SigIgn: 0000000000000000                                                          
:SigCgt: 0000000180000000                                                          
:CapInh: 0000000000000000                                                          
:CapPrm: 0000001fffffffff                                                          
:CapEff: 0000001fffffffff                                                          
:CapBnd: 0000001fffffffff                                                          
:Seccomp: 0                                                                        
:Cpus_allowed: ffffffff,ffffffff,ffffffff,ffffffff,ffffffff,ffffffff,              
ffffffff,ffffffff,ffffffff                                                         
:Cpus_allowed_list: 0-287                                                          
:Mems_allowed:                                                                     
00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,           
00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,           
00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,           
00000000,00000000,00000000,00000000,00000000,00000000,00000000,000000ff            
:Mems_allowed_list: 0-7                                                            
:voluntary_ctxt_switches: 25                                                       
:nonvoluntary_ctxt_switches: 1 

Version-Release number of selected component (if applicable):

fcoe-utils-1.0.30-3.git91c0c8c.el7.x86_64 



Additional info:

Installed same version of fcoe-utils debuginfo, and glibc same version, glibc-common, etc on rhel7u2-1.gsslab.pnq2.redhat.com)

[root@rhel7u2-1 ~]# gdb /usr/sbin/fcoeadm /tmp/01666186-coredump 
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-80.el7
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/sbin/fcoeadm...Reading symbols from /usr/lib/debug/usr/sbin/fcoeadm.debug...done.
done.
[New LWP 228562]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `fcoeadm -i'.
Program terminated with signal 11, Segmentation fault.
#0  0x00007f84fa2d0961 in __strlen_sse2_pminub () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install bzip2-libs-1.0.6-13.el7.x86_64 elfutils-libelf-0.163-3.el7.x86_64 elfutils-libs-0.163-3.el7.x86_64 glibc-2.17-106.el7_2.4.x86_64 libattr-2.4.46-12.el7.x86_64 libcap-2.22-8.el7.x86_64 libgcc-4.8.5-4.el7.x86_64 libhbaapi-2.2.9-6.el7.x86_64 libhbalinux-1.0.17-2.el7.x86_64 libpciaccess-0.13.4-2.el7.x86_64 systemd-libs-219-19.el7.x86_64 xz-libs-5.1.2-12alpha.el7.x86_64 zlib-1.2.7-15.el7.x86_64
(gdb) where
#0  0x00007f84fa2d0961 in __strlen_sse2_pminub () from /lib64/libc.so.6
#1  0x00007f84f9f67ac0 in sysfs_scan () from /usr/lib64/libhbalinux.so.2.0.2
#2  0x00007f84f9f688f3 in adapter_init () from /usr/lib64/libhbalinux.so.2.0.2
#3  0x00007f84f9f67699 in load_library () from /usr/lib64/libhbalinux.so.2.0.2
#4  0x00007f84fa7354de in HBA_LoadLibrary () from /lib64/libHBAAPI.so.2
#5  0x00007f84fab61cbf in fcoeadm_loadhba () at fcoeadm_display.c:1026
#6  display_adapter_info (ifname=ifname@entry=0x0) at fcoeadm_display.c:1239
#7  0x00007f84fab6067b in main (argc=2, argv=0x7fffd8600a78) at fcoeadm.c:325

(gdb) frame 5
#5  0x00007f84fab61cbf in fcoeadm_loadhba () at fcoeadm_display.c:1026
1026		if (HBA_STATUS_OK != HBA_LoadLibrary())

(gdb) l
1021		hba_table_list = NULL;
1022	}
1023	
1024	static enum fcoe_status fcoeadm_loadhba(void)
1025	{
1026		if (HBA_STATUS_OK != HBA_LoadLibrary())
1027			return EHBAAPIERR;
1028	
1029		return SUCCESS;
1030	}
(gdb) 


Installed the hba debuginfo's we see a better stack now with line numbers

[root@rhel7u2-1 ~]# rpm -qa|grep hba
libhbaapi-2.2.9-6.el7.x86_64
libhbaapi-debuginfo-2.2.9-6.el7.x86_64
libhbalinux-1.0.17-2.el7.x86_64
libhbalinux-debuginfo-1.0.17-2.el7.x86_64
[root@rhel7u2-1 ~]# gdb /usr/sbin/fcoeadm /tmp/01666186-coredump 
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-80.el7
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/sbin/fcoeadm...Reading symbols from /usr/lib/debug/usr/sbin/fcoeadm.debug...done.
done.
[New LWP 228562]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `fcoeadm -i'.
Program terminated with signal 11, Segmentation fault.
#0  0x00007f84fa2d0961 in __strlen_sse2_pminub () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install bzip2-libs-1.0.6-13.el7.x86_64 elfutils-libelf-0.163-3.el7.x86_64 elfutils-libs-0.163-3.el7.x86_64 glibc-2.17-106.el7_2.4.x86_64 libattr-2.4.46-12.el7.x86_64 libcap-2.22-8.el7.x86_64 libgcc-4.8.5-4.el7.x86_64 libpciaccess-0.13.4-2.el7.x86_64 systemd-libs-219-19.el7.x86_64 xz-libs-5.1.2-12alpha.el7.x86_64 zlib-1.2.7-15.el7.x86_64
(gdb) where
#0  0x00007f84fa2d0961 in __strlen_sse2_pminub () from /lib64/libc.so.6
#1  0x00007f84f9f67ac0 in sysfs_scan (fc_host=fc_host@entry=0x7f84fccb5a70) at lport.c:369
#2  0x00007f84f9f688f3 in adapter_init () at lport.c:662
#3  0x00007f84f9f67699 in load_library () at lib.c:61
#4  0x00007f84fa7354de in HBA_LoadLibrary () at hbaapilib.c:614
#5  0x00007f84fab61cbf in fcoeadm_loadhba () at fcoeadm_display.c:1026
#6  display_adapter_info (ifname=ifname@entry=0x0) at fcoeadm_display.c:1239
#7  0x00007f84fab6067b in main (argc=2, argv=0x7fffd8600a78) at fcoeadm.c:325
(gdb) frame 1
#1  0x00007f84f9f67ac0 in sysfs_scan (fc_host=fc_host@entry=0x7f84fccb5a70) at lport.c:369
369		sa_strncpy_safe(pap->PortSymbolicName, sizeof(pap->PortSymbolicName),
(gdb) l
364		/* pap points to the local port attributes structure */
365		pap = &pp->ap_attr;
366	
367		/* Get PortSymbolicName */
368		ptr = udev_device_get_sysattr_value(fc_host, "symbolic_name");
369		sa_strncpy_safe(pap->PortSymbolicName, sizeof(pap->PortSymbolicName),
370				ptr, strlen(ptr));
371	
372		/* Skip the HBA if it isn't OpenFC */
373		cp = strstr(pap->PortSymbolicName, " over ");
(gdb) p pap->PortSymbolicName
$1 = '\000' <repeats 255 times>
(gdb) p *ptr
Cannot access memory at address 0x0
(gdb) p ptr
$2 = 0x0
(gdb) 


So ptr is a null pointer, and we're trying to copy from it into pap->PortSymbolicName


(gdb) frame 1
#1  0x00007f84f9f67ac0 in sysfs_scan (fc_host=fc_host@entry=0x7f84fccb5a70) at lport.c:369
369		sa_strncpy_safe(pap->PortSymbolicName, sizeof(pap->PortSymbolicName),
(gdb) l
364		/* pap points to the local port attributes structure */
365		pap = &pp->ap_attr;
366	
367		/* Get PortSymbolicName */
368		ptr = udev_device_get_sysattr_value(fc_host, "symbolic_name");
369		sa_strncpy_safe(pap->PortSymbolicName, sizeof(pap->PortSymbolicName),
370				ptr, strlen(ptr));
371	
372		/* Skip the HBA if it isn't OpenFC */
373		cp = strstr(pap->PortSymbolicName, " over ");



Seems udev_device_get_sysattr_value() returns NULL and that NULL check isnt made before proceeding to sa_strncpy_safe() , so the call is made with the null pointer.


-nikhil.

Comment 1 nikhil 2016-07-12 10:52:21 UTC
udev_device_get_sysattr_value ()

const char *        udev_device_get_sysattr_value       (struct udev_device *udev_device,
                                                         const char *sysattr);
The retrieved value is cached in the device. Repeated calls will return the same value and not open the attribute again.

udev_device :

udev device
sysattr :

attribute name
Returns :

the content of a sys attribute file, or NULL if there is no sys attribute value.