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

Unified Diff: src/trusted/validator_mips/testdata/test_tp_access.S

Issue 1535443005: [MIPS] Make validator allow only two load patterns via $t8 (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client@master
Patch Set: Minor update. Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/trusted/validator_mips/model.h ('k') | src/trusted/validator_mips/testdata/test_tp_access.err » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/trusted/validator_mips/testdata/test_tp_access.S
diff --git a/src/trusted/validator_mips/testdata/test_tp_access.S b/src/trusted/validator_mips/testdata/test_tp_access.S
new file mode 100644
index 0000000000000000000000000000000000000000..5871982946a13482fb34a9d4af1b50b84c0381c4
--- /dev/null
+++ b/src/trusted/validator_mips/testdata/test_tp_access.S
@@ -0,0 +1,72 @@
+# Copyright 2015 The Native Client Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Several test cases are implemented in this file:
+# 1. Test if regular way to access thread pointers is allowed.
+# 2. Test different random examples of forbidden stores through $t8.
+# 3. Test different random examples of forbidden loads through $t8.
+
+
+ .align 4
+ .globl __start
+__start:
+ .set noreorder
+ .set mips32r2
+
+ # Test valid tp access
+valid_load_access:
+ lw $a0, 0($t8) # OK
+ lw $a0, 4($t8) # OK
+ nop
+ nop
+
+ # Test invalid tp access
+invalid_store_access:
+ sb $a0, 4($t8) # Error, forbidden thread pointer access.
+ sc $a0, 4($t8) # Error, forbidden thread pointer access.
+ sdc1 $0, 4($t8) # Error, forbidden thread pointer access.
+ sdc2 $8, 4($t8) # Error, forbidden thread pointer access.
+
+ sh $a0, 4($t8) # Error, forbidden thread pointer access.
+ sw $a0, 4($t8) # Error, forbidden thread pointer access.
+ swc1 $f2, 4($t8) # Error, forbidden thread pointer access.
+ swc2 $22, 4($t8) # Error, forbidden thread pointer access.
+
+ swl $a0, 4($t8) # Error, forbidden thread pointer access.
+ swr $a0, 4($t8) # Error, forbidden thread pointer access.
+ sdxc1 $f6, $a2($t8) # Error, forbidden instruction.
+ suxc1 $f4, $t8($t8) # Error, forbidden instruction.
+
+ swxc1 $f4, $t8($t8) # Error, forbidden instruction.
+ nop
+ nop
+ nop
+
+invalid_load_access:
+ lb $a0, 4($t8) # Error, forbidden thread pointer access.
+ lw $a0, 8($t8) # Error, forbidden thread pointer access.
+ lbu $a0, 4($t8) # Error, forbidden thread pointer access.
+ ldc1 $f0, 4($t8) # Error, forbidden thread pointer access.
+
+ ldc2 $10, -24($t8) # Error, forbidden thread pointer access.
+ lh $a0, 4($t8) # Error, forbidden thread pointer access.
+ lhu $a0, 4($t8) # Error, forbidden thread pointer access.
+ ll $a0, 4($t8) # Error, forbidden thread pointer access.
+
+ lwc1 $f0, 4($t8) # Error, forbidden thread pointer access.
+ lwc2 $10, 4($t8) # Error, forbidden thread pointer access.
+ lwl $a0, 4($t8) # Error, forbidden thread pointer access.
+ lwr $a0, 4($t8) # Error, forbidden thread pointer access.
+
+ ldxc1 $f0, $0($t8) # Error, forbidden instruction.
+ luxc1 $f0, $a2($t8) # Error, forbidden instruction.
+ lwxc1 $f6, $v0($t8) # Error, forbidden instruction.
+ nop
+
+ .set dsp
+ lbux $a3, $t2($t8) # Error, forbidden instruction.
+ lhx $a1, $a2($t8) # Error, forbidden instruction.
+ lwx $t1, $t2($t8) # Error, forbidden instruction.
+ nop
+end_of_code:
« no previous file with comments | « src/trusted/validator_mips/model.h ('k') | src/trusted/validator_mips/testdata/test_tp_access.err » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698