| Index: src/trusted/validator_arm/testdata-thumb/test_external_jumps.S
|
| diff --git a/src/trusted/validator_arm/testdata-thumb/test_external_jumps.S b/src/trusted/validator_arm/testdata-thumb/test_external_jumps.S
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..6dfb17271160965786ebf933d514c5725602e2dd
|
| --- /dev/null
|
| +++ b/src/trusted/validator_arm/testdata-thumb/test_external_jumps.S
|
| @@ -0,0 +1,45 @@
|
| +@ Copyright (c) 2011 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.
|
| +
|
| +.code 16
|
| +.syntax unified
|
| +.globl _start
|
| +.thumb_func
|
| +_start:
|
| + @ Note: For some reason the start symbol does _NOT_ have the one bit set.
|
| + @ We test bundle-aligned and bundle-unaligned versions of jumps.
|
| +
|
| + @ Jump backwards to addresses that wrap around and have the top bit set.
|
| + @ Such destinations are outside the sandbox's address space and so
|
| + @ could be dangerous, although it's unlikely that anything is mapped
|
| + @ here in the range that an ARM jump instruction could reach.
|
| + b _start - 0x20000 @ disallowed
|
| + b _start - 0x20004 @ disallowed
|
| +
|
| + @ Jump backwards to the syscall trampoline page.
|
| + b _start - 0x8000 @ allowed
|
| + b _start - 0x73FC @ disallowed
|
| + b _start - 0x7fef @ allowed (16-aligned but not 32-aligned)
|
| + b _start - 0x7fdf @ allowed (32-aligned)
|
| + b _start - 0x7020 @ allowed
|
| + b _start - 0x1003 @ disallowed
|
| +
|
| + @ Jump forwards to addresses outside this chunk of code.
|
| + b _start + 0x1000 @ allowed
|
| + b _start + 0x1004 @ disallowed
|
| +
|
| + @ Jump forwards further.
|
| + b _start + 0x100000 @ allowed
|
| + b _start + 0x100004 @ disallowed
|
| +
|
| + @ Jump to zero page.
|
| + @ This is intended to be "b 0b111", but the assembler crashes if I write that.
|
| + @ Obviously this assumes that _start == 0x20000.
|
| + b _start - 0x10000 @ allowed (0b111)
|
| + b _start - 0x0fffc @ disallowed
|
| +
|
| + b end_of_code @ allowed
|
| +
|
| +end_of_code:
|
| + mov r0, r0 @ Necessary for jumping here to be legal (otherwise cs stops short, and umapped regions are treated like trampolines.
|
|
|