Skip to content

Two bug fixes & misc code cleanup fixes

Daniel P. Berrange selinux 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest11 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11Remove jump over variable declarationlibselinux/src/seusers.c+2 -10 replies
2/11Ensure there is a prototype for 'matchpathcon_lib_destructor'libselinux/src/matchpathcon.c+2 -00 replies
3/11Fix old style function definitionslibselinux/src/selinux_config.c+26 -260 replies
4/11Fix const-correctnesslibselinux/include/selinux/selinux.h libselinux/src/get_default_type.c libselinux/src/init.c +1 more+6 -50 replies
5/11Remove unused flush_class_cache methodlibselinux/src/stringrep.c+0 -220 replies
6/11Add prototype decl for destructorlibselinux/src/setrans_client.c+2 -00 replies
7/11Add more printf format annotationslibselinux/include/selinux/avc.h libselinux/src/avc_internal.h+2 -20 replies
8/11Add printf format attribute annotation to die() methodlibselinux/utils/avcstat.c+2 -20 replies
9/11Fix const-ness of parameters & make usage() methods staticlibselinux/utils/getconlist.c libselinux/utils/getdefaultcon.c libselinux/utils/getsebool.c +5 more+9 -90 replies
10/11Enable many more gcc warnings for libselinux/src/ buildslibselinux/src/Makefile+21 -10 replies
11/11Enable many more gcc warnings for libselinux/utils buildslibselinux/utils/Makefile+19 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 00/11] Two bug fixes & misc code cleanup fixes

I was looking at the libselinux code and noticed that it did not use much more besides '-Wall' for its default compilation flags. As an experiment to see if there were any lurking bugs, I modified the Makefile for libselinux to add about 30 other GCC supported warnings. This patch series is the result. I found 2 real bugs, one potential use of unitialized variable in an OOM scenario, and the other a (benign) format string mistake that meant the user would not be told which flag was invalid.

At the same time I fixed const-correctness in several internal and public APIs, added more printf format validation annotations, removed old style function declarations & removed some dead code.

One warning item that I didn't tackle here is to reduce the maximum stack usage. With the -Wframe-larger-than flag I had to set the libselinux stack size to 32kb, which is getting very excessive IMHO. Most of the excessive stack usage is due to many PATH_MAX declarations, the remainders due to a couple of large structs placed on the stack. All of these are probably better off in the heap long term

Hopefully the first 9 patches are fairly easily accepted. I did not know what todo about the last 2 patches which actually add the extra CFLAGS warnings. In most projects I would have imported GNULIBs m4 macros for detecting support of compiler flags, but since none of the selinux libraries use autoconf, I don't see a good way/place to detect what compiler flags can be used.

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.