TestCases
(→Kernel Testcases) |
m (formatting update) |
||
Line 24: | Line 24: | ||
== Threads and fork on VIPT-WB machines == | == Threads and fork on VIPT-WB machines == | ||
− | * Affects | + | * Affects [http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=561203 #561203]. |
− | * Discussed on | + | * 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 | + | Summary from [http://article.gmane.org/gmane.linux.ports.parisc/2823 JDA]: |
''The minifail bug is a "Threads and fork" problem | ''The minifail bug is a "Threads and fork" problem | ||
Line 35: | Line 35: | ||
is caused by the same problem.'' | is caused by the same problem.'' | ||
− | Initial patch | + | Initial patch [http://marc.info/?l=linux-parisc&m=126202676424518&q=p3 syscall.S.d.1] from [http://article.gmane.org/gmane.linux.ports.parisc/2524 JDA] |
− | First testcase | + | First testcase [http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=25;filename=minifail.cpp;att=1;bug=561203 minifail.cpp] |
Build with: | Build with: | ||
− | + | <code>g++ -I/usr/include/qt4 -lQtCore minifail.cpp -o minifail -O0 -g</code> | |
Fails occasionally with: | Fails occasionally with: | ||
Line 60: | Line 60: | ||
</nowiki> | </nowiki> | ||
− | * Reduced | + | * 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 | + | * 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 | + | * 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 | + | * 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 | + | * 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 | + | * '''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] |
---- | ---- | ||
− | Other testcase from | + | Other testcase from [http://article.gmane.org/gmane.linux.ports.parisc/2774 JDA]: |
− | Compile with | + | Compile with <code>-static</code> to link with libc.a. Testcase prints incorrect parent pid.: |
<nowiki> | <nowiki> | ||
Line 114: | Line 114: | ||
=== 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 | ** '''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 <tt>pte.2.d</tt> 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 | + | * Affects [http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=558905 #558905] |
− | * Discussed by Carlos O'Donell in | + | * 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 177: | Line 177: | ||
Compile this test case twice: | Compile this test case twice: | ||
− | # gcc -O1 -g -o vfork-O1 vfork.c | + | # <code>gcc -O1 -g -o vfork-O1 vfork.c</code> |
− | # gcc -O0 -g -o vfork-O0 vfork.c | + | # <code>gcc -O0 -g -o vfork-O0 vfork.c</code> |
Line 185: | Line 185: | ||
To remove the C library from the loop I attach a complete vfork | To remove the C library from the loop I attach a complete vfork | ||
− | implementation as used by glibc. | + | implementation as used by glibc. [http://marc.info/?l=linux-parisc&m=126013436326095&q=p3 pt-vfork.s] |
− | You can compile the test case using: | + | You can compile the test case using: <code>cc -O1 -g -o vfork-O1 vfork.c pt-vfork.s</code> |
In summary: | In summary: | ||
Line 194: | Line 194: | ||
* Test case works on hppa under strace. | * Test case works on hppa under strace. | ||
− | More discussion by Carlos O'Donell in | + | More discussion by Carlos O'Donell in [http://thread.gmane.org/gmane.linux.ports.parisc/2725 this thread] |
− | * Other testcase | + | * Other testcase [http://marc.info/?l=linux-parisc&m=126979720816005&q=p3 vforktest.tgz] by Carlos O'Donell |
− | * Updated (?) testcase | + | * 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 | + | * Affects [http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=559406 #559406] |
− | * Testcase | + | * 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 218: | Line 218: | ||
== MMAP == | == MMAP == | ||
− | * Affects | + | * Affects [http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40505 PR40505]. |
− | * Discussed by Carlos O'Donell on | + | * Discussed by Carlos O'Donell on [http://thread.gmane.org/gmane.linux.debian.devel.release/30830/focus=31039 this thread]. |
− | * Testcase | + | * Testcase [http://marc.info/?l=linux-parisc&m=124689818116647&q=p3 test-mmap.c] from Carlos O'Donell |
Line 227: | Line 227: | ||
== Segmentation fault in __libc_start_main with -static == | == Segmentation fault in __libc_start_main with -static == | ||
− | Discussed in | + | Discussed in [http://thread.gmane.org/gmane.linux.ports.parisc/2585 this thread] |
− | Testcase from | + | Testcase from [http://marc.info/?l=linux-parisc&m=126477688209053 JDA]: Compile with <code>g++ -o xx -static -pthread xx.C</code> |
<nowiki> | <nowiki> | ||
// This test only applies to glibc (NPTL) targets. | // This test only applies to glibc (NPTL) targets. |
Latest revision as of 21:11, 31 May 2014
Contents |
[edit] Kernel Testcases
[edit] Math test case
should return 0.0: (hppa floating point error)
#include <stdio.h> #include <math.h> int main (void) { double result = exp (-4.3682654441477153e+19); printf ("%g\n", result); if (result != 0.0) return 1; return 0; }
[edit] Futex wait failure
No testcase.
[edit] Threads and fork on VIPT-WB machines
- Affects #561203.
- Discussed on this thread and this thread
Summary from JDA:
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 syscall.S.d.1 from JDA
First testcase minifail.cpp
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 minifail6.cpp, from this post
- Tentative patch], see this post
- Other version minifail3.c from Helge Deller
- Other version [1] from JDA
- Other version minifail12.cpp from JDA
- Final (?) version minifail_dave.cpp from Helge Deller
Other testcase from JDA:
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; }
[edit] Patches
- parisc_lock_v2.patch from Helge Deller - Not Applicable (not-upstream)
- entry.S.patch from JDA (not-upstream)
- patch1 from JDA - Superseded by patch2 (not-upstream)
- patch2 from JDA - Included in patch3 (not-upstream)
- bundle patch3 from JDA - Partially split into
- Call pagefault_disable/pagefault_enable in kmap_atomic/kunmap_atomic (on-buildds)
- Remove unnecessary macros from entry.S (on-buildds)
- Delete unnecessary nop's in entry.S (on-buildds)
- Avoid interruption in critical region in entry.S (on-buildds)
- LWS fixes for syscall.S (on-buildds)
- Note: some bits from patch3 have not be separately submitted (futex.h, etc) - Needs review
- pgtable.h patch update, initially found in patch3 from JDA (not-upstream)
- bundle patch4 aka pte.2.d from JDA, updating parts of patch3 (not-upstream)
- patch] from James Bottomley for kmap issues fixing minifail6.cpp (not-upstream)
- bundle patch5 from JDA with a slightly modified version of James' patch (not-upstream)
- bundle patch6 from JDA, with apparently good results both on pa8800 and previous CPUs (not-upstream)
- bundle patch7 from JDA, with reworked pacache.s and cache.c (not-upstream)
[edit] vfork/execve
- Affects #558905
- Discussed by Carlos O'Donell in this thread:
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. pt-vfork.s
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 this thread
- Other testcase vforktest.tgz by Carlos O'Donell
- Updated (?) testcase vforktest.tgz by Carlos O'Donell
[edit] Patches
[edit] floating point SIGFPE not trapped
[edit] Patches
- Patch from Helge Deller (in-debian, on-buildds)
[edit] GCC TestCases
[edit] MMAP
- Affects PR40505.
- Discussed by Carlos O'Donell on this thread.
- Testcase test-mmap.c from Carlos O'Donell
[edit] GLIBC TestCases
[edit] Segmentation fault in __libc_start_main with -static
Discussed in this thread
Testcase from JDA: 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; } }