diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/bfd-api-change.patch b/bfd-api-change.patch new file mode 100644 index 0000000..7503183 --- /dev/null +++ b/bfd-api-change.patch @@ -0,0 +1,22 @@ +diff --git a/backtrace-symbols.c b/backtrace-symbols.c +index 0176e3f..5384e2e 100644 +--- a/backtrace-symbols.c ++++ b/backtrace-symbols.c +@@ -124,14 +124,14 @@ static void find_address_in_section( + if (arg->found) + return; + +- if ((bfd_get_section_flags(abfd, section) & SEC_ALLOC) == 0) ++ if ((bfd_section_flags(section) & SEC_ALLOC) == 0) + return; + +- bfd_vma const vma = bfd_get_section_vma(abfd, section); ++ bfd_vma const vma = bfd_section_vma(section); + if (arg->pc < vma) + return; + +- bfd_size_type const size = bfd_section_size(abfd, section); ++ bfd_size_type const size = bfd_section_size(section); + if (arg->pc >= vma + size) + return; + diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..ce3cdc1 --- /dev/null +++ b/gating.yaml @@ -0,0 +1,19 @@ +--- !Policy +product_versions: + - fedora-* +decision_context: bodhi_update_push_stable +subject_type: koji_build +rules: + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional} +--- !Policy +product_versions: + - rhel-8 +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional} +--- !Policy +product_versions: + - rhel-9 +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional} diff --git a/memstomp-PTR.patch b/memstomp-PTR.patch new file mode 100644 index 0000000..0afb7d8 --- /dev/null +++ b/memstomp-PTR.patch @@ -0,0 +1,17 @@ +diff --git a/backtrace-symbols.c b/backtrace-symbols.c +index 5384e2e..9fc464a 100644 +--- a/backtrace-symbols.c ++++ b/backtrace-symbols.c +@@ -90,10 +90,10 @@ static asymbol **slurp_symtab(bfd *const abfd) + return syms; + + unsigned int size; +- long symcount = bfd_read_minisymbols(abfd, false, (PTR) & syms, &size); ++ long symcount = bfd_read_minisymbols(abfd, false, (void *) & syms, &size); + if (symcount == 0) + symcount = bfd_read_minisymbols(abfd, true /* dynamic */ , +- (PTR) & syms, &size); ++ (void *) & syms, &size); + + if (symcount < 0) + bfd_fatal(bfd_get_filename(abfd)); diff --git a/memstomp-implicit-int.patch b/memstomp-implicit-int.patch new file mode 100644 index 0000000..340a75a --- /dev/null +++ b/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/memstomp-rh1133815.patch b/memstomp-rh1133815.patch new file mode 100644 index 0000000..5f05de9 --- /dev/null +++ b/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/memstomp-sframe.patch b/memstomp-sframe.patch new file mode 100644 index 0000000..b0091eb --- /dev/null +++ b/memstomp-sframe.patch @@ -0,0 +1,12 @@ +diff -up memstomp-0.1.4-38573e7d/configure.ac.orig memstomp-0.1.4-38573e7d/configure.ac +--- memstomp-0.1.4-38573e7d/configure.ac.orig 2023-03-06 14:07:57.086183046 -0500 ++++ memstomp-0.1.4-38573e7d/configure.ac 2023-03-06 14:16:31.513215306 -0500 +@@ -76,6 +76,8 @@ AC_SEARCH_LIBS([htab_find_slot], [iberty + 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([*** bfd.h header not found])]) ++# Newer binutils-2.40 also need to link with sframe library ++AC_SEARCH_LIBS(sframe_decode, sframe) + + #### Typdefs, structures, etc. #### + diff --git a/memstomp.spec b/memstomp.spec index fbc62c0..9f47afa 100644 --- a/memstomp.spec +++ b/memstomp.spec @@ -1,13 +1,14 @@ %global githash 38573e7d + Name: memstomp Version: 0.1.4 -Release: 14%{?dist} +Release: 44%{?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+ +# Automatically converted from old format: LGPLv3+ and GPLv2+ - review is highly recommended. +License: LGPL-3.0-or-later AND GPL-2.0-or-later 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: @@ -16,6 +17,8 @@ URL: git://fedorapeople.org/home/fedora/wcohen/public_git/memstomp # git archive --prefix memstomp-0.1.4-38573e7d/ master | gzip > memstomp-0.1.4-3867e37d.tar.gz Source0: %{name}-%{version}-%{githash}.tar.gz Requires: util-linux +BuildRequires: make +BuildRequires: gcc BuildRequires: binutils-devel autoconf automake dejagnu Patch0: memstomp-testsuite.patch @@ -24,6 +27,11 @@ 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 +Patch8: bfd-api-change.patch +Patch9: memstomp-PTR.patch +Patch10: memstomp-sframe.patch %description @@ -31,23 +39,32 @@ 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 +%ldconfig_scriptlets %prep %setup -q -n %{name}-%{version}-%{githash} -%patch0 -p1 -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 -%patch5 -p1 +%patch -P0 -p1 +%patch -P1 -p1 +%patch -P2 -p1 +%patch -P3 -p1 +%patch -P4 -p1 +%patch -P5 -p1 +%patch -P6 -p1 +%patch -P7 -p1 +%patch -P8 -p1 +%patch -P9 -p1 +%patch -P10 -p1 %build autoreconf %configure -make %{?_smp_mflags} CFLAGS+="-fno-strict-aliasing" +# 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 @@ -61,6 +78,99 @@ make install DESTDIR=$RPM_BUILD_ROOT %{_mandir}/man1/memstomp.1.gz %changelog +* Thu Jul 24 2025 Fedora Release Engineering - 0.1.4-44 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + +* Fri Jan 17 2025 Fedora Release Engineering - 0.1.4-43 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + +* Wed Aug 07 2024 Miroslav Suchý - 0.1.4-42 +- convert license to SPDX + +* Thu Jul 18 2024 Fedora Release Engineering - 0.1.4-41 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Thu Jan 25 2024 Fedora Release Engineering - 0.1.4-40 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Sun Jan 21 2024 Fedora Release Engineering - 0.1.4-39 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Thu Jul 20 2023 Fedora Release Engineering - 0.1.4-38 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Mon Mar 6 2023 William Cohen - 0.1.4-37 +- Link in binutils sframe library when available to fix FTBFS. (rhbz#2171607) + +* Mon Feb 20 2023 Jeff Law - 0.1.4-36 +- Fix for libibery no longer providing PTR + (#2171607) + +* Thu Jan 19 2023 Fedora Release Engineering - 0.1.4-35 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Thu Jul 21 2022 Fedora Release Engineering - 0.1.4-34 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Thu Jan 20 2022 Fedora Release Engineering - 0.1.4-33 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Thu Jul 22 2021 Fedora Release Engineering - 0.1.4-32 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Tue Jan 26 2021 Fedora Release Engineering - 0.1.4-31 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Tue Jul 28 2020 Fedora Release Engineering - 0.1.4-30 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Mon May 18 2020 Jeff Law - 0.1.4-29 +- Various fixes for API changes in bfd + +* Wed Jan 29 2020 Fedora Release Engineering - 0.1.4-28 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Thu Jul 25 2019 Fedora Release Engineering - 0.1.4-27 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Fri Feb 01 2019 Fedora Release Engineering - 0.1.4-26 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Fri Jul 13 2018 Fedora Release Engineering - 0.1.4-25 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Thu Feb 08 2018 Fedora Release Engineering - 0.1.4-24 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Thu Aug 03 2017 Fedora Release Engineering - 0.1.4-23 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - 0.1.4-22 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Fri Feb 10 2017 Fedora Release Engineering - 0.1.4-21 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Mon May 9 2016 Jeff Law - 0.1.4-20 +- Remove xfail for aarch64 in testsuite (#1334124) + +* Wed Feb 17 2016 Jeff Law - 0.1.4-19 +- Build with -O0 to avoid GCC optimizing away checks we want to keep. + (#1307767) + +* Thu Feb 04 2016 Fedora Release Engineering - 0.1.4-18 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Wed Jun 17 2015 Fedora Release Engineering - 0.1.4-17 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Tue May 26 2015 Jeff Law 0.1.4-16 +- Fixup implicit return types in testsuite. + +* Tue Aug 26 2014 Jeff Law 0.1.4-15 +- Adjust PC values in saved frame addresses to get line number + associations correct (#1133815). + * Sun Aug 17 2014 Fedora Release Engineering - 0.1.4-14 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild diff --git a/plans/ci.fmf b/plans/ci.fmf new file mode 100644 index 0000000..1ad2c12 --- /dev/null +++ b/plans/ci.fmf @@ -0,0 +1,6 @@ +summary: CI Gating Plan +discover: + how: fmf + directory: tests +execute: + how: beakerlib diff --git a/tests/Sanity/memstomp-testsuite/Makefile b/tests/Sanity/memstomp-testsuite/Makefile new file mode 100644 index 0000000..189fbe8 --- /dev/null +++ b/tests/Sanity/memstomp-testsuite/Makefile @@ -0,0 +1,64 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/memstomp/Sanity/memstomp-testsuite +# Description: Runs memstomp testsuite on installed packages +# Author: Miroslav Franc +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2013 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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 this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/tools/memstomp/Sanity/memstomp-testsuite +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + test -x runtest.sh || chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Miroslav Franc " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: Runs memstomp testsuite on installed packages" >> $(METADATA) + @echo "Type: Sanity" >> $(METADATA) + @echo "TestTime: 15m" >> $(METADATA) + @echo "RunFor: memstomp" >> $(METADATA) + @echo "Requires: autoconf automake binutils-devel dejagnu gcc gcc-c++ glibc-devel memstomp rpm-build" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5 -RHEL8 -RHEL9" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/Sanity/memstomp-testsuite/PURPOSE b/tests/Sanity/memstomp-testsuite/PURPOSE new file mode 100644 index 0000000..8be9f56 --- /dev/null +++ b/tests/Sanity/memstomp-testsuite/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /tools/memstomp/Sanity/memstomp-testsuite +Description: Runs memstomp testsuite on installed packages +Author: Miroslav Franc diff --git a/tests/Sanity/memstomp-testsuite/main.fmf b/tests/Sanity/memstomp-testsuite/main.fmf new file mode 100644 index 0000000..6388c8a --- /dev/null +++ b/tests/Sanity/memstomp-testsuite/main.fmf @@ -0,0 +1,20 @@ +summary: Runs memstomp testsuite on installed packages +description: '' +contact: Miroslav Franc +component: +- memstomp +test: ./runtest.sh +framework: beakerlib +recommend: +- autoconf +- automake +- binutils-devel +- dejagnu +- gcc +- gcc-c++ +- glibc-devel +- memstomp +- rpm-build +duration: 15m +extra-summary: /tools/memstomp/Sanity/memstomp-testsuite +extra-task: /tools/memstomp/Sanity/memstomp-testsuite diff --git a/tests/Sanity/memstomp-testsuite/runtest.sh b/tests/Sanity/memstomp-testsuite/runtest.sh new file mode 100755 index 0000000..ad1a6d6 --- /dev/null +++ b/tests/Sanity/memstomp-testsuite/runtest.sh @@ -0,0 +1,87 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/memstomp/Sanity/memstomp-testsuite +# Description: Runs memstomp testsuite on installed packages +# Author: Miroslav Franc +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2013 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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 this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGES=(binutils-devel autoconf automake dejagnu) + +if [[ $(arch) == i686 ]] +then + ourlibdir=lib +else + ourlibdir=lib64 +fi + +PACKAGE=memstomp + +if scl_enabled +then + for p in ${X_SCLS} + do + [[ $p == devtoolset* ]] && PACKAGE=${p}-${PACKAGE} + done; unset p +fi + +rlJournalStart + rlPhaseStartSetup "testing $PACKAGE" + for p in "${PACKAGES[@]}"; do + rpm -q "$p" || yum -y install "$p" + rlAssertRpm "$p" + done; unset p + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "pushd $TmpDir" + rlRun "echo '%_topdir /root/memstomp-rebuild' > ~/.rpmmacros" + rlRun "mkdir -p /root/memstomp-rebuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}" + rlFetchSrcForInstalled $PACKAGE + rlRun "rpm -Uvh *.src.rpm" + export CC=/usr/bin/gcc + rlRun "rpmbuild -bi /root/memstomp-rebuild/SPECS/memstomp.spec &> build_log" + rlFileSubmit build_log + rlRun "pushd /root/memstomp-rebuild/BUILD/memstomp-*/testsuite" + rlLog "We should run this on installed packages..." + rlRun "find /root/memstomp-rebuild/ -name libmemstomp.so -delete" + rlRun "find /root/memstomp-rebuild/ -name libmemstomp-backtrace-symbols.so -delete" + rlPhaseEnd + + rlPhaseStartTest + rlRun "runtest -v --tool memstomp --srcdir `pwd` > $TmpDir/log 2>&1" + rlAssertNotGrep 'unexpected failures' $TmpDir/log + rlLog "No testcases should disappear..." + rlRun "[[ $(grep '# of expected passes' $TmpDir/log | awk '{print $5}') -ge 88 ]]" + rlLog "$(sed -n '/=== memstomp Summary ===/,$p' $TmpDir/log)" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd"; rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlRun "rm -r /root/memstomp-rebuild" + rlRun "rm -r ~/.rpmmacros" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd