Repository navigation
i#1726: Port Umbra to ARM #2044
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
37c1960
i#1726: Port Umbra to ARM
toshipiazza bd4cecd
Addresses reviewer concerns
toshipiazza 8fa6b9e
Addresses reviewer concerns
toshipiazza 506cf8c
Merge branch 'master' into i1726-port-umbra-arm
toshipiazza 2da3869
Adds Umbra tests for umbra_{read,write}_shadow_memory()
toshipiazza 89120fe
Re-add /Zi /Ob0 to compile flags to prevent test failures on Windows
toshipiazza 8a2fd10
Fixes clang build (hopefully)
toshipiazza 3aea45a
Addresses reviewer concerns
toshipiazza c02b59e
Adds valid SEH header to umbra_app
toshipiazza 9cc4bfb
Adds more tests
toshipiazza 214d3e8
Fixes Windows build
toshipiazza f75350d
Attempts to fix travis build
toshipiazza 6f737bf
Add xref to original travis issue in .travis.yml
toshipiazza File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,167 @@ | ||
| /* ********************************************************** | ||
| * Copyright (c) 2017 Google, Inc. All rights reserved. | ||
| * **********************************************************/ | ||
|
|
||
| /* | ||
| * Redistribution and use in source and binary forms, with or without | ||
| * modification, are permitted provided that the following conditions are met: | ||
| * | ||
| * * Redistributions of source code must retain the above copyright notice, | ||
| * this list of conditions and the following disclaimer. | ||
| * | ||
| * * Redistributions in binary form must reproduce the above copyright notice, | ||
| * this list of conditions and the following disclaimer in the documentation | ||
| * and/or other materials provided with the distribution. | ||
| * | ||
| * * Neither the name of Google, Inc. nor the names of its contributors may be | ||
| * used to endorse or promote products derived from this software without | ||
| * specific prior written permission. | ||
| * | ||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| * ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE, INC. OR CONTRIBUTORS BE LIABLE | ||
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||
| * DAMAGE. | ||
| */ | ||
|
|
||
| #ifndef ASM_CODE_ONLY /* C code ***********************************************/ | ||
|
|
||
| #include <stdio.h> | ||
| #include <stdlib.h> | ||
|
|
||
| void asm_test(void); | ||
| #ifdef ARM | ||
| void asm_test_thumb(void); | ||
| #endif | ||
|
|
||
| int | ||
| main(int argc, char *argv[]) | ||
| { | ||
| asm_test(); | ||
| #ifdef ARM | ||
| asm_test_thumb(); | ||
| #endif | ||
| printf("TEST PASSED\n"); | ||
| return 0; | ||
| } | ||
|
|
||
| #else /* asm code *************************************************************/ | ||
| #include "cpp2asm_defines.h" | ||
| #include "umbra_test_shared.h" | ||
| START_FILE | ||
|
|
||
| #ifdef X64 | ||
| # define FRAME_PADDING 8 | ||
| #else | ||
| # define FRAME_PADDING 0 | ||
| #endif | ||
|
|
||
| #ifdef ARM | ||
| .code 32 /* ARM */ | ||
| #endif | ||
|
|
||
| #define FUNCNAME asm_test | ||
| DECLARE_FUNC_SEH(FUNCNAME) | ||
| GLOBAL_LABEL(FUNCNAME:) | ||
| #ifdef X86 | ||
| /* push callee-saved registers */ | ||
| PUSH_SEH(REG_XBX) | ||
| PUSH_SEH(REG_XBP) | ||
| PUSH_SEH(REG_XSI) | ||
| PUSH_SEH(REG_XDI) | ||
| sub REG_XSP, FRAME_PADDING /* align */ | ||
| mov REG_XBP, REG_XSP | ||
| sub REG_XSP, 4 | ||
| END_PROLOG | ||
| jmp test1 | ||
|
|
||
| /* test 1 - write to memory */ | ||
| test1: | ||
| mov REG_XDI, UMBRA_TEST_1_ASM | ||
| mov REG_XDI, UMBRA_TEST_1_ASM | ||
| mov [REG_XBP], REG_XDI | ||
|
|
||
| jmp test2 | ||
|
|
||
| /* test 2 - read from memory */ | ||
| test2: | ||
| mov REG_XDI, UMBRA_TEST_2_ASM | ||
| mov REG_XDI, UMBRA_TEST_2_ASM | ||
| mov REG_XDI, [REG_XBP] | ||
|
|
||
| jmp epilog | ||
|
|
||
| epilog: | ||
| mov REG_XSP, REG_XBP | ||
| add REG_XSP, FRAME_PADDING /* make a legal SEH64 epilog */ | ||
| pop REG_XDI | ||
| pop REG_XSI | ||
| pop REG_XBP | ||
| pop REG_XBX | ||
| ret | ||
| #elif defined(ARM) | ||
| push {r4, r7, lr} | ||
| sub sp, sp, #4 | ||
| add r7, sp, #0 | ||
| b test1 | ||
|
|
||
| /* test 1 - write to memory */ | ||
| test1: | ||
| movw r4, UMBRA_TEST_1_ASM | ||
| movw r4, UMBRA_TEST_1_ASM | ||
| str r4, [r7] | ||
| b test2 | ||
|
|
||
| /* test 2 - read from memory */ | ||
| test2: | ||
| movw r4, UMBRA_TEST_2_ASM | ||
| movw r4, UMBRA_TEST_2_ASM | ||
| ldr r4, [r7] | ||
| b epilog | ||
|
|
||
| epilog: | ||
| add sp, sp, #4 | ||
| pop {r4, r7, pc} | ||
| #endif /* ARM */ | ||
| END_FUNC(FUNCNAME) | ||
| #undef FUNCNAME | ||
|
|
||
| #ifdef ARM | ||
| .code 16 /* Thumb */ | ||
| #define FUNCNAME asm_test_thumb | ||
| DECLARE_FUNC(FUNCNAME) | ||
| GLOBAL_LABEL(FUNCNAME:) | ||
| push {r4, r7, lr} | ||
| sub sp, sp, #4 | ||
| add r7, sp, #0 | ||
| b test3 | ||
|
|
||
| /* test 1 - write to memory */ | ||
| test3: | ||
| movw r4, UMBRA_TEST_1_ASM | ||
| movw r4, UMBRA_TEST_1_ASM | ||
| str r4, [r7] | ||
| b test4 | ||
|
|
||
| /* test 2 - read from memory */ | ||
| test4: | ||
| movw r4, UMBRA_TEST_2_ASM | ||
| movw r4, UMBRA_TEST_2_ASM | ||
| ldr r4, [r7] | ||
| b epilog2 | ||
|
|
||
| epilog2: | ||
| add sp, sp, #4 | ||
| pop {r4, r7, pc} | ||
| END_FUNC(FUNCNAME) | ||
| #undef FUNCNAME | ||
| #endif /* ARM */ | ||
|
|
||
| END_FILE | ||
| #endif |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On my box, /bin/sh -> /bin/dash, and I believe that this script uses a bash-ism. Not sure why I only saw this recently though. Should I change this back?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Making it bash seems fine: we did the same thing with git_review.sh