TestCases
(Created page with "= Kernel Testcases = == Futex wait failure == No testcase. == Threads and fork on VIPT-WB machines == * Affects [[http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=561203...") |
m |
||
Line 7: | Line 7: | ||
== Threads and fork on VIPT-WB machines == | == Threads and fork on VIPT-WB machines == | ||
− | + | * Affects [[http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=561203|#561203]]. | |
− | + | * Discussed on [[http://thread.gmane.org/gmane.linux.ports.parisc/2503|this thread]] and [[http://thread.gmane.org/gmane.linux.ports.parisc/2751|this thread]] | |
Summary from [[http://article.gmane.org/gmane.linux.ports.parisc/2823|JDA]]: | Summary from [[http://article.gmane.org/gmane.linux.ports.parisc/2823|JDA]]: | ||
Line 23: | Line 23: | ||
Build with: | Build with: | ||
− | + | * g++ -I/usr/include/qt4 -lQtCore minifail.cpp -o minifail -O0 -g | |
− | + | ||
− | + | ||
Fails occasionally with: | Fails occasionally with: | ||
− | + | <nowiki> | |
$ i=0; while true; do i=$(($i+1)); echo Run $i; ./minifail; done; | $ i=0; while true; do i=$(($i+1)); echo Run $i; ./minifail; done; | ||
$ i=0; while true; do i=$(($i+1)); echo Run $i; ./minifail qt; done; | $ i=0; while true; do i=$(($i+1)); echo Run $i; ./minifail qt; done; | ||
− | + | </nowiki> | |
Typical observed failure: | Typical observed failure: | ||
− | + | <nowiki> | |
Run 21 | Run 21 | ||
Segmentation fault | Segmentation fault | ||
Line 43: | Line 41: | ||
Thread OK. | Thread OK. | ||
Segmentation fault | Segmentation fault | ||
− | + | </nowiki> | |
− | + | * Reduced [[http://marc.info/?l=linux-parisc&m=126503924510791&q=p4|minifail6.cpp]], from [[http://article.gmane.org/gmane.linux.ports.parisc/2606|this post]]: | |
− | + | * Tentative [[http://marc.info/?l=linux-parisc&m=126514540817084&q=p3|patch]], see this [[http://article.gmane.org/gmane.linux.ports.parisc/2615|post]] | |
− | + | * Other version [[http://marc.info/?l=linux-parisc&m=126523464015510&q=p3|minifail3.c]] from [[http://article.gmane.org/gmane.linux.ports.parisc/2618|Helge Deller]] | |
− | + | * Other version [[http://marc.info/?l=linux-parisc&m=126835038716389&q=p3|minifail9.cpp]] from [[http://article.gmane.org/gmane.linux.ports.parisc/2685|JDA]] | |
− | + | * Other version [[http://marc.info/?l=linux-parisc&m=126919558329853&q=p3|minifail12.cpp]] from [[http://article.gmane.org/gmane.linux.ports.parisc/2693|JDA]] | |
− | + | * '''Final''' (?) version [[http://marc.info/?l=linux-parisc&m=127275273129566&q=p3|minifail_dave.cpp]] from [[http://article.gmane.org/gmane.linux.ports.parisc/2824|Helge Deller]] | |
---- | ---- | ||
Line 58: | Line 56: | ||
Compile with `-static` to link with libc.a. Testcase prints incorrect parent pid.: | Compile with `-static` to link with libc.a. Testcase prints incorrect parent pid.: | ||
− | + | <nowiki> | |
+ | #!cplusplus | ||
#include <stdio.h> | #include <stdio.h> | ||
#include <stdlib.h> | #include <stdlib.h> | ||
Line 94: | Line 93: | ||
return 0; | return 0; | ||
} | } | ||
− | + | </nowiki> | |
=== Patches === | === Patches === | ||
− | + | * [[https://patchwork.kernel.org/patch/76829/|parisc_lock_v2.patch]] from Helge Deller - Not Applicable (not-upstream) | |
− | + | * [[https://patchwork.kernel.org/patch/85865/|entry.S.patch]] from JDA (not-upstream) | |
− | + | * [[https://patchwork.kernel.org/patch/90467/|patch1]] from JDA - Superseded by patch2 (not-upstream) | |
− | + | * [[https://patchwork.kernel.org/patch/90596/|patch2]] from JDA - Included in patch3 (not-upstream) | |
− | + | * [[https://patchwork.kernel.org/patch/91525/|bundle patch3]] from JDA - Partially split into | |
− | + | ** [[https://patchwork.kernel.org/patch/91916/|Call pagefault_disable/pagefault_enable in kmap_atomic/kunmap_atomic]] (on-buildds) | |
− | + | ** [[https://patchwork.kernel.org/patch/91918/|Remove unnecessary macros from entry.S]] (on-buildds) | |
− | + | ** [[https://patchwork.kernel.org/patch/91919/|Delete unnecessary nop's in entry.S]] (on-buildds) | |
− | + | ** [[https://patchwork.kernel.org/patch/91922/|Avoid interruption in critical region in entry.S]] (on-buildds) | |
− | + | ** [[https://patchwork.kernel.org/patch/91924/|LWS fixes for syscall.S]] (on-buildds) | |
− | + | ** '''Note:''' some bits from patch3 have not be separately submitted (futex.h, etc) - Needs review | |
− | + | * [[https://patchwork.kernel.org/patch/91933/|pgtable.h patch update]], initially found in patch3 from JDA (not-upstream) | |
− | + | * [[https://patchwork.kernel.org/patch/93520/|bundle patch4]] aka `pte.2.d` from JDA, updating parts of patch3 (not-upstream) | |
− | + | * [[https://patchwork.kernel.org/patch/95969/|patch]] from James Bottomley for kmap issues fixing '''minifail6.cpp''' (not-upstream) | |
− | + | * [[https://patchwork.kernel.org/patch/97971/|bundle patch5]] from JDA with a slightly modified version of James' patch (not-upstream) | |
− | + | * [[https://patchwork.kernel.org/patch/99861/|bundle patch6]] from JDA, with apparently good results both on pa8800 and previous CPUs (not-upstream) | |
− | + | * [[https://patchwork.kernel.org/patch/101741/|bundle patch7]] from JDA, with reworked pacache.s and cache.c (not-upstream) | |
== vfork/execve == | == vfork/execve == | ||
− | + | * Affects [[http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=558905|#558905]] | |
− | + | * Discussed by Carlos O'Donell in [[http://thread.gmane.org/gmane.linux.ports.parisc/2403|this thread]]: | |
''I have constructed a vfork test case which shows some of the problems | ''I have constructed a vfork test case which shows some of the problems | ||
Line 127: | Line 126: | ||
The intent of the testcase is to do the following: | The intent of the testcase is to do the following: | ||
− | + | # vfork | |
− | + | # Launch "ls -l" in the vfork'd child. | |
− | + | # Print some information in the parent. | |
− | + | <nowiki> | |
/* vfork.c */ | /* vfork.c */ | ||
#include <stdio.h> | #include <stdio.h> | ||
Line 158: | Line 157: | ||
return 0; | return 0; | ||
} | } | ||
− | + | </nowiki> | |
Compile this test case twice: | Compile this test case twice: | ||
− | + | # gcc -O1 -g -o vfork-O1 vfork.c | |
− | gcc -O1 -g -o vfork-O1 vfork.c | + | # gcc -O0 -g -o vfork-O0 vfork.c |
− | gcc -O0 -g -o vfork-O0 vfork.c | + | |
− | + | ||
The return from vfork is corrupted in the parent. | The return from vfork is corrupted in the parent. | ||
Line 175: | Line 173: | ||
In summary: | In summary: | ||
− | + | * Test case works on x86. | |
− | + | * Test case fails on hppa. | |
− | + | * Test case works on hppa under strace. | |
More discussion by Carlos O'Donell in [[http://thread.gmane.org/gmane.linux.ports.parisc/2725|this thread]] | More discussion by Carlos O'Donell in [[http://thread.gmane.org/gmane.linux.ports.parisc/2725|this thread]] | ||
− | + | * Other testcase [[http://marc.info/?l=linux-parisc&m=126979720816005&q=p3|vforktest.tgz]] by Carlos O'Donell | |
− | + | * Updated (?) testcase [[http://marc.info/?l=linux-parisc&m=126980206121937&q=p3|vforktest.tgz]] by Carlos O'Donell | |
=== Patches === | === Patches === | ||
− | + | * [[https://patchwork.kernel.org/patch/90144/|Patch]] from JDA (not-upstream) | |
− | + | * [[https://patchwork.kernel.org/patch/90018/|Patch]] from Carlos O'Donell - Comments/cleanup (on-buildds) | |
== floating point SIGFPE not trapped == | == floating point SIGFPE not trapped == | ||
− | + | * Affects [[http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=559406|#559406]] | |
− | + | * Testcase [[http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=33;filename=fputest.c;att=1;bug=559406|fputest.c]] | |
=== Patches === | === Patches === | ||
− | + | * [[https://patchwork.kernel.org/patch/96558/|Patch]] from Helge Deller (in-debian, on-buildds) | |
= GCC TestCases = | = GCC TestCases = | ||
Line 203: | Line 201: | ||
== MMAP == | == MMAP == | ||
− | + | * Affects [[http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40505|PR40505]]. | |
− | + | * Discussed by Carlos O'Donell on [[http://thread.gmane.org/gmane.linux.debian.devel.release/30830/focus=31039|this thread]]. | |
− | + | * Testcase [[http://marc.info/?l=linux-parisc&m=124689818116647&q=p3|test-mmap.c]] from Carlos O'Donell | |
Line 215: | Line 213: | ||
Testcase from [[http://marc.info/?l=linux-parisc&m=126477688209053|JDA]]: Compile with `g++ -o xx -static -pthread xx.C` | Testcase from [[http://marc.info/?l=linux-parisc&m=126477688209053|JDA]]: Compile with `g++ -o xx -static -pthread xx.C` | ||
− | + | <nowiki> | |
// This test only applies to glibc (NPTL) targets. | // This test only applies to glibc (NPTL) targets. | ||
// { dg-do run { target *-*-linux* } } | // { dg-do run { target *-*-linux* } } | ||
Line 241: | Line 239: | ||
} | } | ||
} | } | ||
− | + | </nowiki> |
Revision as of 15:10, 5 February 2014
Contents |
Kernel Testcases
Futex wait failure
No testcase.
Threads and fork on VIPT-WB machines
Summary from [[2]]:
The minifail bug is a "Threads and fork" problem arising from cache corruption. Mainly, copy_user_page is broken when copying memory shared by more than one process. There are also issues in PTE/TLB management on SMP systems. Probably, the vfork/execve bug is caused by the same problem.
Initial patch [[3]] from [[4]]
First testcase [[5]]
Build with:
- g++ -I/usr/include/qt4 -lQtCore minifail.cpp -o minifail -O0 -g
Fails occasionally with:
$ i=0; while true; do i=$(($i+1)); echo Run $i; ./minifail; done; $ i=0; while true; do i=$(($i+1)); echo Run $i; ./minifail qt; done;
Typical observed failure:
Run 21 Segmentation fault Run 22 Child OK. Thread OK. Run 23 Thread OK. Segmentation fault
- Reduced [[6]], from [post]:
- Tentative [[7]], see this [[8]]
- Other version [[9]] from [Deller]
- Other version [[10]] from [[11]]
- Other version [[12]] from [[13]]
- Final (?) version [[14]] from [Deller]
Other testcase from [[15]]:
Compile with `-static` to link with libc.a. Testcase prints incorrect parent pid.:
#!cplusplus #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <sys/types.h> #include <unistd.h> #define CALL_EXIT 0 int main (void) { pid_t child; pid_t parent; char *cmd[] = { "bash", "-c", "echo In child $$;", (char *)0 }; char *env[] = { "HOME=/tmp", (char *)0 }; int ret; child = vfork(); if (child == 0) { ret = execve("/bin/bash", cmd, env); // printf ("ret = %d\n", ret); _exit(1); } else { // printf("child != 0\n"); } parent = getpid(); printf("parent is %d\n", (unsigned int)parent); printf("child is %d\n", (unsigned int)child); return 0; }
Patches
- [[16]] from Helge Deller - Not Applicable (not-upstream)
- [[17]] from JDA (not-upstream)
- [[18]] from JDA - Superseded by patch2 (not-upstream)
- [[19]] from JDA - Included in patch3 (not-upstream)
- [patch3] from JDA - Partially split into
- [pagefault_disable/pagefault_enable in kmap_atomic/kunmap_atomic] (on-buildds)
- [unnecessary macros from entry.S] (on-buildds)
- [unnecessary nop's in entry.S] (on-buildds)
- [interruption in critical region in entry.S] (on-buildds)
- [fixes for syscall.S] (on-buildds)
- Note: some bits from patch3 have not be separately submitted (futex.h, etc) - Needs review
- [patch update], initially found in patch3 from JDA (not-upstream)
- [patch4] aka `pte.2.d` from JDA, updating parts of patch3 (not-upstream)
- [[20]] from James Bottomley for kmap issues fixing minifail6.cpp (not-upstream)
- [patch5] from JDA with a slightly modified version of James' patch (not-upstream)
- [patch6] from JDA, with apparently good results both on pa8800 and previous CPUs (not-upstream)
- [patch7] from JDA, with reworked pacache.s and cache.c (not-upstream)
vfork/execve
I have constructed a vfork test case which shows some of the problems I have using vfork reliably. This fails every time on my PA8700 system running 2.6.32-rc6. It appears as though r28 (ret0) in the parent is being corrupted.
The intent of the testcase is to do the following:
- vfork
- Launch "ls -l" in the vfork'd child.
- Print some information in the parent.
/* vfork.c */ #include <stdio.h> #include <stdlib.h> #include <errno.h> int main (void) { pid_t child; char *cmd[] = { "ls", "-l", (char *)0 }; char *env[] = { "HOME=/tmp", (char *)0 }; child = vfork(); if (child == 0) { execve("/bin/ls", cmd, env); } else { printf("child != 0\n"); } printf("child is 0x%x\n", (unsigned int)child); return 0; }
Compile this test case twice:
- gcc -O1 -g -o vfork-O1 vfork.c
- gcc -O0 -g -o vfork-O0 vfork.c
The return from vfork is corrupted in the parent.
This gets worse at -O0.
To remove the C library from the loop I attach a complete vfork implementation as used by glibc. [[22]]
You can compile the test case using: `cc -O1 -g -o vfork-O1 vfork.c pt-vfork.s`
In summary:
- Test case works on x86.
- Test case fails on hppa.
- Test case works on hppa under strace.
More discussion by Carlos O'Donell in [thread]
Patches
floating point SIGFPE not trapped
Patches
- [[29]] from Helge Deller (in-debian, on-buildds)
GCC TestCases
MMAP
GLIBC TestCases
Segmentation fault in __libc_start_main with -static
Discussed in [thread]
Testcase from [[32]]: Compile with `g++ -o xx -static -pthread xx.C`
// This test only applies to glibc (NPTL) targets. // { dg-do run { target *-*-linux* } } // { dg-options "-pthread" } #include <pthread.h> #include <cxxabi.h> extern "C" int printf (const char *, ...); int main() { try { pthread_exit (0); } catch (abi::__forced_unwind &) { printf ("caught forced unwind\n"); throw; } catch (...) { printf ("caught ...\n"); return 1; } }