diff --git a/memstomp-man.patch b/memstomp-man.patch index d06462f..b6839f6 100644 --- a/memstomp-man.patch +++ b/memstomp-man.patch @@ -9,25 +9,76 @@ CLEANFILES = \ memstomp ---- /dev/null 2013-02-26 15:11:24.372721019 -0700 -+++ b/memstomp.man 2013-03-11 21:54:06.847082615 -0600 -@@ -0,0 +1,19 @@ +diff -Nrup a/memstomp.man b/memstomp.man +--- a/memstomp.man 1969-12-31 17:00:00.000000000 -0700 ++++ b/memstomp.man 2013-05-10 17:53:37.767722170 -0600 +@@ -0,0 +1,69 @@ +.\" This is a comment +.\" Contact Owen@thelinuxblog.com -+.TH memstomp 1 "05 February 2013" ".1" "memstomp" ++.TH MEMSTOMP 1 "09 April 2013" "0.1.4" +.SH NAME -+memstomp ++memstomp \- detect function calls with overlapping memory regions +.SH SYNOPSIS -+memstomp [OPTIONS...] APPLICATION [ARGUMENTS...] ++.B memstomp ++.RB [ \-dk ] ++.I application ++.RI [ argument ...] ++.PP ++.B memstomp ++.B \-h +.SH DESCRIPTION -+memstomp can help detect memory argument overlaps to various mem* and str* functions. ++The ++.B memstomp ++utility identifies function calls that use overlapping memory regions in situations when such an overlap is not allowed by various standards. When a problem is detected, memstomp displays a backtrace to help you debug the problem, and if executed with the ++.B \-\-debug\-info ++command line option, it even uses the available debugging information. Since the backtrace code is not thread safe, memstomp also allows you to use the ++.B \-\-kill ++option to immediately terminate the analyzed program when an invalid function call is detected. ++.PP ++This version of memstomp inspects the following function calls: ++.BR memcpy (), ++.BR memccpy (), ++.BR mempcpy (), ++.BR strcpy (), ++.BR stpcpy (), ++.BR strncpy (), ++.BR stpncpy (), ++.BR strcat (), ++.BR strncat (), ++.BR wmemcpy (), ++.BR wmempcpy (), ++.BR wcscpy (), ++.BR wcsncpy (), ++.BR wcscat (), ++and ++.BR wcsncat (). +.SH OPTIONS -+-h, --help Show help -+ -+-d, --debug-info Make use of debug information in stack traces -+ -+-k, --kill Kill application when problem is detected -+ ++.TP ++.BR \-d ", " \-\-debug\-info ++Make use of debugging information to produce more detailed stack traces. ++.TP ++.BR \-k ", " \-\-kill ++Kill the analyzed application when a problem is detected. ++.TP ++.BR \-h ", " \-\-help ++Display usage information and exit. +.SH SEE ALSO -+.SH BUGS -+ ++.BR memcpy (3), ++.BR memccpy (3), ++.BR mempcpy (3), ++.BR strcpy (3), ++.BR stpcpy (3), ++.BR strncpy (3), ++.BR stpncpy (3), ++.BR strcat (3), ++.BR strncat (3), ++.BR wmemcpy (3), ++.BR wmempcpy (3), ++.BR wcscpy (3), ++.BR wcsncpy (3), ++.BR wcscat (3), ++.BR wcsncat (3) ++.SH AUTHORS ++Lennart Poettering ++.br ++William Cohen diff --git a/memstomp-quietmode.patch b/memstomp-quietmode.patch new file mode 100644 index 0000000..727ffed --- /dev/null +++ b/memstomp-quietmode.patch @@ -0,0 +1,83 @@ +diff -Nrup a/memstomp.c b/memstomp.c +--- a/memstomp.c 2013-05-30 06:02:56.578486389 -0600 ++++ b/memstomp.c 2013-05-30 06:06:42.648731070 -0600 +@@ -64,6 +64,8 @@ + + static bool abrt_trap = false; + ++static bool quiet_mode = false; ++ + #ifndef SCHED_RESET_ON_FORK + /* "Your libc lacks the definition of SCHED_RESET_ON_FORK. We'll now + * define it ourselves, however make sure your kernel is new +@@ -162,7 +164,10 @@ static void setup(void) { + if (LIKELY(initialized)) + return; + +- if (!dlsym(NULL, "main")) ++ if (getenv("MEMSTOMP_QUIET")) ++ quiet_mode = true; ++ ++ if (!dlsym(NULL, "main") && !quiet_mode) + fprintf(stderr, + "memstomp: Application appears to be compiled without -rdynamic. It might be a\n" + "memstomp: good idea to recompile with -rdynamic enabled since this produces more\n" +@@ -173,9 +178,11 @@ static void setup(void) { + + initialized = true; + +- char prname[17]; +- fprintf(stderr, "memstomp: "PACKAGE_VERSION" successfully initialized for process %s (pid %lu).\n", +- get_prname(prname), (unsigned long) getpid()); ++ if (!quiet_mode) { ++ char prname[17]; ++ fprintf(stderr, "memstomp: "PACKAGE_VERSION" successfully initialized for process %s (pid %lu).\n", ++ get_prname(prname), (unsigned long) getpid()); ++ } + } + + static void show_summary(void) { } +diff -Nrup a/memstomp.in b/memstomp.in +--- a/memstomp.in 2011-03-30 21:27:19.000000000 -0600 ++++ b/memstomp.in 2013-05-30 06:06:42.649731067 -0600 +@@ -18,7 +18,7 @@ + # You should have received a copy of the GNU Lesser General Public + # License along with memstomp. If not, see . + +-if ! TEMP=`getopt -o +dhk --long help,debug-info,kill -n memstomp -- "$@"` ; then ++if ! TEMP=`getopt -o +dqhk --long help,quiet,debug-info,kill -n memstomp -- "$@"` ; then + exit 1 + fi + +@@ -38,6 +38,10 @@ while : ; do + shift 1 + ;; + ++ -q|--quiet) ++ export MEMSTOMP_QUIET=1 ++ shift 1 ++ ;; + + -h|--help) + cat < 0.1.4-9 +- Add -q/--quiet options for quiet mode. + +* Tue May 14 2013 Jeff Law 0.1.4-8 +- Link in libiberty too (#962763) + +* Fri May 10 2013 Jeff Law 0.1.4-7 +- Improve man page (#961518) + +* Thu May 09 2013 Jeff Law 0.1.4-5 +- Fix typo in initialization message (#961495) + +* Fri Mar 15 2013 Jeff Law 0.1.4-4 +- Build tests with -fno-builtin + * Mon Mar 11 2013 Jeff Law 0.1.4-4 - Add manpage - Add initial testsuite