From: Julian Seward Date: Mon, 31 Aug 2015 13:05:35 +0000 (+0000) Subject: Change the --smc-check default value to =all-non-file. X-Git-Tag: svn/VALGRIND_3_11_0~56 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6bf68780dc4364eccd65258143734093c66dadcd;p=thirdparty%2Fvalgrind.git Change the --smc-check default value to =all-non-file. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15601 --- diff --git a/coregrind/m_main.c b/coregrind/m_main.c index a95ff9feff..cd9cad10cc 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -160,7 +160,7 @@ static void usage_NORETURN ( Bool debug_help ) " --allow-mismatched-debuginfo=no|yes [no]\n" " for the above two flags only, accept debuginfo\n" " objects that don't \"match\" the main object\n" -" --smc-check=none|stack|all|all-non-file [stack]\n" +" --smc-check=none|stack|all|all-non-file [all-non-file]\n" " checks for self-modifying code: none, only for\n" " code found in stacks, for all code, or for all\n" " code except that from file-backed mappings\n" diff --git a/coregrind/m_options.c b/coregrind/m_options.c index 4248e9b998..b9b7b17c70 100644 --- a/coregrind/m_options.c +++ b/coregrind/m_options.c @@ -129,7 +129,7 @@ UInt VG_(clo_max_threads) = MAX_THREADS_DEFAULT; Word VG_(clo_main_stacksize) = 0; /* use client's rlimit.stack */ Word VG_(clo_valgrind_stacksize) = VG_DEFAULT_STACK_ACTIVE_SZB; Bool VG_(clo_wait_for_gdb) = False; -VgSmc VG_(clo_smc_check) = Vg_SmcStack; +VgSmc VG_(clo_smc_check) = Vg_SmcAllNonFile; UInt VG_(clo_kernel_variant) = 0; Bool VG_(clo_dsymutil) = False; Bool VG_(clo_sigill_diag) = True; diff --git a/docs/xml/manual-core.xml b/docs/xml/manual-core.xml index 80a3e66475..3a9e720c40 100644 --- a/docs/xml/manual-core.xml +++ b/docs/xml/manual-core.xml @@ -1704,7 +1704,7 @@ need to use them. - + This option controls Valgrind's detection of self-modifying @@ -1720,15 +1720,16 @@ need to use them. file-backed mappings. Note that the default option will catch the vast majority - of cases. The main case it will not catch is programs such as JIT - compilers that dynamically generate code and - subsequently overwrite part or all of it. Running with + of cases, including the case where a JIT + compiler dynamically generates code and + subsequently overwrites part or all of it. Running with all will slow Valgrind down noticeably. Running with none will rarely speed things up, since very little - code gets put on the stack for most programs. The + code gets dynamically generated in most programs. The VALGRIND_DISCARD_TRANSLATIONS client request is an alternative to + and that requires more programmer effort but allows Valgrind to run your program faster, by telling it precisely when translations need to be re-made. @@ -1749,14 +1750,14 @@ need to use them. takes advantage of this observation, limiting the overhead of checking to code which is likely to be JIT generated. - Some architectures (including ppc32, ppc64, ARM and MIPS) + Some architectures (including POWER/PPC, ARM and MIPS) require programs which create code at runtime to flush the instruction cache in between code generation and first use. Valgrind observes and honours such instructions. Hence, on - ppc32/Linux, ppc64/Linux and ARM/Linux, Valgrind always provides + those targets, Valgrind always provides complete, transparent support for self-modifying code. It is - only on platforms such as x86/Linux, AMD64/Linux, x86/Darwin and - AMD64/Darwin that you need to use this option. + only on platforms such as x86/Linux, AMD64/Linux, x86/Darwin, + AMD64/Darwin and S390/Linux that you need to use this option. diff --git a/none/tests/cmdline1.stdout.exp b/none/tests/cmdline1.stdout.exp index d7219ced93..3617545e3f 100644 --- a/none/tests/cmdline1.stdout.exp +++ b/none/tests/cmdline1.stdout.exp @@ -74,7 +74,7 @@ usage: valgrind [options] prog-and-args --allow-mismatched-debuginfo=no|yes [no] for the above two flags only, accept debuginfo objects that don't "match" the main object - --smc-check=none|stack|all|all-non-file [stack] + --smc-check=none|stack|all|all-non-file [all-non-file] checks for self-modifying code: none, only for code found in stacks, for all code, or for all code except that from file-backed mappings diff --git a/none/tests/cmdline2.stdout.exp b/none/tests/cmdline2.stdout.exp index 4ea258d300..88110ec370 100644 --- a/none/tests/cmdline2.stdout.exp +++ b/none/tests/cmdline2.stdout.exp @@ -74,7 +74,7 @@ usage: valgrind [options] prog-and-args --allow-mismatched-debuginfo=no|yes [no] for the above two flags only, accept debuginfo objects that don't "match" the main object - --smc-check=none|stack|all|all-non-file [stack] + --smc-check=none|stack|all|all-non-file [all-non-file] checks for self-modifying code: none, only for code found in stacks, for all code, or for all code except that from file-backed mappings diff --git a/perf/bigcode.c b/perf/bigcode.c index 8e12d7bff7..ae31cbb17c 100644 --- a/perf/bigcode.c +++ b/perf/bigcode.c @@ -8,6 +8,19 @@ // to make a difference), but under Valgrind the one running more code is // significantly slower due to the extra translation time. +// 31 Aug 2015: this only "works" on x86/amd64/s390 by accident; the +// test is essentially kludged. This "generates" code into memory +// (the mmap'd area) and the executes it. But historically and even +// after this commit (r15601), the test has been run without +// --smc-check=all or all-non-file. That just happens to work because +// the "generated" code is never modified, so there's never a +// translated-vs-reality coherence problem. Really we ought to run +// with the new-as-of-r15601 default --smc-check=all-non-file, but that +// hugely slows it down and makes the results non-comparable with +// pre r15601 results, so instead the .vgperf files now specify the +// old default value --smc-check=stack explicitly. + + #include #include #include diff --git a/perf/bigcode1.vgperf b/perf/bigcode1.vgperf index 2fdcb4c3a0..ea5440f80b 100644 --- a/perf/bigcode1.vgperf +++ b/perf/bigcode1.vgperf @@ -1 +1,2 @@ prog: bigcode +vgopts: --smc-check=stack diff --git a/perf/bigcode2.vgperf b/perf/bigcode2.vgperf index e4a42c9890..d7de3a18f2 100644 --- a/perf/bigcode2.vgperf +++ b/perf/bigcode2.vgperf @@ -1,2 +1,3 @@ prog: bigcode args: 0 +vgopts: --smc-check=stack