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

Side by Side Diff: sandbox/win/src/resolver_64.cc

Issue 1851213002: Remove sandbox on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix nacl compile issues Created 4 years, 8 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
« no previous file with comments | « sandbox/win/src/resolver_32.cc ('k') | sandbox/win/src/restricted_token.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2006-2010 The Chromium 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 #include "sandbox/win/src/resolver.h"
6
7 #include <stddef.h>
8
9 // For placement new. This file must not depend on the CRT at runtime, but
10 // placement operator new is inline.
11 #include <new>
12
13 #include "sandbox/win/src/sandbox_nt_util.h"
14
15 namespace {
16
17 const USHORT kMovRax = 0xB848;
18 const USHORT kJmpRax = 0xe0ff;
19
20 #pragma pack(push, 1)
21 struct InternalThunk {
22 // This struct contains roughly the following code:
23 // 01 48b8f0debc9a78563412 mov rax,123456789ABCDEF0h
24 // ff e0 jmp rax
25 //
26 // The code modifies rax, but that's fine for x64 ABI.
27
28 InternalThunk() {
29 mov_rax = kMovRax;
30 jmp_rax = kJmpRax;
31 interceptor_function = 0;
32 };
33 USHORT mov_rax; // = 48 B8
34 ULONG_PTR interceptor_function;
35 USHORT jmp_rax; // = ff e0
36 };
37 #pragma pack(pop)
38
39 } // namespace.
40
41 namespace sandbox {
42
43 size_t ResolverThunk::GetInternalThunkSize() const {
44 return sizeof(InternalThunk);
45 }
46
47 bool ResolverThunk::SetInternalThunk(void* storage, size_t storage_bytes,
48 const void* original_function,
49 const void* interceptor) {
50 if (storage_bytes < sizeof(InternalThunk))
51 return false;
52
53 InternalThunk* thunk = new(storage) InternalThunk;
54 thunk->interceptor_function = reinterpret_cast<ULONG_PTR>(interceptor);
55
56 return true;
57 }
58
59 NTSTATUS ResolverThunk::ResolveTarget(const void* module,
60 const char* function_name,
61 void** address) {
62 // We don't support sidestep & co.
63 return STATUS_NOT_IMPLEMENTED;
64 }
65
66 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/win/src/resolver_32.cc ('k') | sandbox/win/src/restricted_token.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698