Merge remote-tracking branch 'refs/remotes/spacebeaker/master' into rebase Change-Id: I1faf98a068ee8dd9a8755371de5d449a5a38743b
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg new file mode 100644 index 0000000..8deda18 --- /dev/null +++ b/PREUPLOAD.cfg
@@ -0,0 +1,13 @@ +# Per-project `repo upload` hook settings. +# https://android.googlesource.com/platform/tools/repohooks + +[Options] +ignore_merged_commits = true + +[Builtin Hooks] +cpplint = false +pylint3 = false +clang_format = false + +[Hook Scripts] +yapf-diff = ${REPO_ROOT}/scripts/preupload-hooks/yapf-diff.sh --bypass
diff --git a/libsel4allocman/src/bootstrap.c b/libsel4allocman/src/bootstrap.c index a9ffd35..d5660b7 100644 --- a/libsel4allocman/src/bootstrap.c +++ b/libsel4allocman/src/bootstrap.c
@@ -212,6 +212,10 @@ } for (i = bi->untyped.start; i < bi->untyped.end; i++) { size_t index = i - bi->untyped.start; + if (bi->untypedList[index].isTainted) { + ZF_LOGD("Skip tainted UT slab %ld\n", (unsigned long)index); + continue; + } cspacepath_t slot = bs->boot_cspace.make_path(bs->boot_cspace.cspace, i); size_t size_bits = bi->untypedList[index].sizeBits; uintptr_t paddr = bi->untypedList[index].paddr; @@ -237,8 +241,13 @@ size_t size_bits; uintptr_t paddr; bool device; + bool isTainted; cspacepath_t slot = bs->boot_cspace.make_path(bs->boot_cspace.cspace, - simple_get_nth_untyped(simple, i, &size_bits, &paddr, &device)); + simple_get_nth_untyped(simple, i, &size_bits, &paddr, &device, &isTainted)); + if (isTainted) { + ZF_LOGD("Skip tainted UT slab %ld\n", (unsigned long)i); + continue; + } error = _add_ut(bs, slot, size_bits, paddr, device); if (error) { return error; @@ -1118,8 +1127,13 @@ size_t size_bits; uintptr_t paddr; bool device; - cspacepath_t path = allocman_cspace_make_path(alloc, simple_get_nth_untyped(simple, i, &size_bits, &paddr, &device)); + bool isTainted; + cspacepath_t path = allocman_cspace_make_path(alloc, simple_get_nth_untyped(simple, i, &size_bits, &paddr, &device, &isTainted)); int dev_type = device ? ALLOCMAN_UT_DEV : ALLOCMAN_UT_KERNEL; + if (isTainted) { + ZF_LOGD("Skip tainted slab %ld\n", (unsigned long)i); + continue; + } // If it is regular UT memory, then we add cap and move on. if (dev_type == ALLOCMAN_UT_KERNEL) { error = allocman_utspace_add_uts(alloc, 1, &path, &size_bits, &paddr, dev_type); @@ -1226,6 +1240,10 @@ cspacepath_t slot; size_t size_bits; uintptr_t paddr; + if (bi->untypedList[index].isTainted) { + ZF_LOGD("Skip tainted slab %ld\n", (unsigned long)index); + continue; + } slot = allocman_cspace_make_path(alloc, i); size_bits = bi->untypedList[index].sizeBits; paddr = bi->untypedList[index].paddr;
diff --git a/libsel4debug/src/bootinfo.c b/libsel4debug/src/bootinfo.c index 8b56b9e..8d8b8b1 100644 --- a/libsel4debug/src/bootinfo.c +++ b/libsel4debug/src/bootinfo.c
@@ -27,15 +27,15 @@ printf("Initial thread cnode size: %u\n", (int)info->initThreadCNodeSizeBits); printf("List of untypeds\n"); printf("------------------\n"); - printf("Paddr | Size | Device\n"); + printf("Paddr | Size | Tainted | Device\n"); int sizes[CONFIG_WORD_SIZE] = {0}; for (int i = 0; i < CONFIG_MAX_NUM_BOOTINFO_UNTYPED_CAPS && i < (info->untyped.end - info->untyped.start); i++) { int index = info->untypedList[i].sizeBits; assert(index < ARRAY_SIZE(sizes)); sizes[index]++; - printf("%p | %zu | %d\n", (void *)info->untypedList[i].paddr, (size_t)info->untypedList[i].sizeBits, - (int)info->untypedList[i].isDevice); + printf("%p | %zu | %d | %d\n", (void *)info->untypedList[i].paddr, (size_t)info->untypedList[i].sizeBits, + (int)info->untypedList[i].isTainted, (int)info->untypedList[i].isDevice); } printf("Untyped summary\n");
diff --git a/libsel4platsupport/src/common.c b/libsel4platsupport/src/common.c index a1f130e..7f8e604 100644 --- a/libsel4platsupport/src/common.c +++ b/libsel4platsupport/src/common.c
@@ -56,7 +56,7 @@ static seL4_CPtr device_cap = 0; extern char __executable_start[]; -#if !(defined(CONFIG_LIB_SEL4_PLAT_SUPPORT_USE_SEL4_DEBUG_PUTCHAR) && defined(CONFIG_DEBUG_BUILD)) +#if !(defined(CONFIG_LIB_SEL4_PLAT_SUPPORT_USE_SEL4_DEBUG_PUTCHAR) && defined(CONFIG_PRINTING)) static void *__map_device_page(void *cookie, uintptr_t paddr, size_t size, int cached, ps_mem_flags_t flags); @@ -201,7 +201,7 @@ } memset(&_simple_mem, 0, sizeof(simple_t)); memset(&_vka_mem, 0, sizeof(vka_t)); -#if defined(CONFIG_LIB_SEL4_PLAT_SUPPORT_USE_SEL4_DEBUG_PUTCHAR) && defined(CONFIG_DEBUG_BUILD) +#if defined(CONFIG_LIB_SEL4_PLAT_SUPPORT_USE_SEL4_DEBUG_PUTCHAR) && defined(CONFIG_PRINTING) /* only support putchar on a debug kernel */ setup_status = SETUP_COMPLETE; #else @@ -232,7 +232,7 @@ assert(!"You cannot recover"); return -1; } -#if defined(CONFIG_LIB_SEL4_PLAT_SUPPORT_USE_SEL4_DEBUG_PUTCHAR) && defined(CONFIG_DEBUG_BUILD) +#if defined(CONFIG_LIB_SEL4_PLAT_SUPPORT_USE_SEL4_DEBUG_PUTCHAR) && defined(CONFIG_PRINTING) /* only support putchar on a debug kernel */ setup_status = SETUP_COMPLETE; #else
diff --git a/libsel4simple-default/src/libsel4simple-default.c b/libsel4simple-default/src/libsel4simple-default.c index 46cd314..b432dde 100644 --- a/libsel4simple-default/src/libsel4simple-default.c +++ b/libsel4simple-default/src/libsel4simple-default.c
@@ -133,7 +133,7 @@ return ((seL4_BootInfo *)data)->untyped.end - ((seL4_BootInfo *)data)->untyped.start; } -seL4_CPtr simple_default_nth_untyped(void *data, int n, size_t *size_bits, uintptr_t *paddr, bool *device) +seL4_CPtr simple_default_nth_untyped(void *data, int n, size_t *size_bits, uintptr_t *paddr, bool *device, bool *isTainted) { assert(data); @@ -149,6 +149,9 @@ if (device != NULL) { *device = (bool)bi->untypedList[n].isDevice; } + if (isTainted != NULL) { + *isTainted = (bool)bi->untypedList[n].isTainted; + } return bi->untyped.start + (n); }
diff --git a/libsel4simple/include/simple/simple.h b/libsel4simple/include/simple/simple.h index 3afdbeb..7e162b3 100644 --- a/libsel4simple/include/simple/simple.h +++ b/libsel4simple/include/simple/simple.h
@@ -135,7 +135,7 @@ * @param the physical address of the returned cap */ -typedef seL4_CPtr(*simple_get_nth_untyped_fn)(void *data, int n, size_t *size_bits, uintptr_t *paddr, bool *device); +typedef seL4_CPtr(*simple_get_nth_untyped_fn)(void *data, int n, size_t *size_bits, uintptr_t *paddr, bool *device, bool *isTainted); /** * Get the amount of user image caps available @@ -440,7 +440,7 @@ } static inline seL4_CPtr simple_get_nth_untyped(simple_t *simple, int n, size_t *size_bits, uintptr_t *paddr, - bool *device) + bool *device, bool *isTainted) { if (!simple) { ZF_LOGE("Simple is NULL"); @@ -451,7 +451,7 @@ return seL4_CapNull; } - return simple->nth_untyped(simple->data, n, size_bits, paddr, device); + return simple->nth_untyped(simple->data, n, size_bits, paddr, device, isTainted); } static inline int simple_get_userimage_count(simple_t *simple)
diff --git a/libsel4simple/src/simple.c b/libsel4simple/src/simple.c index d280e6e..64a3cce 100644 --- a/libsel4simple/src/simple.c +++ b/libsel4simple/src/simple.c
@@ -11,7 +11,7 @@ int i; for (i = 0; i < simple_get_untyped_count(simple); i++) { - seL4_CPtr ut_pos = simple_get_nth_untyped(simple, i, NULL, NULL, NULL); + seL4_CPtr ut_pos = simple_get_nth_untyped(simple, i, NULL, NULL, NULL, NULL); if (ut_pos == pos) { return true; }