From 090b4cd759cf042c0efe75dceb0ed9d8d42e17ee Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Dec 01 2020 11:29:10 +0000 Subject: import devtoolset-10-memstomp-0.1.5-6.el7 --- diff --git a/.devtoolset-10-memstomp.metadata b/.devtoolset-10-memstomp.metadata new file mode 100644 index 0000000..f98c07b --- /dev/null +++ b/.devtoolset-10-memstomp.metadata @@ -0,0 +1 @@ +e2790544c1130236d8d7c9163527349f3f8a2dc3 SOURCES/memstomp-0.1.5-38573e7d.tar.gz diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b364bb8 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/memstomp-0.1.5-38573e7d.tar.gz diff --git a/SOURCES/memstomp-implicit-int.patch b/SOURCES/memstomp-implicit-int.patch new file mode 100644 index 0000000..340a75a --- /dev/null +++ b/SOURCES/memstomp-implicit-int.patch @@ -0,0 +1,372 @@ +diff -Nrup a/testsuite/memstomp.nooverlap/memccpy.c b/testsuite/memstomp.nooverlap/memccpy.c +--- a/testsuite/memstomp.nooverlap/memccpy.c 2015-05-26 19:20:36.001837645 -0600 ++++ b/testsuite/memstomp.nooverlap/memccpy.c 2015-05-26 19:21:12.500043292 -0600 +@@ -12,6 +12,8 @@ TYPE arr2[10] = {0}; + TYPE *p1 = &arr1[0]; + TYPE *p2 = &arr2[1]; + size_t count = 9; ++ ++int + main () + { + MEMCCPY (p1, p2, -1, count); +diff -Nrup a/testsuite/memstomp.nooverlap/memcpy.c b/testsuite/memstomp.nooverlap/memcpy.c +--- a/testsuite/memstomp.nooverlap/memcpy.c 2015-05-26 19:20:36.001837645 -0600 ++++ b/testsuite/memstomp.nooverlap/memcpy.c 2015-05-26 19:21:19.082900022 -0600 +@@ -12,6 +12,8 @@ TYPE arr2[10] = {0}; + TYPE *p1 = &arr1[0]; + TYPE *p2 = &arr2[1]; + size_t count = 9; ++ ++int + main () + { + MEMCPY (p1, p2, count); +diff -Nrup a/testsuite/memstomp.nooverlap/strcpy.c b/testsuite/memstomp.nooverlap/strcpy.c +--- a/testsuite/memstomp.nooverlap/strcpy.c 2015-05-26 19:20:36.001837645 -0600 ++++ b/testsuite/memstomp.nooverlap/strcpy.c 2015-05-26 19:21:50.617213704 -0600 +@@ -11,6 +11,8 @@ char arr1[32] = "this is a test"; + char arr2[32] = "this is a test"; + char *p1 = &arr1[0]; + char *p2 = &arr2[1]; ++ ++int + main () + { + STRCPY (p2, p1); +diff -Nrup a/testsuite/memstomp.nooverlap/strncpy.c b/testsuite/memstomp.nooverlap/strncpy.c +--- a/testsuite/memstomp.nooverlap/strncpy.c 2015-05-26 19:20:36.001837645 -0600 ++++ b/testsuite/memstomp.nooverlap/strncpy.c 2015-05-26 19:21:54.929119859 -0600 +@@ -11,6 +11,8 @@ char arr1[32] = "this is a test"; + char arr2[32] = "this is a test"; + char *p1 = &arr1[0]; + char *p2 = &arr2[1]; ++ ++int + main () + { + STRNCPY (p1, p2, strlen (p2)); +diff -Nrup a/testsuite/memstomp.nooverlap/wcscpy.c b/testsuite/memstomp.nooverlap/wcscpy.c +--- a/testsuite/memstomp.nooverlap/wcscpy.c 2015-05-26 19:20:36.002837623 -0600 ++++ b/testsuite/memstomp.nooverlap/wcscpy.c 2015-05-26 19:21:58.928032826 -0600 +@@ -11,6 +11,8 @@ wchar_t arr1[32] = L"this is a test"; + wchar_t arr2[32] = L"this is a test"; + wchar_t *p1 = &arr1[0]; + wchar_t *p2 = &arr2[1]; ++ ++int + main () + { + WCSCPY (p1, p2); +diff -Nrup a/testsuite/memstomp.nooverlap/wcsncpy.c b/testsuite/memstomp.nooverlap/wcsncpy.c +--- a/testsuite/memstomp.nooverlap/wcsncpy.c 2015-05-26 19:20:36.002837623 -0600 ++++ b/testsuite/memstomp.nooverlap/wcsncpy.c 2015-05-26 19:22:03.184940178 -0600 +@@ -11,6 +11,8 @@ wchar_t arr1[32] = L"this is a test"; + wchar_t arr2[32] = L"this is a test"; + wchar_t *p1 = &arr1[0]; + wchar_t *p2 = &arr2[1]; ++ ++int + main () + { + WCSNCPY (p1, p2, wcslen (p2)); +diff -Nrup a/testsuite/memstomp.null/memccpy.c b/testsuite/memstomp.null/memccpy.c +--- a/testsuite/memstomp.null/memccpy.c 2015-05-26 19:20:36.010837449 -0600 ++++ b/testsuite/memstomp.null/memccpy.c 2015-05-26 19:22:08.530823830 -0600 +@@ -12,6 +12,8 @@ TYPE arr2[10] = {0}; + TYPE *p1 = &arr1[0]; + TYPE *p2 = &arr2[1]; + size_t count = 9; ++ ++int + main () + { + MEMCCPY (NULL, NULL, -1, 0); +diff -Nrup a/testsuite/memstomp.null/memcpy.c b/testsuite/memstomp.null/memcpy.c +--- a/testsuite/memstomp.null/memcpy.c 2015-05-26 19:20:36.011837427 -0600 ++++ b/testsuite/memstomp.null/memcpy.c 2015-05-26 19:22:13.504715577 -0600 +@@ -12,6 +12,8 @@ TYPE arr2[10] = {0}; + TYPE *p1 = &arr1[0]; + TYPE *p2 = &arr2[1]; + size_t count = 9; ++ ++int + main () + { + return MEMCPY (NULL, NULL, 0) == 0 ; +diff -Nrup a/testsuite/memstomp.null/memmem.c b/testsuite/memstomp.null/memmem.c +--- a/testsuite/memstomp.null/memmem.c 2015-05-26 19:20:36.011837427 -0600 ++++ b/testsuite/memstomp.null/memmem.c 2015-05-26 19:22:16.232656205 -0600 +@@ -12,6 +12,8 @@ TYPE arr2[10] = {0}; + TYPE *p1 = &arr1[0]; + TYPE *p2 = &arr2[1]; + size_t count = 9; ++ ++int + main () + { + return MEMMEM (NULL, 0, NULL, 0) == 0 ; +diff -Nrup a/testsuite/memstomp.null/memset.c b/testsuite/memstomp.null/memset.c +--- a/testsuite/memstomp.null/memset.c 2015-05-26 19:20:36.011837427 -0600 ++++ b/testsuite/memstomp.null/memset.c 2015-05-26 19:22:22.800513262 -0600 +@@ -12,6 +12,8 @@ TYPE arr2[10] = {0}; + TYPE *p1 = &arr1[0]; + TYPE *p2 = &arr2[1]; + size_t count = 9; ++ ++int + main () + { + return MEMSET (NULL, -1, 0) == 0; +diff -Nrup a/testsuite/memstomp.null/rawmemchr.c b/testsuite/memstomp.null/rawmemchr.c +--- a/testsuite/memstomp.null/rawmemchr.c 2015-05-26 19:20:36.011837427 -0600 ++++ b/testsuite/memstomp.null/rawmemchr.c 2015-05-26 19:22:25.857446730 -0600 +@@ -12,6 +12,8 @@ TYPE arr2[10] = {0}; + TYPE *p1 = &arr1[0]; + TYPE *p2 = &arr2[1]; + size_t count = 9; ++ ++int + main () + { + return RAWMEMCHR (NULL, 0) == 0; +diff -Nrup a/testsuite/memstomp.null/strcmp.c b/testsuite/memstomp.null/strcmp.c +--- a/testsuite/memstomp.null/strcmp.c 2015-05-26 19:20:36.012837405 -0600 ++++ b/testsuite/memstomp.null/strcmp.c 2015-05-26 19:22:37.049203151 -0600 +@@ -11,6 +11,8 @@ char arr1[32] = "this is a test"; + char arr2[32] = "this is a test"; + char *p1 = &arr1[0]; + char *p2 = &arr2[1]; ++ ++int + main () + { + return STRCMP (NULL, NULL) == 0; +diff -Nrup a/testsuite/memstomp.null/strcoll_l.c b/testsuite/memstomp.null/strcoll_l.c +--- a/testsuite/memstomp.null/strcoll_l.c 2015-05-26 19:20:36.012837405 -0600 ++++ b/testsuite/memstomp.null/strcoll_l.c 2015-05-26 19:22:41.097115051 -0600 +@@ -11,6 +11,8 @@ char arr1[32] = "this is a test"; + char arr2[32] = "this is a test"; + char *p1 = &arr1[0]; + char *p2 = &arr2[1]; ++ ++int + main () + { + return STRCMP (NULL, NULL, NULL); +diff -Nrup a/testsuite/memstomp.null/strcpy.c b/testsuite/memstomp.null/strcpy.c +--- a/testsuite/memstomp.null/strcpy.c 2015-05-26 19:20:36.012837405 -0600 ++++ b/testsuite/memstomp.null/strcpy.c 2015-05-26 19:22:44.695036746 -0600 +@@ -11,6 +11,8 @@ char arr1[32] = "this is a test"; + char arr2[32] = "this is a test"; + char *p1 = &arr1[0]; + char *p2 = &arr2[1]; ++ ++int + main () + { + STRCPY (NULL, NULL); +diff -Nrup a/testsuite/memstomp.null/strlen.c b/testsuite/memstomp.null/strlen.c +--- a/testsuite/memstomp.null/strlen.c 2015-05-26 19:20:36.012837405 -0600 ++++ b/testsuite/memstomp.null/strlen.c 2015-05-26 19:22:49.456933107 -0600 +@@ -11,6 +11,8 @@ char arr1[32] = "this is a test"; + char arr2[32] = "this is a test"; + char *p1 = &arr1[0]; + char *p2 = &arr2[1]; ++ ++int + main () + { + return STRLEN (NULL) == 0; +diff -Nrup a/testsuite/memstomp.null/strncmp.c b/testsuite/memstomp.null/strncmp.c +--- a/testsuite/memstomp.null/strncmp.c 2015-05-26 19:20:36.012837405 -0600 ++++ b/testsuite/memstomp.null/strncmp.c 2015-05-26 19:22:53.383847641 -0600 +@@ -11,6 +11,8 @@ char arr1[32] = "this is a test"; + char arr2[32] = "this is a test"; + char *p1 = &arr1[0]; + char *p2 = &arr2[1]; ++ ++int + main () + { + return STRNCMP (NULL, NULL, 0); +diff -Nrup a/testsuite/memstomp.null/strncpy.c b/testsuite/memstomp.null/strncpy.c +--- a/testsuite/memstomp.null/strncpy.c 2015-05-26 19:20:36.012837405 -0600 ++++ b/testsuite/memstomp.null/strncpy.c 2015-05-26 19:22:56.135787748 -0600 +@@ -11,6 +11,8 @@ char arr1[32] = "this is a test"; + char arr2[32] = "this is a test"; + char *p1 = &arr1[0]; + char *p2 = &arr2[1]; ++ ++int + main () + { + STRNCPY (NULL, NULL, 0); +diff -Nrup a/testsuite/memstomp.null/strtok_r.c b/testsuite/memstomp.null/strtok_r.c +--- a/testsuite/memstomp.null/strtok_r.c 2015-05-26 19:20:36.013837384 -0600 ++++ b/testsuite/memstomp.null/strtok_r.c 2015-05-26 19:23:04.464606478 -0600 +@@ -12,6 +12,8 @@ TYPE arr2[10] = {0}; + TYPE *p1 = &arr1[0]; + TYPE *p2 = &arr2[1]; + size_t count = 9; ++ ++int + main () + { + return STRTOK_R (NULL, NULL, NULL) == 0 ; +diff -Nrup a/testsuite/memstomp.null/strxfrm_l.c b/testsuite/memstomp.null/strxfrm_l.c +--- a/testsuite/memstomp.null/strxfrm_l.c 2015-05-26 19:20:36.013837384 -0600 ++++ b/testsuite/memstomp.null/strxfrm_l.c 2015-05-26 19:23:10.319479051 -0600 +@@ -11,6 +11,8 @@ char arr1[32] = "this is a test"; + char arr2[32] = "this is a test"; + char *p1 = &arr1[0]; + char *p2 = &arr2[1]; ++ ++int + main () + { + return STRCMP (NULL, NULL, 0, NULL); +diff -Nrup a/testsuite/memstomp.overlap/memccpy-2.c b/testsuite/memstomp.overlap/memccpy-2.c +--- a/testsuite/memstomp.overlap/memccpy-2.c 2015-05-26 19:20:36.002837623 -0600 ++++ b/testsuite/memstomp.overlap/memccpy-2.c 2015-05-26 19:23:17.583320672 -0600 +@@ -11,6 +11,8 @@ TYPE arr[10] = {0}; + TYPE *p1 = &arr[0]; + TYPE *p2 = &arr[1]; + size_t count = 9; ++ ++int + main () + { + MEMCCPY (p2, p1, -1, count); +diff -Nrup a/testsuite/memstomp.overlap/memccpy.c b/testsuite/memstomp.overlap/memccpy.c +--- a/testsuite/memstomp.overlap/memccpy.c 2015-05-26 19:20:36.002837623 -0600 ++++ b/testsuite/memstomp.overlap/memccpy.c 2015-05-26 19:23:20.623254323 -0600 +@@ -11,6 +11,8 @@ TYPE arr[10] = {0}; + TYPE *p1 = &arr[0]; + TYPE *p2 = &arr[1]; + size_t count = 9; ++ ++int + main () + { + MEMCCPY (p1, p2, -1, count); +diff -Nrup a/testsuite/memstomp.overlap/memcpy-2.c b/testsuite/memstomp.overlap/memcpy-2.c +--- a/testsuite/memstomp.overlap/memcpy-2.c 2015-05-26 19:20:36.002837623 -0600 ++++ b/testsuite/memstomp.overlap/memcpy-2.c 2015-05-26 19:23:23.823184481 -0600 +@@ -11,6 +11,8 @@ TYPE arr[10] = {0}; + TYPE *p1 = &arr[0]; + TYPE *p2 = &arr[1]; + size_t count = 9; ++ ++int + main () + { + MEMCPY (p2, p1, count); +diff -Nrup a/testsuite/memstomp.overlap/memcpy.c b/testsuite/memstomp.overlap/memcpy.c +--- a/testsuite/memstomp.overlap/memcpy.c 2015-05-26 19:20:36.002837623 -0600 ++++ b/testsuite/memstomp.overlap/memcpy.c 2015-05-26 19:23:26.559124767 -0600 +@@ -11,6 +11,8 @@ TYPE arr[10] = {0}; + TYPE *p1 = &arr[0]; + TYPE *p2 = &arr[1]; + size_t count = 9; ++ ++int + main () + { + MEMCPY (p1, p2, count); +diff -Nrup a/testsuite/memstomp.overlap/strcpy-2.c b/testsuite/memstomp.overlap/strcpy-2.c +--- a/testsuite/memstomp.overlap/strcpy-2.c 2015-05-26 19:20:36.003837601 -0600 ++++ b/testsuite/memstomp.overlap/strcpy-2.c 2015-05-26 19:23:37.055895666 -0600 +@@ -10,6 +10,8 @@ + char arr[32] = "this is a test"; + char *p1 = &arr[0]; + char *p2 = &arr[1]; ++ ++int + main () + { + STRCPY (p1, p2); +diff -Nrup a/testsuite/memstomp.overlap/strcpy.c b/testsuite/memstomp.overlap/strcpy.c +--- a/testsuite/memstomp.overlap/strcpy.c 2015-05-26 19:20:36.003837601 -0600 ++++ b/testsuite/memstomp.overlap/strcpy.c 2015-05-26 19:23:40.231826349 -0600 +@@ -10,6 +10,8 @@ + char arr[32] = "this is a test"; + char *p1 = &arr[0]; + char *p2 = &arr[1]; ++ ++int + main () + { + STRCPY (p2, p1); +diff -Nrup a/testsuite/memstomp.overlap/strncpy-2.c b/testsuite/memstomp.overlap/strncpy-2.c +--- a/testsuite/memstomp.overlap/strncpy-2.c 2015-05-26 19:20:36.003837601 -0600 ++++ b/testsuite/memstomp.overlap/strncpy-2.c 2015-05-26 19:23:45.158718815 -0600 +@@ -10,6 +10,8 @@ + char arr[32] = "this is a test"; + char *p1 = &arr[0]; + char *p2 = &arr[1]; ++ ++int + main () + { + STRNCPY (p2, p1, strlen (p1)); +diff -Nrup a/testsuite/memstomp.overlap/strncpy.c b/testsuite/memstomp.overlap/strncpy.c +--- a/testsuite/memstomp.overlap/strncpy.c 2015-05-26 19:20:36.003837601 -0600 ++++ b/testsuite/memstomp.overlap/strncpy.c 2015-05-26 19:23:48.311650000 -0600 +@@ -10,6 +10,8 @@ + char arr[32] = "this is a test"; + char *p1 = &arr[0]; + char *p2 = &arr[1]; ++ ++int + main () + { + STRNCPY (p1, p2, strlen (p2)); +diff -Nrup a/testsuite/memstomp.overlap/wcscpy-2.c b/testsuite/memstomp.overlap/wcscpy-2.c +--- a/testsuite/memstomp.overlap/wcscpy-2.c 2015-05-26 19:20:36.003837601 -0600 ++++ b/testsuite/memstomp.overlap/wcscpy-2.c 2015-05-26 19:23:53.167544016 -0600 +@@ -10,6 +10,8 @@ + wchar_t arr[32] = L"this is a test"; + wchar_t *p1 = &arr[0]; + wchar_t *p2 = &arr[1]; ++ ++int + main () + { + WCSCPY (p2, p1); +diff -Nrup a/testsuite/memstomp.overlap/wcscpy.c b/testsuite/memstomp.overlap/wcscpy.c +--- a/testsuite/memstomp.overlap/wcscpy.c 2015-05-26 19:20:36.003837601 -0600 ++++ b/testsuite/memstomp.overlap/wcscpy.c 2015-05-26 19:23:56.070480657 -0600 +@@ -10,6 +10,8 @@ + wchar_t arr[32] = L"this is a test"; + wchar_t *p1 = &arr[0]; + wchar_t *p2 = &arr[1]; ++ ++int + main () + { + WCSCPY (p1, p2); +diff -Nrup a/testsuite/memstomp.overlap/wcsncpy-2.c b/testsuite/memstomp.overlap/wcsncpy-2.c +--- a/testsuite/memstomp.overlap/wcsncpy-2.c 2015-05-26 19:20:36.003837601 -0600 ++++ b/testsuite/memstomp.overlap/wcsncpy-2.c 2015-05-26 19:24:00.279388794 -0600 +@@ -10,6 +10,8 @@ + wchar_t arr[32] = L"this is a test"; + wchar_t *p1 = &arr[0]; + wchar_t *p2 = &arr[1]; ++ ++int + main () + { + WCSNCPY (p2, p1, wcslen (p2)); +diff -Nrup a/testsuite/memstomp.overlap/wcsncpy.c b/testsuite/memstomp.overlap/wcsncpy.c +--- a/testsuite/memstomp.overlap/wcsncpy.c 2015-05-26 19:20:36.003837601 -0600 ++++ b/testsuite/memstomp.overlap/wcsncpy.c 2015-05-26 19:24:03.222324562 -0600 +@@ -10,6 +10,8 @@ + wchar_t arr[32] = L"this is a test"; + wchar_t *p1 = &arr[0]; + wchar_t *p2 = &arr[1]; ++ ++int + main () + { + WCSNCPY (p1, p2, wcslen (p2)); diff --git a/SOURCES/memstomp-man.patch b/SOURCES/memstomp-man.patch new file mode 100644 index 0000000..b6839f6 --- /dev/null +++ b/SOURCES/memstomp-man.patch @@ -0,0 +1,84 @@ +--- a/Makefile.am 2013-03-11 21:53:40.934186094 -0600 ++++ b/Makefile.am 2013-03-11 21:57:44.795212526 -0600 +@@ -34,6 +34,8 @@ lib_LTLIBRARIES = \ + bin_SCRIPTS = \ + memstomp + ++man1_MANS = memstomp.man ++ + CLEANFILES = \ + memstomp + +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 "09 April 2013" "0.1.4" ++.SH NAME ++memstomp \- detect function calls with overlapping memory regions ++.SH SYNOPSIS ++.B memstomp ++.RB [ \-dk ] ++.I application ++.RI [ argument ...] ++.PP ++.B memstomp ++.B \-h ++.SH DESCRIPTION ++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 ++.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 ++.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/SOURCES/memstomp-quietmode.patch b/SOURCES/memstomp-quietmode.patch new file mode 100644 index 0000000..727ffed --- /dev/null +++ b/SOURCES/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 < ++#include ++ ++#ifndef MEMCCPY ++#define MEMCCPY memccpy ++#define TYPE char ++#endif ++ ++TYPE arr1[10] = {0}; ++TYPE arr2[10] = {0}; ++TYPE *p1 = &arr1[0]; ++TYPE *p2 = &arr2[1]; ++size_t count = 9; ++main () ++{ ++ MEMCCPY (NULL, NULL, -1, 0); ++} ++ ++ +diff -Nrup a/testsuite/memstomp.null/memchr.c b/testsuite/memstomp.null/memchr.c +--- a/testsuite/memstomp.null/memchr.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/memchr.c 2014-05-29 14:09:04.667841941 -0600 +@@ -0,0 +1,4 @@ ++#define MEMSET memchr ++#define TYPE char ++#include "memset.c" ++ +diff -Nrup a/testsuite/memstomp.null/memcmp.c b/testsuite/memstomp.null/memcmp.c +--- a/testsuite/memstomp.null/memcmp.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/memcmp.c 2014-05-29 13:57:53.098567650 -0600 +@@ -0,0 +1,3 @@ ++#define MEMCPY memcmp ++#define TYPE char ++#include "memcpy.c" +diff -Nrup a/testsuite/memstomp.null/memcpy.c b/testsuite/memstomp.null/memcpy.c +--- a/testsuite/memstomp.null/memcpy.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/memcpy.c 2014-05-29 14:01:34.002999896 -0600 +@@ -0,0 +1,20 @@ ++#define _GNU_SOURCE ++#include ++#include ++ ++#ifndef MEMCPY ++#define MEMCPY memcpy ++#define TYPE char ++#endif ++ ++TYPE arr1[10] = {0}; ++TYPE arr2[10] = {0}; ++TYPE *p1 = &arr1[0]; ++TYPE *p2 = &arr2[1]; ++size_t count = 9; ++main () ++{ ++ return MEMCPY (NULL, NULL, 0) == 0 ; ++} ++ ++ +diff -Nrup a/testsuite/memstomp.null/memmem.c b/testsuite/memstomp.null/memmem.c +--- a/testsuite/memstomp.null/memmem.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/memmem.c 2014-05-29 14:18:37.569363960 -0600 +@@ -0,0 +1,20 @@ ++#define _GNU_SOURCE ++#include ++#include ++ ++#ifndef MEMMEM ++#define MEMMEM memmem ++#define TYPE char ++#endif ++ ++TYPE arr1[10] = {0}; ++TYPE arr2[10] = {0}; ++TYPE *p1 = &arr1[0]; ++TYPE *p2 = &arr2[1]; ++size_t count = 9; ++main () ++{ ++ return MEMMEM (NULL, 0, NULL, 0) == 0 ; ++} ++ ++ +diff -Nrup a/testsuite/memstomp.null/memmove.c b/testsuite/memstomp.null/memmove.c +--- a/testsuite/memstomp.null/memmove.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/memmove.c 2014-05-29 13:57:29.563628151 -0600 +@@ -0,0 +1,3 @@ ++#define MEMCPY memmove ++#define TYPE char ++#include "memcpy.c" +diff -Nrup a/testsuite/memstomp.null/mempcpy.c b/testsuite/memstomp.null/mempcpy.c +--- a/testsuite/memstomp.null/mempcpy.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/mempcpy.c 2014-05-29 12:42:18.358166208 -0600 +@@ -0,0 +1,3 @@ ++#define MEMCPY mempcpy ++#define TYPE char ++#include "memcpy.c" +diff -Nrup a/testsuite/memstomp.null/memrchr.c b/testsuite/memstomp.null/memrchr.c +--- a/testsuite/memstomp.null/memrchr.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/memrchr.c 2014-05-29 14:09:22.122797099 -0600 +@@ -0,0 +1,4 @@ ++#define MEMSET memrchr ++#define TYPE char ++#include "memset.c" ++ +diff -Nrup a/testsuite/memstomp.null/memset.c b/testsuite/memstomp.null/memset.c +--- a/testsuite/memstomp.null/memset.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/memset.c 2014-05-29 14:08:06.411991603 -0600 +@@ -0,0 +1,20 @@ ++#define _GNU_SOURCE ++#include ++#include ++ ++#ifndef MEMSET ++#define MEMSET memset ++#define TYPE char ++#endif ++ ++TYPE arr1[10] = {0}; ++TYPE arr2[10] = {0}; ++TYPE *p1 = &arr1[0]; ++TYPE *p2 = &arr2[1]; ++size_t count = 9; ++main () ++{ ++ return MEMSET (NULL, -1, 0) == 0; ++} ++ ++ +diff -Nrup a/testsuite/memstomp.null/null.exp b/testsuite/memstomp.null/null.exp +--- a/testsuite/memstomp.null/null.exp 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/null.exp 2014-05-29 12:42:18.358166208 -0600 +@@ -0,0 +1,59 @@ ++# Copyright (C) 2013 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with GCC; see the file COPYING3. If not see ++# . ++# ++# This was originally copied from GCC's dejagnu testing framework ++# ++ ++load_lib memstomp.exp ++set memstomp [find_memstomp] ++set libmemstomp [find_libmemstomp] ++ ++if $tracelevel then { ++ strace $tracelevel ++} ++ ++# ++# main test loop ++# ++ ++proc compile-and-execute { sources } { ++ global memstomp ++ global libmemstomp ++ ++ set src [lindex $sources 0] ++ ++ if {[catch {exec gcc -fno-builtin $src} results]} { ++ fail "$src compilation $results" ++ } else { ++ pass "$src compilation $results" ++ } ++ ++ catch {exec /bin/bash -c "LD_PRELOAD=$libmemstomp $memstomp ./a.out"} results ++ if {[regexp "NULL pointer" $results]} { ++ pass "$src found NULL $results" ++ } else { ++ fail "$src found NULL $results" ++ } ++} ++ ++foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]] { ++ # If we're only testing specific files and this isn't one of them, skip it. ++ if ![runtest_file_p $runtests $src] then { ++ continue ++ } ++ ++ compile-and-execute $src ++} +diff -Nrup a/testsuite/memstomp.null/rawmemchr.c b/testsuite/memstomp.null/rawmemchr.c +--- a/testsuite/memstomp.null/rawmemchr.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/rawmemchr.c 2014-05-29 14:10:36.610605748 -0600 +@@ -0,0 +1,20 @@ ++#define _GNU_SOURCE ++#include ++#include ++ ++#ifndef RAWMEMCHR ++#define RAWMEMCHR rawmemchr ++#define TYPE char ++#endif ++ ++TYPE arr1[10] = {0}; ++TYPE arr2[10] = {0}; ++TYPE *p1 = &arr1[0]; ++TYPE *p2 = &arr2[1]; ++size_t count = 9; ++main () ++{ ++ return RAWMEMCHR (NULL, 0) == 0; ++} ++ ++ +diff -Nrup a/testsuite/memstomp.null/stpcpy.c b/testsuite/memstomp.null/stpcpy.c +--- a/testsuite/memstomp.null/stpcpy.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/stpcpy.c 2014-05-29 12:42:18.358166208 -0600 +@@ -0,0 +1,2 @@ ++#define STRCPY stpcpy ++#include "strcpy.c" +diff -Nrup a/testsuite/memstomp.null/stpncpy.c b/testsuite/memstomp.null/stpncpy.c +--- a/testsuite/memstomp.null/stpncpy.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/stpncpy.c 2014-05-29 12:42:18.358166208 -0600 +@@ -0,0 +1,2 @@ ++#define STRNCPY stpncpy ++#include "strncpy.c" +diff -Nrup a/testsuite/memstomp.null/strcasestr.c b/testsuite/memstomp.null/strcasestr.c +--- a/testsuite/memstomp.null/strcasestr.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/strcasestr.c 2014-05-29 14:18:59.099308034 -0600 +@@ -0,0 +1,2 @@ ++#define STRCMP strstr ++#include "strcmp.c" +diff -Nrup a/testsuite/memstomp.null/strcat.c b/testsuite/memstomp.null/strcat.c +--- a/testsuite/memstomp.null/strcat.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/strcat.c 2014-05-29 12:42:18.359166205 -0600 +@@ -0,0 +1,2 @@ ++#define STRCPY strcat ++#include "strcpy.c" +diff -Nrup a/testsuite/memstomp.null/strchr.c b/testsuite/memstomp.null/strchr.c +--- a/testsuite/memstomp.null/strchr.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/strchr.c 2014-05-29 14:13:39.929134865 -0600 +@@ -0,0 +1,4 @@ ++#define RAWMEMCHR strchr ++#define TYPE char ++#include "rawmemchr.c" ++ +diff -Nrup a/testsuite/memstomp.null/strchrnul.c b/testsuite/memstomp.null/strchrnul.c +--- a/testsuite/memstomp.null/strchrnul.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/strchrnul.c 2014-05-29 14:15:17.983882584 -0600 +@@ -0,0 +1,4 @@ ++#define RAWMEMCHR strrchr ++#define TYPE char ++#include "rawmemchr.c" ++ +diff -Nrup a/testsuite/memstomp.null/strcmp.c b/testsuite/memstomp.null/strcmp.c +--- a/testsuite/memstomp.null/strcmp.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/strcmp.c 2014-05-29 14:17:21.903560538 -0600 +@@ -0,0 +1,19 @@ ++#define _GNU_SOURCE ++#include ++#include ++ ++#ifndef STRCMP ++#define STRCMP strcmp ++#endif ++ ++ ++char arr1[32] = "this is a test"; ++char arr2[32] = "this is a test"; ++char *p1 = &arr1[0]; ++char *p2 = &arr2[1]; ++main () ++{ ++ return STRCMP (NULL, NULL) == 0; ++} ++ ++ +diff -Nrup a/testsuite/memstomp.null/strcoll.c b/testsuite/memstomp.null/strcoll.c +--- a/testsuite/memstomp.null/strcoll.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/strcoll.c 2014-05-29 14:04:39.735522619 -0600 +@@ -0,0 +1,2 @@ ++#define STRNCPY strcoll ++#include "strcmp.c" +Binary files a/testsuite/memstomp.null/.strcoll.c.swp and b/testsuite/memstomp.null/.strcoll.c.swp differ +diff -Nrup a/testsuite/memstomp.null/strcoll_l.c b/testsuite/memstomp.null/strcoll_l.c +--- a/testsuite/memstomp.null/strcoll_l.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/strcoll_l.c 2014-05-29 14:05:22.181413555 -0600 +@@ -0,0 +1,19 @@ ++#define _GNU_SOURCE ++#include ++#include ++ ++#ifndef STRCMP ++#define STRCMP strcoll_l ++#endif ++ ++ ++char arr1[32] = "this is a test"; ++char arr2[32] = "this is a test"; ++char *p1 = &arr1[0]; ++char *p2 = &arr2[1]; ++main () ++{ ++ return STRCMP (NULL, NULL, NULL); ++} ++ ++ +diff -Nrup a/testsuite/memstomp.null/strcpy.c b/testsuite/memstomp.null/strcpy.c +--- a/testsuite/memstomp.null/strcpy.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/strcpy.c 2014-05-29 12:42:18.359166205 -0600 +@@ -0,0 +1,19 @@ ++#define _GNU_SOURCE ++#include ++#include ++ ++#ifndef STRCPY ++#define STRCPY strcpy ++#endif ++ ++ ++char arr1[32] = "this is a test"; ++char arr2[32] = "this is a test"; ++char *p1 = &arr1[0]; ++char *p2 = &arr2[1]; ++main () ++{ ++ STRCPY (NULL, NULL); ++} ++ ++ +diff -Nrup a/testsuite/memstomp.null/strcspn.c b/testsuite/memstomp.null/strcspn.c +--- a/testsuite/memstomp.null/strcspn.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/strcspn.c 2014-05-29 14:16:12.219741618 -0600 +@@ -0,0 +1,2 @@ ++#define STRCMP strcspn ++#include "strcmp.c" +diff -Nrup a/testsuite/memstomp.null/strdup.c b/testsuite/memstomp.null/strdup.c +--- a/testsuite/memstomp.null/strdup.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/strdup.c 2014-05-29 14:12:20.521338829 -0600 +@@ -0,0 +1,3 @@ ++#define STRLEN strdup ++#define TYPE char ++#include "strlen.c" +diff -Nrup a/testsuite/memstomp.null/strlen.c b/testsuite/memstomp.null/strlen.c +--- a/testsuite/memstomp.null/strlen.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/strlen.c 2014-05-29 14:12:28.969317129 -0600 +@@ -0,0 +1,19 @@ ++#define _GNU_SOURCE ++#include ++#include ++ ++#ifndef STRLEN ++#define STRLEN strlen ++#endif ++ ++ ++char arr1[32] = "this is a test"; ++char arr2[32] = "this is a test"; ++char *p1 = &arr1[0]; ++char *p2 = &arr2[1]; ++main () ++{ ++ return STRLEN (NULL) == 0; ++} ++ ++ +diff -Nrup a/testsuite/memstomp.null/strncat.c b/testsuite/memstomp.null/strncat.c +--- a/testsuite/memstomp.null/strncat.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/strncat.c 2014-05-29 12:42:18.359166205 -0600 +@@ -0,0 +1,2 @@ ++#define STRNCPY strncat ++#include "strncpy.c" +diff -Nrup a/testsuite/memstomp.null/strncmp.c b/testsuite/memstomp.null/strncmp.c +--- a/testsuite/memstomp.null/strncmp.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/strncmp.c 2014-05-29 14:03:31.222698668 -0600 +@@ -0,0 +1,19 @@ ++#define _GNU_SOURCE ++#include ++#include ++ ++#ifndef STRNCMP ++#define STRNCMP strncmp ++#endif ++ ++ ++char arr1[32] = "this is a test"; ++char arr2[32] = "this is a test"; ++char *p1 = &arr1[0]; ++char *p2 = &arr2[1]; ++main () ++{ ++ return STRNCMP (NULL, NULL, 0); ++} ++ ++ +diff -Nrup a/testsuite/memstomp.null/strncpy.c b/testsuite/memstomp.null/strncpy.c +--- a/testsuite/memstomp.null/strncpy.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/strncpy.c 2014-05-29 12:42:18.359166205 -0600 +@@ -0,0 +1,19 @@ ++#define _GNU_SOURCE ++#include ++#include ++ ++#ifndef STRNCPY ++#define STRNCPY strncpy ++#endif ++ ++ ++char arr1[32] = "this is a test"; ++char arr2[32] = "this is a test"; ++char *p1 = &arr1[0]; ++char *p2 = &arr2[1]; ++main () ++{ ++ STRNCPY (NULL, NULL, 0); ++} ++ ++ +diff -Nrup a/testsuite/memstomp.null/strndup.c b/testsuite/memstomp.null/strndup.c +--- a/testsuite/memstomp.null/strndup.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/strndup.c 2014-05-29 14:13:18.192190697 -0600 +@@ -0,0 +1,4 @@ ++#define RAWMEMCHR strndup ++#define TYPE char ++#include "rawmemchr.c" ++ +diff -Nrup a/testsuite/memstomp.null/strpbrk.c b/testsuite/memstomp.null/strpbrk.c +--- a/testsuite/memstomp.null/strpbrk.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/strpbrk.c 2014-05-29 14:17:09.970591544 -0600 +@@ -0,0 +1,2 @@ ++#define STRCMP strpbrk ++#include "strcmp.c" +diff -Nrup a/testsuite/memstomp.null/strrchr.c b/testsuite/memstomp.null/strrchr.c +--- a/testsuite/memstomp.null/strrchr.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/strrchr.c 2014-05-29 14:15:23.466868332 -0600 +@@ -0,0 +1,4 @@ ++#define RAWMEMCHR strchrnul ++#define TYPE char ++#include "rawmemchr.c" ++ +diff -Nrup a/testsuite/memstomp.null/strspn.c b/testsuite/memstomp.null/strspn.c +--- a/testsuite/memstomp.null/strspn.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/strspn.c 2014-05-29 14:16:33.880685326 -0600 +@@ -0,0 +1,2 @@ ++#define STRCMP strspn ++#include "strcmp.c" +diff -Nrup a/testsuite/memstomp.null/strstr.c b/testsuite/memstomp.null/strstr.c +--- a/testsuite/memstomp.null/strstr.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/strstr.c 2014-05-29 14:16:56.195627338 -0600 +@@ -0,0 +1,2 @@ ++#define STRCMP strstr ++#include "strcmp.c" +diff -Nrup a/testsuite/memstomp.null/strtok.c b/testsuite/memstomp.null/strtok.c +--- a/testsuite/memstomp.null/strtok.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/strtok.c 2014-05-29 14:19:10.868277465 -0600 +@@ -0,0 +1,2 @@ ++#define STRCMP strtok ++#include "strcmp.c" +diff -Nrup a/testsuite/memstomp.null/strtok_r.c b/testsuite/memstomp.null/strtok_r.c +--- a/testsuite/memstomp.null/strtok_r.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/strtok_r.c 2014-05-29 14:19:53.089167807 -0600 +@@ -0,0 +1,20 @@ ++#define _GNU_SOURCE ++#include ++#include ++ ++#ifndef STRTOK_R ++#define STRTOK_R strtok_r ++#define TYPE char ++#endif ++ ++TYPE arr1[10] = {0}; ++TYPE arr2[10] = {0}; ++TYPE *p1 = &arr1[0]; ++TYPE *p2 = &arr2[1]; ++size_t count = 9; ++main () ++{ ++ return STRTOK_R (NULL, NULL, NULL) == 0 ; ++} ++ ++ +diff -Nrup a/testsuite/memstomp.null/strxfrm.c b/testsuite/memstomp.null/strxfrm.c +--- a/testsuite/memstomp.null/strxfrm.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/strxfrm.c 2014-05-29 14:06:23.335256429 -0600 +@@ -0,0 +1,2 @@ ++#define STRNCPY strxfrm ++#include "strcmp.c" +diff -Nrup a/testsuite/memstomp.null/strxfrm_l.c b/testsuite/memstomp.null/strxfrm_l.c +--- a/testsuite/memstomp.null/strxfrm_l.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/strxfrm_l.c 2014-05-29 14:07:10.004136524 -0600 +@@ -0,0 +1,19 @@ ++#define _GNU_SOURCE ++#include ++#include ++ ++#ifndef STRCMP ++#define STRCMP strxfrm_l ++#endif ++ ++ ++char arr1[32] = "this is a test"; ++char arr2[32] = "this is a test"; ++char *p1 = &arr1[0]; ++char *p2 = &arr2[1]; ++main () ++{ ++ return STRCMP (NULL, NULL, 0, NULL); ++} ++ ++ +diff -Nrup a/testsuite/memstomp.null/wmemcpy.c b/testsuite/memstomp.null/wmemcpy.c +--- a/testsuite/memstomp.null/wmemcpy.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/wmemcpy.c 2014-05-29 12:42:18.359166205 -0600 +@@ -0,0 +1,3 @@ ++#define MEMCPY wmemcpy ++#define TYPE wchar_t ++#include "memcpy.c" +diff -Nrup a/testsuite/memstomp.null/wmempcpy.c b/testsuite/memstomp.null/wmempcpy.c +--- a/testsuite/memstomp.null/wmempcpy.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.null/wmempcpy.c 2014-05-29 12:42:18.359166205 -0600 +@@ -0,0 +1,3 @@ ++#define MEMCPY wmempcpy ++#define TYPE wchar_t ++#include "memcpy.c" diff --git a/SOURCES/memstomp-rh1133815.patch b/SOURCES/memstomp-rh1133815.patch new file mode 100644 index 0000000..5f05de9 --- /dev/null +++ b/SOURCES/memstomp-rh1133815.patch @@ -0,0 +1,158 @@ +diff -Nrup a/memstomp.c b/memstomp.c +--- a/memstomp.c 2014-08-26 13:13:30.004485804 -0600 ++++ b/memstomp.c 2014-08-26 13:17:00.450138891 -0600 +@@ -241,6 +241,16 @@ static char* generate_stacktrace(void) + int const n = real_backtrace(retaddr, frames_max); + assert(n >= 0); + ++ /* Adjust the frame addresses since they point to the next ++ instruction to execute, not the call site which may be ++ associated with different line numbers. ++ ++ For the cases we care about in memstomp, just subtracting ++ 1 works the vast majority of the time. It may not work for ++ a tail-call into an intercepted routine though. */ ++ for (int i = 0; i < n; i++) ++ retaddr[i]--; ++ + char **const strings = real_backtrace_symbols(retaddr, n); + assert(strings); + +diff -Nrup a/testsuite/lib/memstomp.exp b/testsuite/lib/memstomp.exp +--- a/testsuite/lib/memstomp.exp 2014-08-26 13:13:29.964485869 -0600 ++++ b/testsuite/lib/memstomp.exp 2014-08-26 14:29:37.334241044 -0600 +@@ -13,3 +13,11 @@ proc find_libmemstomp {} { + set file [findfile $base_dir/../.libs/libmemstomp.so $base_dir/../.libs/libmemstomp.so libmemstomp.so] + return $file + } ++ ++proc find_libmemstomp_backtrace_symbols {} { ++ global tool_root_dir ++ global base_dir ++ ++ set file [findfile $base_dir/../.libs/libmemstomp-backtrace-symbols.so $base_dir/../.libs/libmemstomp-backtrace-symbols.so libmemstomp-backtrace-symbols.so] ++ return $file ++} +diff -Nrup a/testsuite/memstomp.lineinfo/linenumber.c b/testsuite/memstomp.lineinfo/linenumber.c +--- a/testsuite/memstomp.lineinfo/linenumber.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.lineinfo/linenumber.c 2014-08-26 13:23:12.535518727 -0600 +@@ -0,0 +1,23 @@ ++#define __NO_STRING_INLINES ++#include ++ ++void ++something (void) ++{ ++ char a[20] = " hello"; ++ memcpy (a, a + 5, 6); ++} ++ ++void ++nothing (void) ++{ ++ something (); ++} ++ ++int ++main (void) ++{ ++ nothing (); ++ return 0; ++} ++ +diff -Nrup a/testsuite/memstomp.lineinfo/linenumber.exp b/testsuite/memstomp.lineinfo/linenumber.exp +--- a/testsuite/memstomp.lineinfo/linenumber.exp 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.lineinfo/linenumber.exp 2014-08-26 17:49:55.493353200 -0600 +@@ -0,0 +1,65 @@ ++# Copyright (C) 2014 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with GCC; see the file COPYING3. If not see ++# . ++# ++# This was originally copied from GCC's dejagnu testing framework ++# ++# This is a hack. If we need more of these tests we'll want to use ++# something like dj's framework so that we can mark the lines where ++# we want errors/warnings. ++# ++ ++load_lib memstomp.exp ++set libmemstomp [find_libmemstomp] ++set libmemstomp_backtrace_symbols [find_libmemstomp_backtrace_symbols] ++ ++if $tracelevel then { ++ strace $tracelevel ++} ++ ++# ++# main test loop ++# ++ ++proc compile-and-execute { sources } { ++ global libmemstomp ++ global libmemstomp_backtrace_symbols ++ ++ set src [lindex $sources 0] ++ ++ if {[catch {exec gcc -g -fno-builtin $src} results]} { ++ fail "$src compilation $results" ++ } else { ++ pass "$src compilation $results" ++ } ++ ++ # ARM's unwinder seems broken ++ setup_xfail arm*-*-* ++ catch {exec /bin/bash -c "LD_PRELOAD=$libmemstomp:$libmemstomp_backtrace_symbols ./a.out"} results ++ if {[regexp "linenumber.c:8" $results]} { ++ pass "$src found overlap on right line $results" ++ } else { ++ fail "$src found overlap on right line $results" ++ } ++} ++ ++foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]] { ++ # If we're only testing specific files and this isn't one of them, skip it. ++ if ![runtest_file_p $runtests $src] then { ++ continue ++ } ++ ++ compile-and-execute $src ++} +diff -Nrup a/testsuite/memstomp.overlap/linenumber.c b/testsuite/memstomp.overlap/linenumber.c +--- a/testsuite/memstomp.overlap/linenumber.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.overlap/linenumber.c 2014-08-26 13:17:30.057090085 -0600 +@@ -0,0 +1,23 @@ ++#define __NO_STRING_INLINES ++#include ++ ++void ++something (void) ++{ ++ char a[20] = " hello"; ++ memcpy (a, a + 5, 6); ++} ++ ++void ++nothing (void) ++{ ++ something (); ++} ++ ++int ++main (void) ++{ ++ nothing (); ++ return 0; ++} ++ diff --git a/SOURCES/memstomp-rh961495.patch b/SOURCES/memstomp-rh961495.patch new file mode 100644 index 0000000..49b7345 --- /dev/null +++ b/SOURCES/memstomp-rh961495.patch @@ -0,0 +1,12 @@ +diff -Nrup a/memstomp.c b/memstomp.c +--- a/memstomp.c 2011-03-30 21:27:19.000000000 -0600 ++++ b/memstomp.c 2013-05-09 22:23:39.210837345 -0600 +@@ -174,7 +174,7 @@ static void setup(void) { + initialized = true; + + char prname[17]; +- fprintf(stderr, "memstomp: "PACKAGE_VERSION" sucessfully initialized for process %s (pid %lu).\n", ++ fprintf(stderr, "memstomp: "PACKAGE_VERSION" successfully initialized for process %s (pid %lu).\n", + get_prname(prname), (unsigned long) getpid()); + } + diff --git a/SOURCES/memstomp-rh962763.patch b/SOURCES/memstomp-rh962763.patch new file mode 100644 index 0000000..9fce643 --- /dev/null +++ b/SOURCES/memstomp-rh962763.patch @@ -0,0 +1,15 @@ +diff -Nrup a/configure.ac b/configure.ac +--- a/configure.ac 2013-05-14 14:27:04.316530952 -0600 ++++ b/configure.ac 2013-05-14 14:27:37.854394379 -0600 +@@ -72,8 +72,10 @@ AC_CHECK_HEADERS([sys/poll.h]) + AC_CHECK_HEADERS([sys/ioctl.h]) + AC_CHECK_HEADERS([byteswap.h]) + ++AC_SEARCH_LIBS([htab_find_slot], [iberty], [], [AC_MSG_ERROR([*** libiberty not found])]) ++AC_CHECK_HEADERS([libiberty.h], [], [AC_MSG_ERROR([*** libiberty.h header not found])]) + AC_SEARCH_LIBS([bfd_init], [bfd], [], [AC_MSG_ERROR([*** libbfd not found])]) +-AC_CHECK_HEADERS([bfd.h], [], [AC_MSG_ERROR([*** POSIX caps headers not found])]) ++AC_CHECK_HEADERS([bfd.h], [], [AC_MSG_ERROR([*** bfd.h header not found])]) + + #### Typdefs, structures, etc. #### + diff --git a/SOURCES/memstomp-testsuite.patch b/SOURCES/memstomp-testsuite.patch new file mode 100644 index 0000000..7e63d12 --- /dev/null +++ b/SOURCES/memstomp-testsuite.patch @@ -0,0 +1,751 @@ +diff -Nrup a/Makefile.am b/Makefile.am +--- a/Makefile.am 2011-03-30 21:27:19.000000000 -0600 ++++ b/Makefile.am 2013-03-11 15:31:08.909891995 -0600 +@@ -86,3 +86,24 @@ dist-gzip: + (cd $(srcdir); git archive --prefix=memstomp-$(VERSION)/ --format=tar HEAD) | gzip > memstomp-$(VERSION).tar.gz + + ACLOCAL_AMFLAGS = -I m4 ++ ++check-DEJAGNU: site.exp ++ if [ -d testsuite ]; then \ ++ true; \ ++ else \ ++ mkdir testsuite; \ ++ fi ++ rm -f testsuite/site.exp ++ cp site.exp testsuite/site.exp ++ rootme=`pwd`; export rootme; \ ++ srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \ ++ LC_ALL=C; export LC_ALL; \ ++ EXPECT=${EXPECT} ; export EXPECT ; \ ++ runtest=$(RUNTEST); \ ++ cd testsuite; \ ++ if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ ++ $$runtest --tool $(DEJATOOL) --srcdir $${srcdir}/testsuite \ ++ $(RUNTESTFLAGS); \ ++ else echo "WARNING: could not find \`runtest'" 1>&2; :;\ ++ fi ++ +diff -Nrup a/configure.ac b/configure.ac +--- a/configure.ac 2011-03-30 21:27:19.000000000 -0600 ++++ b/configure.ac 2013-03-11 15:27:32.812194998 -0600 +@@ -25,7 +25,7 @@ AC_CONFIG_SRCDIR([memstomp.c]) + AC_CONFIG_HEADERS([config.h]) + AC_CONFIG_MACRO_DIR(m4) + +-AM_INIT_AUTOMAKE([foreign 1.10 -Wall -Wno-portability tar-pax]) ++AM_INIT_AUTOMAKE([foreign 1.10 -Wall -Wno-portability tar-pax dejagnu]) + + AC_SUBST(PACKAGE_URL, [http://wcohen.fedorapeople.org/git/memstomp/]) + +diff -Nrup a/testsuite/memstomp.nooverlap/memccpy.c b/testsuite/memstomp.nooverlap/memccpy.c +--- a/testsuite/memstomp.nooverlap/memccpy.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.nooverlap/memccpy.c 2013-03-11 14:13:05.000000000 -0600 +@@ -0,0 +1,20 @@ ++#define _GNU_SOURCE ++#include ++#include ++ ++#ifndef MEMCCPY ++#define MEMCCPY memccpy ++#define TYPE char ++#endif ++ ++TYPE arr1[10] = {0}; ++TYPE arr2[10] = {0}; ++TYPE *p1 = &arr1[0]; ++TYPE *p2 = &arr2[1]; ++size_t count = 9; ++main () ++{ ++ MEMCCPY (p1, p2, -1, count); ++} ++ ++ +diff -Nrup a/testsuite/memstomp.nooverlap/memcpy.c b/testsuite/memstomp.nooverlap/memcpy.c +--- a/testsuite/memstomp.nooverlap/memcpy.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.nooverlap/memcpy.c 2013-03-11 14:12:57.000000000 -0600 +@@ -0,0 +1,20 @@ ++#define _GNU_SOURCE ++#include ++#include ++ ++#ifndef MEMCPY ++#define MEMCPY memcpy ++#define TYPE char ++#endif ++ ++TYPE arr1[10] = {0}; ++TYPE arr2[10] = {0}; ++TYPE *p1 = &arr1[0]; ++TYPE *p2 = &arr2[1]; ++size_t count = 9; ++main () ++{ ++ MEMCPY (p1, p2, count); ++} ++ ++ +diff -Nrup a/testsuite/memstomp.nooverlap/mempcpy.c b/testsuite/memstomp.nooverlap/mempcpy.c +--- a/testsuite/memstomp.nooverlap/mempcpy.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.nooverlap/mempcpy.c 2013-03-11 13:54:25.000000000 -0600 +@@ -0,0 +1,3 @@ ++#define MEMCPY mempcpy ++#define TYPE char ++#include "memcpy.c" +diff -Nrup a/testsuite/memstomp.nooverlap/stpcpy.c b/testsuite/memstomp.nooverlap/stpcpy.c +--- a/testsuite/memstomp.nooverlap/stpcpy.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.nooverlap/stpcpy.c 2013-03-11 13:38:53.000000000 -0600 +@@ -0,0 +1,2 @@ ++#define STRCPY stpcpy ++#include "strcpy.c" +diff -Nrup a/testsuite/memstomp.nooverlap/stpncpy.c b/testsuite/memstomp.nooverlap/stpncpy.c +--- a/testsuite/memstomp.nooverlap/stpncpy.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.nooverlap/stpncpy.c 2013-03-11 13:38:53.000000000 -0600 +@@ -0,0 +1,2 @@ ++#define STRNCPY stpncpy ++#include "strncpy.c" +diff -Nrup a/testsuite/memstomp.nooverlap/strcat.c b/testsuite/memstomp.nooverlap/strcat.c +--- a/testsuite/memstomp.nooverlap/strcat.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.nooverlap/strcat.c 2013-03-11 13:38:53.000000000 -0600 +@@ -0,0 +1,2 @@ ++#define STRCPY strcat ++#include "strcpy.c" +diff -Nrup a/testsuite/memstomp.nooverlap/strcpy.c b/testsuite/memstomp.nooverlap/strcpy.c +--- a/testsuite/memstomp.nooverlap/strcpy.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.nooverlap/strcpy.c 2013-03-11 14:01:12.000000000 -0600 +@@ -0,0 +1,19 @@ ++#define _GNU_SOURCE ++#include ++#include ++ ++#ifndef STRCPY ++#define STRCPY strcpy ++#endif ++ ++ ++char arr1[32] = "this is a test"; ++char arr2[32] = "this is a test"; ++char *p1 = &arr1[0]; ++char *p2 = &arr2[1]; ++main () ++{ ++ STRCPY (p2, p1); ++} ++ ++ +diff -Nrup a/testsuite/memstomp.nooverlap/strncat.c b/testsuite/memstomp.nooverlap/strncat.c +--- a/testsuite/memstomp.nooverlap/strncat.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.nooverlap/strncat.c 2013-03-11 13:38:53.000000000 -0600 +@@ -0,0 +1,2 @@ ++#define STRNCPY strncat ++#include "strncpy.c" +diff -Nrup a/testsuite/memstomp.nooverlap/strncpy.c b/testsuite/memstomp.nooverlap/strncpy.c +--- a/testsuite/memstomp.nooverlap/strncpy.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.nooverlap/strncpy.c 2013-03-11 14:00:47.000000000 -0600 +@@ -0,0 +1,19 @@ ++#define _GNU_SOURCE ++#include ++#include ++ ++#ifndef STRNCPY ++#define STRNCPY strncpy ++#endif ++ ++ ++char arr1[32] = "this is a test"; ++char arr2[32] = "this is a test"; ++char *p1 = &arr1[0]; ++char *p2 = &arr2[1]; ++main () ++{ ++ STRNCPY (p1, p2, strlen (p2)); ++} ++ ++ +diff -Nrup a/testsuite/memstomp.nooverlap/wcscat.c b/testsuite/memstomp.nooverlap/wcscat.c +--- a/testsuite/memstomp.nooverlap/wcscat.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.nooverlap/wcscat.c 2013-03-11 13:38:53.000000000 -0600 +@@ -0,0 +1,2 @@ ++#define WCSCPY wcscat ++#include "wcscpy.c" +diff -Nrup a/testsuite/memstomp.nooverlap/wcscpy.c b/testsuite/memstomp.nooverlap/wcscpy.c +--- a/testsuite/memstomp.nooverlap/wcscpy.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.nooverlap/wcscpy.c 2013-03-11 14:01:22.000000000 -0600 +@@ -0,0 +1,19 @@ ++#define _GNU_SOURCE ++#include ++#include ++ ++#ifndef WCSCPY ++#define WCSCPY wcscpy ++#endif ++ ++ ++wchar_t arr1[32] = L"this is a test"; ++wchar_t arr2[32] = L"this is a test"; ++wchar_t *p1 = &arr1[0]; ++wchar_t *p2 = &arr2[1]; ++main () ++{ ++ WCSCPY (p1, p2); ++} ++ ++ +diff -Nrup a/testsuite/memstomp.nooverlap/wcsncat.c b/testsuite/memstomp.nooverlap/wcsncat.c +--- a/testsuite/memstomp.nooverlap/wcsncat.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.nooverlap/wcsncat.c 2013-03-11 13:38:53.000000000 -0600 +@@ -0,0 +1,2 @@ ++#define WCSNCPY wcsncat ++#include "wcsncpy.c" +diff -Nrup a/testsuite/memstomp.nooverlap/wcsncpy.c b/testsuite/memstomp.nooverlap/wcsncpy.c +--- a/testsuite/memstomp.nooverlap/wcsncpy.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.nooverlap/wcsncpy.c 2013-03-11 14:01:26.000000000 -0600 +@@ -0,0 +1,19 @@ ++#define _GNU_SOURCE ++#include ++#include ++ ++#ifndef WCSNCPY ++#define WCSNCPY wcsncpy ++#endif ++ ++ ++wchar_t arr1[32] = L"this is a test"; ++wchar_t arr2[32] = L"this is a test"; ++wchar_t *p1 = &arr1[0]; ++wchar_t *p2 = &arr2[1]; ++main () ++{ ++ WCSNCPY (p1, p2, wcslen (p2)); ++} ++ ++ +diff -Nrup a/testsuite/memstomp.nooverlap/wmemcpy.c b/testsuite/memstomp.nooverlap/wmemcpy.c +--- a/testsuite/memstomp.nooverlap/wmemcpy.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.nooverlap/wmemcpy.c 2013-03-11 13:54:32.000000000 -0600 +@@ -0,0 +1,3 @@ ++#define MEMCPY wmemcpy ++#define TYPE wchar_t ++#include "memcpy.c" +diff -Nrup a/testsuite/memstomp.nooverlap/wmempcpy.c b/testsuite/memstomp.nooverlap/wmempcpy.c +--- a/testsuite/memstomp.nooverlap/wmempcpy.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.nooverlap/wmempcpy.c 2013-03-11 13:54:38.000000000 -0600 +@@ -0,0 +1,3 @@ ++#define MEMCPY wmempcpy ++#define TYPE wchar_t ++#include "memcpy.c" +diff -Nrup a/testsuite/memstomp.overlap/memccpy-2.c b/testsuite/memstomp.overlap/memccpy-2.c +--- a/testsuite/memstomp.overlap/memccpy-2.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.overlap/memccpy-2.c 2013-03-11 14:12:34.000000000 -0600 +@@ -0,0 +1,19 @@ ++#define _GNU_SOURCE ++#include ++#include ++ ++#ifndef MEMCCPY ++#define MEMCCPY memccpy ++#define TYPE char ++#endif ++ ++TYPE arr[10] = {0}; ++TYPE *p1 = &arr[0]; ++TYPE *p2 = &arr[1]; ++size_t count = 9; ++main () ++{ ++ MEMCCPY (p2, p1, -1, count); ++} ++ ++ +diff -Nrup a/testsuite/memstomp.overlap/memccpy.c b/testsuite/memstomp.overlap/memccpy.c +--- a/testsuite/memstomp.overlap/memccpy.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.overlap/memccpy.c 2013-03-11 14:12:41.000000000 -0600 +@@ -0,0 +1,19 @@ ++#define _GNU_SOURCE ++#include ++#include ++ ++#ifndef MEMCCPY ++#define MEMCCPY memccpy ++#define TYPE char ++#endif ++ ++TYPE arr[10] = {0}; ++TYPE *p1 = &arr[0]; ++TYPE *p2 = &arr[1]; ++size_t count = 9; ++main () ++{ ++ MEMCCPY (p1, p2, -1, count); ++} ++ ++ +diff -Nrup a/testsuite/memstomp.overlap/memcpy-2.c b/testsuite/memstomp.overlap/memcpy-2.c +--- a/testsuite/memstomp.overlap/memcpy-2.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.overlap/memcpy-2.c 2013-03-11 14:12:26.000000000 -0600 +@@ -0,0 +1,19 @@ ++#define _GNU_SOURCE ++#include ++#include ++ ++#ifndef MEMCPY ++#define MEMCPY memcpy ++#define TYPE char ++#endif ++ ++TYPE arr[10] = {0}; ++TYPE *p1 = &arr[0]; ++TYPE *p2 = &arr[1]; ++size_t count = 9; ++main () ++{ ++ MEMCPY (p2, p1, count); ++} ++ ++ +diff -Nrup a/testsuite/memstomp.overlap/memcpy.c b/testsuite/memstomp.overlap/memcpy.c +--- a/testsuite/memstomp.overlap/memcpy.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.overlap/memcpy.c 2013-03-11 14:12:20.000000000 -0600 +@@ -0,0 +1,19 @@ ++#define _GNU_SOURCE ++#include ++#include ++ ++#ifndef MEMCPY ++#define MEMCPY memcpy ++#define TYPE char ++#endif ++ ++TYPE arr[10] = {0}; ++TYPE *p1 = &arr[0]; ++TYPE *p2 = &arr[1]; ++size_t count = 9; ++main () ++{ ++ MEMCPY (p1, p2, count); ++} ++ ++ +diff -Nrup a/testsuite/memstomp.overlap/mempcpy-2.c b/testsuite/memstomp.overlap/mempcpy-2.c +--- a/testsuite/memstomp.overlap/mempcpy-2.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.overlap/mempcpy-2.c 2013-03-11 13:52:51.000000000 -0600 +@@ -0,0 +1,3 @@ ++#define MEMCPY mempcpy ++#define TYPE char ++#include "memcpy-2.c" +diff -Nrup a/testsuite/memstomp.overlap/mempcpy.c b/testsuite/memstomp.overlap/mempcpy.c +--- a/testsuite/memstomp.overlap/mempcpy.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.overlap/mempcpy.c 2013-03-11 13:53:10.000000000 -0600 +@@ -0,0 +1,3 @@ ++#define MEMCPY mempcpy ++#define TYPE char ++#include "memcpy.c" +diff -Nrup a/testsuite/memstomp.overlap/stpcpy-2.c b/testsuite/memstomp.overlap/stpcpy-2.c +--- a/testsuite/memstomp.overlap/stpcpy-2.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.overlap/stpcpy-2.c 2013-03-11 13:26:50.000000000 -0600 +@@ -0,0 +1,2 @@ ++#define STRCPY stpcpy ++#include "strcpy-2.c" +diff -Nrup a/testsuite/memstomp.overlap/stpcpy.c b/testsuite/memstomp.overlap/stpcpy.c +--- a/testsuite/memstomp.overlap/stpcpy.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.overlap/stpcpy.c 2013-03-05 15:36:43.000000000 -0700 +@@ -0,0 +1,2 @@ ++#define STRCPY stpcpy ++#include "strcpy.c" +diff -Nrup a/testsuite/memstomp.overlap/stpncpy-2.c b/testsuite/memstomp.overlap/stpncpy-2.c +--- a/testsuite/memstomp.overlap/stpncpy-2.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.overlap/stpncpy-2.c 2013-03-11 13:27:02.000000000 -0600 +@@ -0,0 +1,2 @@ ++#define STRNCPY stpncpy ++#include "strncpy-2.c" +diff -Nrup a/testsuite/memstomp.overlap/stpncpy.c b/testsuite/memstomp.overlap/stpncpy.c +--- a/testsuite/memstomp.overlap/stpncpy.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.overlap/stpncpy.c 2013-03-05 15:37:22.000000000 -0700 +@@ -0,0 +1,2 @@ ++#define STRNCPY stpncpy ++#include "strncpy.c" +diff -Nrup a/testsuite/memstomp.overlap/strcat-2.c b/testsuite/memstomp.overlap/strcat-2.c +--- a/testsuite/memstomp.overlap/strcat-2.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.overlap/strcat-2.c 2013-03-11 13:27:10.000000000 -0600 +@@ -0,0 +1,2 @@ ++#define STRCPY strcat ++#include "strcpy-2.c" +diff -Nrup a/testsuite/memstomp.overlap/strcat.c b/testsuite/memstomp.overlap/strcat.c +--- a/testsuite/memstomp.overlap/strcat.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.overlap/strcat.c 2013-03-05 15:38:38.000000000 -0700 +@@ -0,0 +1,2 @@ ++#define STRCPY strcat ++#include "strcpy.c" +diff -Nrup a/testsuite/memstomp.overlap/strcpy-2.c b/testsuite/memstomp.overlap/strcpy-2.c +--- a/testsuite/memstomp.overlap/strcpy-2.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.overlap/strcpy-2.c 2013-03-11 14:01:54.000000000 -0600 +@@ -0,0 +1,18 @@ ++#define _GNU_SOURCE ++#include ++#include ++ ++#ifndef STRCPY ++#define STRCPY strcpy ++#endif ++ ++ ++char arr[32] = "this is a test"; ++char *p1 = &arr[0]; ++char *p2 = &arr[1]; ++main () ++{ ++ STRCPY (p1, p2); ++} ++ ++ +diff -Nrup a/testsuite/memstomp.overlap/strcpy.c b/testsuite/memstomp.overlap/strcpy.c +--- a/testsuite/memstomp.overlap/strcpy.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.overlap/strcpy.c 2013-03-11 14:01:58.000000000 -0600 +@@ -0,0 +1,18 @@ ++#define _GNU_SOURCE ++#include ++#include ++ ++#ifndef STRCPY ++#define STRCPY strcpy ++#endif ++ ++ ++char arr[32] = "this is a test"; ++char *p1 = &arr[0]; ++char *p2 = &arr[1]; ++main () ++{ ++ STRCPY (p2, p1); ++} ++ ++ +diff -Nrup a/testsuite/memstomp.overlap/strncat-2.c b/testsuite/memstomp.overlap/strncat-2.c +--- a/testsuite/memstomp.overlap/strncat-2.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.overlap/strncat-2.c 2013-03-11 13:27:47.000000000 -0600 +@@ -0,0 +1,2 @@ ++#define STRNCPY strncat ++#include "strncpy-2.c" +diff -Nrup a/testsuite/memstomp.overlap/strncat.c b/testsuite/memstomp.overlap/strncat.c +--- a/testsuite/memstomp.overlap/strncat.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.overlap/strncat.c 2013-03-05 15:38:56.000000000 -0700 +@@ -0,0 +1,2 @@ ++#define STRNCPY strncat ++#include "strncpy.c" +diff -Nrup a/testsuite/memstomp.overlap/strncpy-2.c b/testsuite/memstomp.overlap/strncpy-2.c +--- a/testsuite/memstomp.overlap/strncpy-2.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.overlap/strncpy-2.c 2013-03-11 14:02:00.000000000 -0600 +@@ -0,0 +1,18 @@ ++#define _GNU_SOURCE ++#include ++#include ++ ++#ifndef STRNCPY ++#define STRNCPY strncpy ++#endif ++ ++ ++char arr[32] = "this is a test"; ++char *p1 = &arr[0]; ++char *p2 = &arr[1]; ++main () ++{ ++ STRNCPY (p2, p1, strlen (p1)); ++} ++ ++ +diff -Nrup a/testsuite/memstomp.overlap/strncpy.c b/testsuite/memstomp.overlap/strncpy.c +--- a/testsuite/memstomp.overlap/strncpy.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.overlap/strncpy.c 2013-03-11 14:02:40.000000000 -0600 +@@ -0,0 +1,18 @@ ++#define _GNU_SOURCE ++#include ++#include ++ ++#ifndef STRNCPY ++#define STRNCPY strncpy ++#endif ++ ++ ++char arr[32] = "this is a test"; ++char *p1 = &arr[0]; ++char *p2 = &arr[1]; ++main () ++{ ++ STRNCPY (p1, p2, strlen (p2)); ++} ++ ++ +diff -Nrup a/testsuite/memstomp.overlap/wcscat-2.c b/testsuite/memstomp.overlap/wcscat-2.c +--- a/testsuite/memstomp.overlap/wcscat-2.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.overlap/wcscat-2.c 2013-03-11 13:34:04.000000000 -0600 +@@ -0,0 +1,2 @@ ++#define WCSCPY wcscat ++#include "wcscpy-2.c" +diff -Nrup a/testsuite/memstomp.overlap/wcscat.c b/testsuite/memstomp.overlap/wcscat.c +--- a/testsuite/memstomp.overlap/wcscat.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.overlap/wcscat.c 2013-03-11 13:33:44.000000000 -0600 +@@ -0,0 +1,2 @@ ++#define WCSCPY wcscat ++#include "wcscpy.c" +diff -Nrup a/testsuite/memstomp.overlap/wcscpy-2.c b/testsuite/memstomp.overlap/wcscpy-2.c +--- a/testsuite/memstomp.overlap/wcscpy-2.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.overlap/wcscpy-2.c 2013-03-11 14:02:06.000000000 -0600 +@@ -0,0 +1,18 @@ ++#define _GNU_SOURCE ++#include ++#include ++ ++#ifndef WCSCPY ++#define WCSCPY wcscpy ++#endif ++ ++ ++wchar_t arr[32] = L"this is a test"; ++wchar_t *p1 = &arr[0]; ++wchar_t *p2 = &arr[1]; ++main () ++{ ++ WCSCPY (p2, p1); ++} ++ ++ +diff -Nrup a/testsuite/memstomp.overlap/wcscpy.c b/testsuite/memstomp.overlap/wcscpy.c +--- a/testsuite/memstomp.overlap/wcscpy.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.overlap/wcscpy.c 2013-03-11 14:02:10.000000000 -0600 +@@ -0,0 +1,18 @@ ++#define _GNU_SOURCE ++#include ++#include ++ ++#ifndef WCSCPY ++#define WCSCPY wcscpy ++#endif ++ ++ ++wchar_t arr[32] = L"this is a test"; ++wchar_t *p1 = &arr[0]; ++wchar_t *p2 = &arr[1]; ++main () ++{ ++ WCSCPY (p1, p2); ++} ++ ++ +diff -Nrup a/testsuite/memstomp.overlap/wcsncat.c b/testsuite/memstomp.overlap/wcsncat.c +--- a/testsuite/memstomp.overlap/wcsncat.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.overlap/wcsncat.c 2013-03-11 13:34:37.000000000 -0600 +@@ -0,0 +1,2 @@ ++#define WCSNCPY wcsncat ++#include "wcsncpy.c" +diff -Nrup a/testsuite/memstomp.overlap/wcsncpy-2.c b/testsuite/memstomp.overlap/wcsncpy-2.c +--- a/testsuite/memstomp.overlap/wcsncpy-2.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.overlap/wcsncpy-2.c 2013-03-11 14:02:13.000000000 -0600 +@@ -0,0 +1,18 @@ ++#define _GNU_SOURCE ++#include ++#include ++ ++#ifndef WCSNCPY ++#define WCSNCPY wcsncpy ++#endif ++ ++ ++wchar_t arr[32] = L"this is a test"; ++wchar_t *p1 = &arr[0]; ++wchar_t *p2 = &arr[1]; ++main () ++{ ++ WCSNCPY (p2, p1, wcslen (p2)); ++} ++ ++ +diff -Nrup a/testsuite/memstomp.overlap/wcsncpy.c b/testsuite/memstomp.overlap/wcsncpy.c +--- a/testsuite/memstomp.overlap/wcsncpy.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.overlap/wcsncpy.c 2013-03-11 14:02:19.000000000 -0600 +@@ -0,0 +1,18 @@ ++#define _GNU_SOURCE ++#include ++#include ++ ++#ifndef WCSNCPY ++#define WCSNCPY wcsncpy ++#endif ++ ++ ++wchar_t arr[32] = L"this is a test"; ++wchar_t *p1 = &arr[0]; ++wchar_t *p2 = &arr[1]; ++main () ++{ ++ WCSNCPY (p1, p2, wcslen (p2)); ++} ++ ++ +diff -Nrup a/testsuite/memstomp.overlap/wmemcpy-2.c b/testsuite/memstomp.overlap/wmemcpy-2.c +--- a/testsuite/memstomp.overlap/wmemcpy-2.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.overlap/wmemcpy-2.c 2013-03-11 13:53:21.000000000 -0600 +@@ -0,0 +1,3 @@ ++#define MEMCPY wmemcpy ++#define TYPE wchar_t ++#include "memcpy-2.c" +diff -Nrup a/testsuite/memstomp.overlap/wmemcpy.c b/testsuite/memstomp.overlap/wmemcpy.c +--- a/testsuite/memstomp.overlap/wmemcpy.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.overlap/wmemcpy.c 2013-03-11 13:51:10.000000000 -0600 +@@ -0,0 +1,3 @@ ++#define MEMCPY wmemcpy ++#define TYPE wchar_t ++#include "memcpy.c" +diff -Nrup a/testsuite/memstomp.overlap/wmempcpy-2.c b/testsuite/memstomp.overlap/wmempcpy-2.c +--- a/testsuite/memstomp.overlap/wmempcpy-2.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.overlap/wmempcpy-2.c 2013-03-11 13:53:32.000000000 -0600 +@@ -0,0 +1,3 @@ ++#define MEMCPY wmempcpy ++#define TYPE wchar_t ++#include "memcpy-2.c" +diff -Nrup a/testsuite/memstomp.overlap/wmempcpy.c b/testsuite/memstomp.overlap/wmempcpy.c +--- a/testsuite/memstomp.overlap/wmempcpy.c 1969-12-31 17:00:00.000000000 -0700 ++++ b/testsuite/memstomp.overlap/wmempcpy.c 2013-03-11 13:51:14.000000000 -0600 +@@ -0,0 +1,3 @@ ++#define MEMCPY wmempcpy ++#define TYPE wchar_t ++#include "memcpy.c" +--- /dev/null 2013-02-26 15:11:24.372721019 -0700 ++++ b/testsuite/lib/memstomp.exp 2013-03-11 21:37:45.680005590 -0600 +@@ -0,0 +1,15 @@ ++proc find_memstomp {} { ++ global tool_root_dir ++ global base_dir ++ ++ set file [findfile $base_dir/../memstomp $base_dir/../memstomp memstomp] ++ return $file ++} ++ ++proc find_libmemstomp {} { ++ global tool_root_dir ++ global base_dir ++ ++ set file [findfile $base_dir/../.libs/libmemstomp.so $base_dir/../.libs/libmemstomp.so libmemstomp.so] ++ return $file ++} +--- /dev/null 2013-02-26 15:11:24.372721019 -0700 ++++ b/testsuite/memstomp.overlap/overlap.exp 2013-03-11 21:38:02.207939417 -0600 +@@ -0,0 +1,59 @@ ++# Copyright (C) 2013 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with GCC; see the file COPYING3. If not see ++# . ++# ++# This was originally copied from GCC's dejagnu testing framework ++# ++ ++load_lib memstomp.exp ++set memstomp [find_memstomp] ++set libmemstomp [find_libmemstomp] ++ ++if $tracelevel then { ++ strace $tracelevel ++} ++ ++# ++# main test loop ++# ++ ++proc compile-and-execute { sources } { ++ global memstomp ++ global libmemstomp ++ ++ set src [lindex $sources 0] ++ ++ if {[catch {exec gcc -fno-builtin $src} results]} { ++ fail "$src compilation $results" ++ } else { ++ pass "$src compilation $results" ++ } ++ ++ catch {exec /bin/bash -c "LD_PRELOAD=$libmemstomp $memstomp ./a.out"} results ++ if {[regexp "overlap for a.out" $results]} { ++ pass "$src found overlap $results" ++ } else { ++ fail "$src found overlap $results" ++ } ++} ++ ++foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]] { ++ # If we're only testing specific files and this isn't one of them, skip it. ++ if ![runtest_file_p $runtests $src] then { ++ continue ++ } ++ ++ compile-and-execute $src ++} +--- /dev/null 2013-02-26 15:11:24.372721019 -0700 ++++ b/testsuite/memstomp.nooverlap/nooverlap.exp 2013-03-11 21:39:20.352626597 -0600 +@@ -0,0 +1,55 @@ ++# Copyright (C) 2013 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with GCC; see the file COPYING3. If not see ++# . ++# ++# This was originally copied from GCC's dejagnu testing framework ++# ++load_lib memstomp.exp ++set memstomp [find_memstomp] ++set libmemstomp [find_libmemstomp] ++ ++if $tracelevel then { ++ strace $tracelevel ++} ++ ++# ++# main test loop ++# ++ ++proc compile-and-execute { sources } { ++ global memstomp ++ set src [lindex $sources 0] ++ ++ if {[catch {exec gcc -fno-builtin $src} results]} { ++ fail "$src compilation $results" ++ } else { ++ pass "$src compilation $results" ++ } ++ catch {exec /bin/bash -c "LD_PRELOAD=$libmemstomp $memstomp ./a.out"} results ++ if {[regexp "overlap for a.out" $results]} { ++ fail "$src found no overlap $results" ++ } else { ++ pass "$src found no overlap $results" ++ } ++} ++ ++foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]] { ++ # If we're only testing specific files and this isn't one of them, skip it. ++ if ![runtest_file_p $runtests $src] then { ++ continue ++ } ++ ++ compile-and-execute $src ++} diff --git a/SPECS/memstomp.spec b/SPECS/memstomp.spec new file mode 100644 index 0000000..9816374 --- /dev/null +++ b/SPECS/memstomp.spec @@ -0,0 +1,83 @@ +%{?scl:%{?scl_package:%scl_package binutils}} + +%global githash 38573e7d +Name: %{?scl_prefix}memstomp +Version: 0.1.5 +Release: 6%{?dist} +Summary: Warns of memory argument overlaps to various functions +Group: Development/Debuggers +# The entire source code is LGPLV3+ with the exception of backtrace-symbols.c which +# is GPLv2+ by way of being a hacked up old version of binutils's addr2line. +# backtrace-symbols.c is built into an independent .so to avoid license contamination +License: LGPLv3+ and GPLv2+ +URL: git://fedorapeople.org/home/fedora/wcohen/public_git/memstomp +# The source for this package was pulled from upstream's vcs. Use the +# following commands to generate the tarball: +# git clone git://fedorapeople.org/home/fedora/wcohen/public_git/memstomp +# cd memstomp +# git archive --prefix memstomp-0.1.5-38573e7d/ master | gzip > memstomp-0.1.5-38573e7d.tar.gz +Source0: memstomp-%{version}-%{githash}.tar.gz +Requires: util-linux +BuildRequires: binutils-devel autoconf automake dejagnu +BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) + +Patch0: memstomp-testsuite.patch +Patch1: memstomp-man.patch +Patch2: memstomp-rh961495.patch +Patch3: memstomp-rh962763.patch +Patch4: memstomp-quietmode.patch +Patch5: memstomp-rh1093173.patch +Patch6: memstomp-rh1133815.patch +Patch7: memstomp-implicit-int.patch + + +%define alternatives_cmd %{!?scl:%{_sbindir}}%{?scl:%{_root_sbindir}}/alternatives +%define alternatives_cmdline %{alternatives_cmd}%{?scl: --altdir %{_sysconfdir}/alternatives --admindir %{_scl_root}/var/lib/alternatives} + +%{?scl:Requires:%scl_runtime} + + +%description +memstomp is a simple program that can be used to identify +places in code which trigger undefined behavior due to +overlapping memory arguments to certain library calls. + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%prep +%setup -q -n memstomp-%{version}-%{githash} +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 + + +%build +autoreconf +%configure +# We force -O0 here because memstomp essentially relies on GCC +# not removing any of its checks. GCC continues to get better +# and twarting its optimizer isn't something I have any interest +# in maintaining over time. So just force -O0 for stupid code +# generation. +make %{?_smp_mflags} CFLAGS+="-O0 -fno-strict-aliasing" +make -k check + +%install +make install DESTDIR=$RPM_BUILD_ROOT + +%files +%doc README LGPL3 GPL2 GPL3 +%{_bindir}/memstomp +%{_libdir}/libmemstomp.so +%{_libdir}/libmemstomp-backtrace-symbols.so +%{_mandir}/man1/memstomp.1.gz + +%changelog +* Tue Jul 28 2020 Jeff Law 0.1.5-6 +- Rebuild for DTS 10