Skip to content

Making the instrumented clinit_wrapper function thread-safe #1786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
ccb371b
Increase AssertionError arguments allowed from 2 to 3
JohnDumbell Mar 23, 2018
4d14b68
Add a regression test.
JohnDumbell Apr 11, 2018
e7b9d0e
Update desc file to add pass variables.
JohnDumbell Apr 11, 2018
d4c5c0c
Fixing member offset computation in presence of bitfields
marek-trtik Nov 22, 2017
4e2ce6c
Reset namespace after symbolic execution
tautschnig Feb 21, 2018
acc152e
C front-end: Section/ASM renaming also needs to be applied to aliases
tautschnig Feb 23, 2018
401f01f
fixup! Support __attribute__((section("x"))
tautschnig Aug 7, 2017
176626f
Only the top-level section should be considered for renaming
tautschnig Feb 16, 2018
0e94431
Attribute main function arguments to __CPROVER_start
smowton Apr 19, 2018
684da28
Fix CMake build for Glucose Syrup
Apr 21, 2018
07361b3
Bugfix: Java array symbols must have mode ID_java
peterschrammel Apr 21, 2018
696720e
Bugfix: Java symbol types must have mode ID_java
peterschrammel Apr 21, 2018
6bd897e
Add support for CaDiCaL
tautschnig Mar 31, 2018
515ea22
Correct bound in test with long string
romainbrenguier Apr 13, 2018
8c2f4c1
Remove unnecessary replace_expr
romainbrenguier Mar 1, 2018
d83fa5a
Use boolbvt for getting counter examples
romainbrenguier Feb 26, 2018
cfaa650
Use string-max-length as default max input-length
romainbrenguier Feb 7, 2018
7c4d8f7
Make get_array return nil for long strings
romainbrenguier Apr 12, 2018
97c1149
Weaken invariant for nil exprt as model of array
romainbrenguier Apr 12, 2018
925c639
Assign 0 to string length for null Java String
romainbrenguier Apr 12, 2018
24d7562
Get rid of default axioms for strings
romainbrenguier Feb 19, 2018
381f45b
Make char_array_of_pointer return a reference
romainbrenguier Apr 16, 2018
3c35e3f
Get rid of string_max_length field
romainbrenguier Feb 19, 2018
985ac77
Add test for generics array and strings
romainbrenguier Feb 22, 2018
109b408
Add tests showing the effect on string-max-length
romainbrenguier Feb 23, 2018
9593131
Deprecate string-max-length option
romainbrenguier Apr 16, 2018
b4328e9
Move MAX_CONCRETE_STRING_SIZE definition to magic
romainbrenguier Apr 16, 2018
feb7ec0
Small shared two way pointer
danpoe Apr 12, 2018
5132369
Introduce nested exception printing
Apr 4, 2018
6b838b2
Convert flatten_byte_extract to use structured exceptions
Apr 9, 2018
0e3a677
Introduce throwing bv_conversion expection
Apr 12, 2018
e634521
Introduce throwing a guard conversion exception
Apr 12, 2018
ab24787
Provide the original goto statement in the error
Apr 12, 2018
2376087
Disable nested exception printing for Windows
Apr 19, 2018
639a8f6
Test demonstrating logging with clause for dealing with Windows
Apr 19, 2018
c3e24e0
Add documentation to convert_bitvector
Apr 23, 2018
1810a7c
Introduce exceptions for all conversion steps.
Apr 23, 2018
37e712d
Use format rather than from_expr for output
Apr 23, 2018
f64898f
Remove redundant default constructor
Apr 23, 2018
6cb3a3b
Reformatting touched output function
Apr 23, 2018
5c5562b
Sort includes using clang-format
Apr 23, 2018
de34bee
Make virtual function resolution independent of string table entry or…
tautschnig Apr 23, 2018
d102af9
fix array->f typechecking
Apr 24, 2018
116067a
Extension to interpreter class
Apr 19, 2018
4ebd9ec
Update coding standard
Apr 24, 2018
1747dd3
Remove brace checking from cpplint
Apr 24, 2018
313976d
Remove NOLINTs for lambdas.
Apr 24, 2018
2a7cee9
show java_new_array_data side effects
Apr 24, 2018
ec6769d
Replace asserts by invariants
peterschrammel Apr 21, 2018
9ad4b3c
Set mode in goto_convert auxiliary symbols
peterschrammel Apr 21, 2018
37ff9eb
Bugfix: use proper language registration in unit tests
peterschrammel Apr 21, 2018
4280720
Associate dynamic objects with respective language mode
peterschrammel Apr 21, 2018
7b3699e
allow address_of of byte_extract expressions
Apr 24, 2018
ae95559
Remove unused symbolt::{to,from}_irep
tautschnig Apr 25, 2018
5a22b5e
Use existing irep_idts instead of strings
tautschnig Apr 21, 2018
edcd06f
Remove unused entries from the string table
tautschnig Apr 20, 2018
9103fb7
Check that the string table does not include unused entries
tautschnig Apr 21, 2018
e962aec
Fix Doxygen syntax
tautschnig Apr 25, 2018
bb06869
Move enum idt to the single translation unit that actually requires it
tautschnig Apr 25, 2018
9f5a216
Added an extension point for irep ids
tautschnig Apr 25, 2018
569b1e7
Rephrase and justify curly brace alignment exceptions
Apr 25, 2018
52839f8
array_size symbols: set mode and avoid redundant settings
tautschnig Apr 25, 2018
c356e45
symex_dynamic::dynamic_object_size* are constants
tautschnig Apr 25, 2018
4e623e9
Utility functions to get mode and language
peterschrammel Apr 21, 2018
c44aa9d
Add more doxygen to language.h and mode.h
peterschrammel Apr 22, 2018
b57be97
Add Makefile dependency for smt2_solver
peterschrammel Apr 25, 2018
df9f19a
Factor out java new removal into separate pass
peterschrammel Apr 25, 2018
9ecb010
more files to ignore
Apr 26, 2018
eeae697
Use remove_java_new
peterschrammel Apr 25, 2018
e3451db
Remove java_bytecode deps from Makefiles
peterschrammel Apr 7, 2018
5590489
use optional<size_t> instead of -1 in cmdlinet
Apr 26, 2018
c57627c
Use iosfwd instead of ostream where possible
tautschnig Apr 26, 2018
60bcdb6
Use a single global INITIALIZE_FUNCTION macro instead of __CPROVER_in…
tautschnig Apr 26, 2018
dfd6923
Use C++ streams instead of C-style snprintf
tautschnig Apr 26, 2018
28cc669
Set mode of if_exprt introduced in preprocessing
romainbrenguier Apr 27, 2018
a123ca9
Add test where tmp_if_expr is introduced
romainbrenguier Apr 27, 2018
2408c22
Do not unnecessarily use C string functions
tautschnig Apr 26, 2018
063d3da
Move asserts to invariants (and provide suitable includes)
tautschnig Apr 26, 2018
87d0dbb
Use pointer_offset_bits instead of locally hacking up what it does an…
tautschnig Apr 26, 2018
5b29e22
Move definition of base_type_eqt to .cpp
tautschnig Apr 26, 2018
49cfaf7
Remove unused includes
tautschnig Apr 26, 2018
5fcd098
Assign mode to invalid objects
peterschrammel Apr 28, 2018
81331c8
whitespace fix
Apr 28, 2018
9111c4d
remove do_unwind_module hook
Apr 28, 2018
879e379
remove unused includes
Apr 28, 2018
cbc4fa2
remove support for SMT1
Apr 28, 2018
738cf75
remove OpenSMT
Apr 28, 2018
5c9419a
remove bmc_constraints
Apr 28, 2018
4a8107f
missing const for parameter
Apr 30, 2018
d115904
fix a comment
Apr 30, 2018
f3d5223
cleanup the includes in src/java_bytecode
May 1, 2018
2aaad80
Modifies the instrumented clinit_wrapper function
Degiorgio Feb 12, 2018
4c7b646
Added new cmd option to jbmc, 'java-threading'
Degiorgio May 2, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ NamespaceIndentation: None
PenaltyBreakString: 10000
PointerAlignment: Right
ReflowComments: 'false'
SortIncludes: 'false'
SortIncludes: 'true'
SpaceAfterCStyleCast: 'false'
SpaceBeforeAssignmentOperators: 'true'
SpaceBeforeParens: Never
Expand Down
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ Release/*
*.lib
src/ansi-c/arm_builtin_headers.inc
src/ansi-c/clang_builtin_headers.inc
src/ansi-c/cprover_builtin_headers.inc
src/ansi-c/cprover_library.inc
src/ansi-c/cw_builtin_headers.inc
src/ansi-c/gcc_builtin_headers_types.inc
src/ansi-c/gcc_builtin_headers_alpha.inc
src/ansi-c/gcc_builtin_headers_arm.inc
src/ansi-c/gcc_builtin_headers_generic.inc
Expand All @@ -46,6 +48,7 @@ src/ansi-c/gcc_builtin_headers_tm.inc
src/ansi-c/gcc_builtin_headers_mips.inc
src/ansi-c/gcc_builtin_headers_power.inc
src/ansi-c/gcc_builtin_headers_ubsan.inc
src/ansi-c/windows_builtin_headers.inc
src/java_bytecode/java_core_models.inc

# regression/test files
Expand Down Expand Up @@ -104,8 +107,8 @@ src/goto-instrument/goto-instrument.exe
src/jbmc/jbmc
src/musketeer/musketeer
src/musketeer/musketeer.exe
src/solvers/smt2/smt2_solver
src/solvers/smt2/smt2_solver.exe
src/solvers/smt2_solver
src/solvers/smt2_solver.exe
src/symex/symex
src/symex/symex.exe
src/goto-diff/goto-diff
Expand Down
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ jobs:
script: scripts/travis_lint.sh
before_cache:

- &string-table-check
stage: Linter + Doxygen + non-debug Ubuntu/gcc-5 test
env: NAME="string-table"
install:
script: scripts/string_table_check.sh
before_cache:

- stage: Linter + Doxygen + non-debug Ubuntu/gcc-5 test
env: NAME="DOXYGEN-CHECK"
addons:
Expand Down
5 changes: 4 additions & 1 deletion CODING_STANDARD.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ Formatting is enforced using clang-format. For more information about this, see
- Nested function calls do not need to be broken up into separate lines
even if the outer function call does.
- If a method is bigger than 50 lines, break it into parts.
- Put matching `{ }` into the same column.
- Put matching `{ }` into the same column, except for initializer lists and
lambdas, where you should place `{` directly after the closing `)`. This is
to comply with clang-format, which doesn't support aligned curly braces in
these cases.
- Spaces around binary operators (`=`, `+`, `==` ...)
- Space after comma (parameter lists, argument lists, ...)
- Space after colon inside `for`
Expand Down
10 changes: 10 additions & 0 deletions regression/ansi-c/Struct_ptrmember1/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
struct some_struct
{
int some_field;
} array[10];

int main()
{
array[0].some_field=1;
array->some_field=1;
}
8 changes: 8 additions & 0 deletions regression/ansi-c/Struct_ptrmember1/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c

^EXIT=0$
^SIGNAL=0$
--
^warning: ignoring
^CONVERSION ERROR$
18 changes: 18 additions & 0 deletions regression/ansi-c/gcc_attributes11/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifdef __GNUC__
// example extracted from SV-COMP's ldv-linux-3.4-simple/
// 32_7_cpp_false-unreach-call_single_drivers-net-phy-dp83640
static int __attribute__((__section__(".init.text")))
__attribute__((no_instrument_function)) dp83640_init(void)
{
return 0;
}
int init_module(void) __attribute__((alias("dp83640_init")));
#endif

int main()
{
#ifdef __GNUC__
dp83640_init();
#endif
return 0;
}
8 changes: 8 additions & 0 deletions regression/ansi-c/gcc_attributes11/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c

^EXIT=0$
^SIGNAL=0$
--
^warning: ignoring
^CONVERSION ERROR$
12 changes: 12 additions & 0 deletions regression/ansi-c/gcc_attributes9/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,23 @@ const char* __attribute__((section("s"))) __attribute__((weak)) bar();
volatile int __attribute__((__section__(".init.data1"))) txt_heap_base1;
volatile int __attribute__((__section__(".init.data3"))) txt_heap_base, __attribute__((__section__(".init.data4"))) txt_heap_size;

int __attribute__((__section__(".init.text"))) __attribute__((__cold__))
__alloc_bootmem_huge_page(void *h);
int __attribute__((__section__(".init.text"))) __attribute__((__cold__))
alloc_bootmem_huge_page(void *h);
int alloc_bootmem_huge_page(void *h)
__attribute__((weak, alias("__alloc_bootmem_huge_page")));
int __alloc_bootmem_huge_page(void *h)
{
return 1;
}
#endif

int main()
{
#ifdef __GNUC__
int r = alloc_bootmem_huge_page(0);

static int __attribute__((section(".data.unlikely"))) __warned;
__warned=1;
return __warned;
Expand Down
21 changes: 21 additions & 0 deletions regression/cbmc-concurrency/malloc2/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include <stdlib.h>
#include <pthread.h>

_Bool set_done;
int *ptr;

void *set_x(void *arg)
{
*(int *)arg = 10;
set_done = 1;
}

int main(int argc, char *argv[])
{
__CPROVER_assume(argc >= sizeof(int));
ptr = malloc(argc);
__CPROVER_ASYNC_1: set_x(ptr);
__CPROVER_assume(set_done);
assert(*ptr == 10);
return 0;
}
8 changes: 8 additions & 0 deletions regression/cbmc-concurrency/malloc2/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c

^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
--
^warning: ignoring
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
public class AssertionIssue {

public static void throwAssertion() {
throw new AssertionError("Something went terribly wrong.", new ThrowableAssertion());
}

public static class ThrowableAssertion extends Throwable {
@Override
public String getMessage() {
return "How did we get here?";
}
}
}
8 changes: 8 additions & 0 deletions regression/cbmc-java/assertion_error_constructors/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
AssertionIssue.class
--function AssertionIssue.throwAssertion
^EXIT=10$
^SIGNAL=0$
^VERIFICATION FAILED$
--
^warning: ignoring
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
public class TestClass {
public static void f(int y) {
float[][] a1 = new float[y][3];
int j = 0;
a1[j][0] = 34.5f;
}
}
10 changes: 10 additions & 0 deletions regression/cbmc-java/dynamic-multi-dimensional-array/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CORE
TestClass.class
--function TestClass.f --cover location --unwind 2
Source GOTO statement: .*
(^ exception: Can't convert byte_extraction|Nested exception printing not supported on Windows)
^EXIT=6$
--
--
The exception thrown in this test is the symptom of a bug; the purpose of this
test is the validate the output of that exception
8 changes: 8 additions & 0 deletions regression/cbmc-java/static_init1/test1.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
static_init.class
--function static_init.main --java-threading
^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
--
^warning: ignoring
8 changes: 8 additions & 0 deletions regression/cbmc-java/static_init2/test1.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
static_init.class
--function static_init.main --java-threading
^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
--
^warning: ignoring
7 changes: 7 additions & 0 deletions regression/cbmc-java/static_init_order/test3.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CORE
static_init_order.class
--function static_init_order.test1 --trace --java-threading
^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
--
7 changes: 7 additions & 0 deletions regression/cbmc-java/static_init_order/test4.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CORE
static_init_order.class
--function static_init_order.test2 --java-threading
^EXIT=10$
^SIGNAL=0$
^VERIFICATION FAILED$
--
4 changes: 2 additions & 2 deletions regression/cbmc-java/virtual7/test.desc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ test.class
--show-goto-functions --function test.main
^EXIT=0$
^SIGNAL=0$
IF.*"java::C".*THEN GOTO
IF.*"java::D".*THEN GOTO
IF.*"java::B".*THEN GOTO
IF.*"java::E".*THEN GOTO
IF.*"java::A".*THEN GOTO
53 changes: 53 additions & 0 deletions regression/cbmc/Bitfields3/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#include <stdlib.h>
#include <assert.h>

#pragma pack(1)
struct A
{
unsigned char a;
unsigned char b : 2;
unsigned char c : 2;
unsigned char d;
};

struct B
{
unsigned char a;
unsigned char b : 2;
unsigned char c;
unsigned char d : 2;
};

struct C
{
unsigned char a;
unsigned char b : 4;
unsigned char c : 4;
unsigned char d;
};
#pragma pack()

int main(void)
{
assert(sizeof(struct A) == 3);
struct A *p = malloc(3);
assert((unsigned char *)p + 2 == &(p->d));
p->c = 3;
if(p->c != 3)
{
free(p);
}
free(p);

assert(sizeof(struct B) == 4);
struct B *pb = malloc(4);
assert((unsigned char *)pb + 2 == &(pb->c));
free(pb);

assert(sizeof(struct C) == 3);
struct C *pc = malloc(3);
assert((unsigned char *)pc + 2 == &(pc->d));
free(pc);

return 0;
}
8 changes: 8 additions & 0 deletions regression/cbmc/Bitfields3/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c
--pointer-check --bounds-check
^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
--
^warning: ignoring
Binary file added regression/jbmc-strings/char_escape/Test.class
Binary file not shown.
19 changes: 19 additions & 0 deletions regression/jbmc-strings/char_escape/Test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
public class Test {

public static boolean test(char c1, char c2, char c3, char c4, char c5, char c6, char c7, char c8) {
StringBuilder sb = new StringBuilder("");
sb.append(c1);
sb.append(c2);
sb.append(c3);
sb.append(c4);
sb.append(c5);
sb.append(c6);
sb.append(c7);
sb.append(c8);
if (sb.toString().equals("\b\t\n\f\r\"\'\\"))
return true;
if (!sb.toString().equals("\b\t\n\f\r\"\'\\"))
return false;
return true;
}
}
6 changes: 6 additions & 0 deletions regression/jbmc-strings/char_escape/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CORE
Test.class
--refine-strings --function Test.test --cover location --trace --json-ui
^EXIT=0$
^SIGNAL=0$
20 of 23 covered \(87.0%\)|30 of 44 covered \(68.2%\)
Binary file modified regression/jbmc-strings/long_string/Test.class
Binary file not shown.
4 changes: 3 additions & 1 deletion regression/jbmc-strings/long_string/Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ public static void checkAbort(String s, String t) {
String u = s.concat(t);

// Filter out
if(u.length() < 67_108_864)
// 67_108_864 corresponds to the maximum length for which the solver
// will concretize the string.
if(u.length() <= 67_108_864)
return;
if(CProverString.charAt(u, 2_000_000) != 'b')
return;
Expand Down
9 changes: 5 additions & 4 deletions regression/jbmc-strings/long_string/test_abort.desc
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
CORE
Test.class
--refine-strings --function Test.checkAbort
^EXIT=6$
--refine-strings --function Test.checkAbort --trace
^EXIT=10$
^SIGNAL=0$
dynamic_object[0-9]*=\(assignment removed\)
--
--
This tests should abort, because concretizing a string of the required
length may take to much memory.
This tests that the object does not appear in the trace, because concretizing
a string of the required length may take too much memory.
Binary file not shown.
Loading