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

Side by Side Diff: src/trusted/platform_qualify/arch/x86_64/nacl_dep_qualify.c

Issue 3539011: Enable check for DEP / NX page protection (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: Modify windows check to use Noel's signal interface Created 10 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 /*
2 * Copyright 2010 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can
4 * be found in the LICENSE file.
5 */
6
7 #include <stddef.h>
8
9 #if !NACL_WINDOWS /* stdint is neither available nor needed on Windows */
10 #include <stdint.h>
11 #endif
12
13 #include "native_client/src/trusted/platform_qualify/nacl_dep_qualify.h"
14 #include "native_client/src/include/nacl_macros.h"
15
16 /* Assembled equivalent of "ret" */
17 #define INST_RET 0xC3
18
19 int NaClCheckDEP() {
20 /*
21 * We require DEP, so forward this call to the OS-specific check routine.
22 */
23 return NaClAttemptToExecuteData();
24 }
25
26 nacl_void_thunk NaClGenerateThunk(char *buf, size_t size_in_bytes) {
27 /*
28 * Place a "ret" at buf.
29 */
30 if (size_in_bytes < 1) return 0;
31
32 *buf = (char) INST_RET;
33
34 /*
35 * ISO C prevents a direct data->function cast, because the pointers aren't
36 * guaranteed to be the same size. For our platforms this is fine, but we
37 * verify at compile time anyway before tricking the compiler:
38 */
39 NACL_ASSERT_SAME_SIZE(char *, nacl_void_thunk);
40 return (nacl_void_thunk) (uintptr_t) buf;
41 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698