-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathraces.k
More file actions
39 lines (37 loc) · 1.55 KB
/
races.k
File metadata and controls
39 lines (37 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
module C-RACES
imports C-CONFIGURATION
imports C-MEMORY-READING-SYNTAX
imports C-MEMORY-WRITING-SYNTAX
imports C-BITSIZE-SYNTAX
imports SYMLOC-SYNTAX
imports C-ERROR-SYNTAX
// TODO(chathhorn): Silly way to do things. Probably need to allow
// multiple error cells at least. Also, add more details (loc?).
// FIXME possible to miss dataraces with bitfields
rule [read-write-race]:
<k> (.K => UNDEF("CEER4", "Have a read-write datarace.")) ~>
read(Loc:SymLoc, T:Type)
...</k>
<k> (.K => UNDEF("CEER4", "Have a read-write datarace.")) ~>
write(Loc':SymLoc, _, T':Type)
...</k>
requires sameBase(Loc, Loc') andBool
((Loc <=bytes Loc'
andBool Loc' <bytes (Loc +bytes byteSizeofType(T)))
orBool (Loc >bytes Loc'
andBool (Loc' +bytes byteSizeofType(T')) >bytes Loc))
[computational]
rule [write-write-race]:
<k> (.K => UNDEF("CEER5", "Have a write-write datarace.")) ~>
write(Loc:SymLoc, _, T:Type)
...</k>
<k> (.K => UNDEF("CEER5", "Have a write-write datarace.")) ~>
write(Loc':SymLoc, _, T':Type)
...</k>
requires sameBase(Loc, Loc') andBool
((Loc <=bytes Loc'
andBool Loc' <bytes (Loc +bytes byteSizeofType(T)))
orBool (Loc >bytes Loc'
andBool (Loc' +bytes byteSizeofType(T')) >bytes Loc))
[computational]
endmodule