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

Unified Diff: src/include/minsfi_priv.h

Issue 546883003: MinSFI: Passing arguments to the entry function (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/include/minsfi.h ('k') | src/include/minsfi_ptr.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/include/minsfi_priv.h
diff --git a/src/include/minsfi_priv.h b/src/include/minsfi_priv.h
index 5702e823eb65a32b48877e8e042908fc376df3d7..61240e53721a45ac9117f5f78e98630f6fd574bc 100644
--- a/src/include/minsfi_priv.h
+++ b/src/include/minsfi_priv.h
@@ -12,6 +12,13 @@
#include <stdint.h>
#include <unistd.h>
+/*
+ * An integer type capable of holding an address converted from an untrusted
+ * pointer. Functions in the minsfi_ptr.h header file convert between
+ * native and untrusted pointers without loss of information.
+ */
+typedef uint32_t sfiptr_t;
+
typedef struct {
uint32_t ptr_size; /* size of sandboxed pointers in bits */
uint32_t dataseg_offset;
@@ -20,7 +27,7 @@ typedef struct {
} MinsfiManifest;
typedef struct {
- uint32_t offset;
+ sfiptr_t offset;
uint32_t length;
} MinsfiMemoryRegion;
@@ -33,7 +40,7 @@ typedef struct {
typedef struct {
char *mem_base;
uint64_t mem_alloc_size;
- uint32_t ptr_mask;
+ sfiptr_t ptr_mask;
MinsfiMemoryLayout mem_layout;
} MinsfiSandbox;
@@ -56,6 +63,21 @@ bool MinsfiGenerateMemoryLayout(const MinsfiManifest *manifest,
bool MinsfiInitSandbox(const MinsfiManifest *manifest, MinsfiSandbox *sb);
/*
+ * Arguments are passed to the sandbox with a single pointer to an array of
+ * integers called 'info' where:
+ * info[0] = argc
+ * info[j+1] = untrusted pointer to argv[j] (for 0 <= j < argc)
+ * The sandbox will expect this array to be stored at the bottom of the
+ * untrusted stack and will start growing the stack backwards from the given
+ * address.
+ *
+ * This function will iterate over the arguments, store the argv[*] strings
+ * at the bottom of the untrusted stack and prepend it with the 'info' data
+ * structure as described above.
+ */
+sfiptr_t MinsfiCopyArguments(int argc, char *argv[], const MinsfiSandbox *sb);
+
+/*
* Unmaps a memory region given by the provided base and the declared pointer
* size of the sandbox. The function returns FALSE if munmap() fails.
*/
« no previous file with comments | « src/include/minsfi.h ('k') | src/include/minsfi_ptr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698