Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/trusted/validator_arm/testdata/test_loads.S

Issue 8275008: Make validator require read sandboxing on ARM. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 @ Copyright (c) 2011 The Native Client Authors. All rights reserved.
2 @ Use of this source code is governed by a BSD-style license that can be
3 @ found in the LICENSE file.
4
5 @
6 @ Tests both legal and illegal variations on loads -- both loads that
7 @ require masking, and loads that are guaranteed sandboxed (i.e. through SP)
8 @
9
10 @ we restrict loads to the lower 1GB of the address space
11 #define MASK 0xc0000000
12
13 .globl _start
14 _start:
15 .align 4
16
17 bundle0:
robertm 2011/10/18 21:19:55 maybe add some pc and sp loads
sehr (please use chromium) 2011/10/18 22:44:11 Done.
18 bic r1, r3, #MASK @ Generating a confined address
19 ldr r0, [r1] @ and storing to it is fine.
20
21 bic r1, r1, #MASK @ Confining an address in place
robertm 2011/10/18 21:19:55 not sure whether those are tested elsewhere but l
sehr (please use chromium) 2011/10/18 22:44:11 Done.
22 ldr r0, [r1] @ and storing to it is fine.
23
24 bundle1:
25 mov r1, r3 @ Just poking at the address
26 ldr r0, [r1] @ and storing to it is an ERROR.
27
28 bic r1, r3, #0 @ Even if we use BIC, if the mask is wrong,
29 ldr r0, [r1] @ still an ERROR.
30
31 bundle2:
32 nop
33 nop
34 nop
35 bic r1, r3, #MASK @ If the BIC is in a different bundle...
36
37 bundle3:
38 ldr r0, [r1] @ ...then the loads is an ERROR.
39 nop
40
41 biceq r2, r2, #0xC0000000 @ Mask a register and
42 ldrexeq r0, [r2] @ use it in a load-exclusive. Should pass.
43
44 bundle4:
45 bic r2, r2, #0 @ Mask incorrectly and
46 ldrex r0, [r2] @ use it in a load-exclusive, for an ERROR.
47
48 nop
49 nop
50
51 bundle5:
52 bic r0, r0, #0xC0000000 @ Mask a register, and
53 ldr r1, [r0], r2 @ use it in register post-index load: should pass.
54 nop @ Don't mask, and
55 ldr r1, [r0], r2 @ use it in register post-index load: ERROR.
56
57 conditional_sandbox:
58 tst r0, #0xC0000000 @ Set Z if the top two bits are clear, and
59 ldreq r1, [r0] @ load: should work.
60
61 tst r0, #0xC0000000 @ Set Z if the top two bits are clear, and
62 ldr r1, [r0] @ load unconditionally: ERROR.
63
64 tst r0, #0xC0000000 @ Set Z if the top two bits are clear, and
65 ldrgt r1, [r0] @ load using wrong predicate: ERROR.
66
67 tsteq r0, #0xC0000000 @ Conditionally set Z if the top two bits are clear,
68 ldrgt r1, [r0] @ and load using wrong predicate: ERROR.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698