LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 05-15-2014, 09:12 AM   #1
Gullible Jones
Member
 
Registered: Apr 2011
Posts: 142

Rep: Reputation: 10
Finding client-side vulnerabilities at compile time with GCC


To what extent can GCC detect possibly vulnerable conditions when compiling C and C++ applications? And if I want to take full advantage of such capabilities, what GCC options should I use?

The obvious one is -Werror, but in particular I'm wondering what categories of extended warning options it should be used in combination with. e.g. a lot of stuff won't compile with -Wpedantic -Werror, because POSIX violates the "pedantic" rules.

Failing that, are there other tools for checking code for vulnerable conditions that GCC may miss, *before* said code is compiled? In particular, are there tools to help vet preprocessor macros?

Edit: please disregard, I just discovered splint and cppcheck.

Edit 2: though the above should probably be considered complementary rather than replacing compiler warnings. In any case, -Wall -Werror seems to catch a lot of stuff in most programs, and you can just exclude stuff with -Wno-[whatever] if you absolutely must.

Last edited by Gullible Jones; 05-15-2014 at 04:24 PM.
 
Old 05-15-2014, 10:04 PM   #2
padeen
Member
 
Registered: Sep 2009
Location: Perth, W.A.
Distribution: Slackware, Debian, Gentoo, FreeBSD, OpenBSD
Posts: 208

Rep: Reputation: 41
And valgrind for checking compiled program's potential bugs.
 
Old 05-15-2014, 11:30 PM   #3
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,781

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Quote:
Originally Posted by Gullible Jones View Post
In any case, -Wall -Werror seems to catch a lot of stuff in most programs, and you can just exclude stuff with -Wno-[whatever] if you absolutely must.
FYI, -Wall doesn't enable all warnings, you might want -Wextra and since you are interested in vulnerabilities, -Wformat=2.

http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Failed to compile libatomic at the first time to compile gcc(step 5.5) clicdl Linux From Scratch 8 07-23-2013 05:20 AM
Mounting multiple NFS or Samba shares: client-side or server-side? mariogiov Linux - Server 4 04-03-2012 08:11 AM
What is the gcc compile time for the powerpc platform? DrHAAAAAX Linux - General 2 11-26-2011 01:06 PM
Change client-side DNS cache time out value scottyp55 Linux - General 3 10-26-2009 12:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 11:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration