Daniel Gryniewicz wrote on Wed, Aug 02, 2017 at 10:16:39AM -0400:
> fortify sources does not work for me. It fails during cmake. Basic system
> libraries (such as -pthread) do not link.
Hm. There is a "problem", that FORTIFY_SOURCE requires optimizations, so
I had to add -O2... which in turn adds new warnings (Wmaybe-uninitalized
and Wfree-nonheap-object)
A few warnings aside, this is ok for me:
cmake ../src/ -DCMAKE_C_FLAGS="-O2 -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector-strong --param=ssp-buffer-size=4"
The problem is I'm not sure how much O2 affects debugging, I'd rather
not impose it on everyone.
The couple of warnings I have are :
In file included from /export/ganesha/src/include/gsh_rpc.h:17:0,
from /export/ganesha/src/include/uid2grp.h:44,
from /export/ganesha/src/include/fsal_types.h:42,
from /export/ganesha/src/include/fsal_api.h:43,
from /export/ganesha/src/include/fsal.h:62,
from /export/ganesha/src/Protocols/NFS/nfs_proto_tools.c:34:
/export/ganesha/src/Protocols/NFS/nfs_proto_tools.c: In function
‘decode_supported_attrs’:
/export/ganesha/src/libntirpc/ntirpc/rpc/xdr_inline.h:215:7: error:
‘bits’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
l = (u_long) *u_int32_p;
^~~~~~~~~~~~~~~~~~~
/export/ganesha/src/Protocols/NFS/nfs_proto_tools.c:381:17: note: ‘bits’
was declared here
struct bitmap4 bits;
^~~~
/export/ganesha/src/FSAL/FSAL_PROXY/handle.c: In function ‘pxy_lookup_impl’:
/export/ganesha/src/FSAL/FSAL_PROXY/handle.c:1266:17: error:
‘atok_per_file_system_attr’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
GETATTR4resok *atok_per_file_system_attr;
^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /export/ganesha/src/include/gsh_rpc.h:17:0,
from /export/ganesha/src/include/uid2grp.h:44,
from /export/ganesha/src/include/fsal_types.h:42,
from /export/ganesha/src/include/fsal_api.h:43,
from /export/ganesha/src/include/fsal.h:62,
from /export/ganesha/src/include/export_mgr.h:42,
from /export/ganesha/src/include/nfs_exports.h:48,
from /export/ganesha/src/idmapper/idmapper.c:47:
In function ‘inline_xdr_bytes.constprop’,
inlined from ‘xdr_encode_nfs4_princ’ at
/export/ganesha/src/idmapper/idmapper.c:119:1 :
/export/ganesha/src/libntirpc/ntirpc/rpc/xdr_inline.h:609:4: error:
attempt to free a non-heap object ‘namebuf’
[-Werror=free-nonheap-object]
free(sp);
^~~~~~~~
These were on today's next.
Additionally with new ntirpc (Bill's pull up) I also get this one:
/export/nfs-ganesha/src/libntirpc/src/svc_vc.c: In function ‘svc_vc_recv’:
/export/nfs-ganesha/src/libntirpc/src/svc_vc.c:745:29: error: ‘flags’
may be used uninitialized in this function [-Werror=maybe-uninitialized]
if (xd->sx_fbtbc || (flags & UIO_FLAG_MORE)) {
~~~~~~~^~~~~~~~~~~~~~~~
I'm honestly not impressed with Wmaybe-uninitalized, on other projects
these mostly turned out to be false positive and we decided not to fix
(although it's usually easy to init at function start)
The free-nonheap-object is actually on spot though, if
xdr_encode_nfs4_princ is called with XDR_FREE as well.
Not sure if we do, I've always been blurry on xdr free path...
--
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/nfs-ganesha-devel