Hi,

playing with clang once in a while as usual, there's a couple of neat
new warnings.

Here's one for CEPH:
/export/nfs-ganesha/src/FSAL/FSAL_CEPH/handle.c:1176:6: error: variable
'unix_mode' is used uninitialized whenever 'if' condition is false
      [-Werror,-Wsometimes-uninitialized]
        if (createmode != FSAL_NO_CREATE) {
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/export/nfs-ganesha/src/FSAL/FSAL_CEPH/handle.c:1203:5: note:
uninitialized use occurs here
                                unix_mode, posix_flags, &i, &fd, &stx,
                                ^~~~~~~~~
/export/nfs-ganesha/src/FSAL/FSAL_CEPH/handle.c:1176:2: note: remove the
'if' if its condition is always true
        if (createmode != FSAL_NO_CREATE) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/export/nfs-ganesha/src/FSAL/FSAL_CEPH/handle.c:984:18: note: initialize
the variable 'unix_mode' to silence this warning
        mode_t unix_mode;
                        ^
                         = 0
1 error generated.

Probably just want to set some initial value when declaring unix_mode a
few lines earlier, but I didn't take the few minutes required to check
what this is about and what default value would be sane.


--------------------

Others were easier to deal with, will submit a patch either later today
or early next week.


I'm also playing with ASAN (Address SANitizer) and ganesha has some
problems worth looking at :)
Configure with cmake -DCMAKE_CXX_COMPILER=clang
-DCMAKE_C_COMPILER=clang -DCMAKE_LINKER=clang
-DCMAKE_CXX_FLAGS="-fsanitize=address -fno-omit-frame-pointer"
-DCMAKE_C_FLAGS="-fsanitize=address -fno-omit-frame-pointer"



One example, haven't taken time to look at it yet (no more time today),
but will eventuallyâ„¢
=================================================================
==17668==ERROR: AddressSanitizer: attempting free on address which was not 
malloc()-ed: 0x7fffc00008c0 in thread T15
Detaching after fork from child process 17720.
    #0 0x4cf160 in __interceptor_cfree.localalias.1 
(/export/nfs-ganesha/build/MainNFSD/ganesha.nfsd+0x4cf160)
    #1 0x53c074 in gsh_free /export/nfs-ganesha/src/include/abstract_mem.h:273:2
    #2 0x53c04b in free_state 
/export/nfs-ganesha/src/FSAL/default_methods.c:587:2
    #3 0x8bd997 in mdcache_free_state 
/export/nfs-ganesha/src/FSAL/Stackable_FSALs/FSAL_MDCACHE/mdcache_export.c:763:2
    #4 0x6f8870 in free_fid 
/export/nfs-ganesha/src/Protocols/9P/9p_proto_tools.c:336:3
    #5 0x6fa273 in _9p_tools_clunk 
/export/nfs-ganesha/src/Protocols/9P/9p_proto_tools.c:440:2
    #6 0x6fee3c in _9p_clunk 
/export/nfs-ganesha/src/Protocols/9P/9p_clunk.c:72:7
    #7 0x6f5634 in _9p_process_buffer 
/export/nfs-ganesha/src/Protocols/9P/9p_interpreter.c:180:7
    #8 0x6f4dff in _9p_tcp_process_request 
/export/nfs-ganesha/src/Protocols/9P/9p_interpreter.c:132:7
    #9 0x5ac903 in _9p_execute 
/export/nfs-ganesha/src/MainNFSD/nfs_worker_thread.c:1471:3
    #10 0x59c0f2 in worker_run 
/export/nfs-ganesha/src/MainNFSD/nfs_worker_thread.c:1585:4
    #11 0x865524 in fridgethr_start_routine 
/export/nfs-ganesha/src/support/fridgethr.c:550:3
    #12 0x7ffff68035c9 in start_thread (/lib64/libpthread.so.0+0x75c9)
    #13 0x7ffff58eff6c in __clone (/lib64/libc.so.6+0x102f6c)

AddressSanitizer can not describe address in more detail (wild memory access 
suspected).
SUMMARY: AddressSanitizer: bad-free 
(/export/nfs-ganesha/build/MainNFSD/ganesha.nfsd+0x4cf160) in 
__interceptor_cfree.localalias.1
Thread T15 created by T0 here:
    #0 0x443b49 in __interceptor_pthread_create 
(/export/nfs-ganesha/build/MainNFSD/ganesha.nfsd+0x443b49)
    #1 0x864a2f in fridgethr_populate 
/export/nfs-ganesha/src/support/fridgethr.c:1418:8
    #2 0x59b73f in worker_init 
/export/nfs-ganesha/src/MainNFSD/nfs_worker_thread.c:1642:7
    #3 0x5cccac in nfs_Start_threads 
/export/nfs-ganesha/src/MainNFSD/nfs_init.c:457:7
    #4 0x5c93df in nfs_start /export/nfs-ganesha/src/MainNFSD/nfs_init.c:879:2
    #5 0x502171 in main /export/nfs-ganesha/src/MainNFSD/nfs_main.c:479:2
    #6 0x7ffff580d730 in __libc_start_main (/lib64/libc.so.6+0x20730)

==17668==ABORTING

If we can get this working reliably I'm thinking we could get the bot to
run with that, it should help detect subtle breakages more reliably.
(I'm also getting a crash on a free in FSAL_VFS/vfs/main.c's init config
I can't explain, segfaults on gsh_free(temp_name) which looks just fine
to me... Will try updating to a more recent clang, this one is a bit
ancient)


Cheers,
-- 
Dominique

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Nfs-ganesha-devel mailing list
Nfs-ganesha-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs-ganesha-devel

Reply via email to