mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-10-01 01:35:54 -04:00
16.0: switch to latest hardened_malloc revision
kipper compiles Signed-off-by: Tavi <tavi@divested.dev>
This commit is contained in:
parent
ae523985ca
commit
e195e38150
@ -68,7 +68,7 @@ external/caliper 4a0d9aba0856d0aa965d5653bfa4c138f0e8a8ba
|
||||
external/cblas d063db8bdddfcde61e4bad3bfe65941fd73e8094
|
||||
external/chromium-libpac 0ac78251d11006d764ba1aad8cc0867827fafe5c
|
||||
external/chromium-trace 8b2c0074e71a8086dee98ca8730acfdc5eddf7a1
|
||||
external/chromium-webview 7a167062342c2f6dc6b6a152dd1021735287d0b9
|
||||
external/chromium-webview 2b59e6725f2fb27a8bf8f4d048f1e6c1271e5144
|
||||
external/clang 751a76679b0fb5798ea6cab75906df07edcab315
|
||||
external/cmockery 9199c7bfafefea32d1884182fa655b6e4578c1c4
|
||||
external/compiler-rt 0c46c9e892a3f68420635032ef2f6152dabd197c
|
||||
|
@ -67,7 +67,7 @@ external/capstone 6788a4139092f179005f7cdbf181ba24b60b6113
|
||||
external/cblas ddf5f49cb53866fbc503a6349bf44bac24a6963d
|
||||
external/chromium-libpac dff5ddb8d28f6ac9a86eb28763b4313f6f72eec5
|
||||
external/chromium-trace b2cf025c7d5cebd43084f38c6c7ff9cc17da428a
|
||||
external/chromium-webview 7a167062342c2f6dc6b6a152dd1021735287d0b9
|
||||
external/chromium-webview 2b59e6725f2fb27a8bf8f4d048f1e6c1271e5144
|
||||
external/clang f9d2af42fc6d74c28893af371e4647158eaba66c
|
||||
external/cmockery 9199c7bfafefea32d1884182fa655b6e4578c1c4
|
||||
external/cn-cbor 7fe9f01990a97be4df5e46d2decd894c06678072
|
||||
|
@ -80,7 +80,7 @@
|
||||
<project path="external/svox" name="platform/external/svox" groups="pdk" remote="aosp" revision="master" />
|
||||
|
||||
<!-- GrapheneOS -->
|
||||
<project path="external/hardened_malloc" name="GrapheneOS/hardened_malloc" remote="github" revision="464bfd4d829927f19fd5d2729a101ee241319d1e" />
|
||||
<project path="external/hardened_malloc" name="GrapheneOS/hardened_malloc" remote="github" revision="749640c274d54e084505a24fa758bcb5f96a25ef" />
|
||||
<!-- END OF ADDITIONAL REPOS -->
|
||||
|
||||
<!-- START OF DEVICE REPOS -->
|
||||
|
@ -1,66 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Thu, 28 May 2020 20:19:14 -0400
|
||||
Subject: [PATCH] workaround for audio service sorting bug
|
||||
|
||||
---
|
||||
h_malloc.c | 15 ++++++++++++---
|
||||
1 file changed, 12 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/h_malloc.c b/h_malloc.c
|
||||
index 8d15ab2..dbedbd4 100644
|
||||
--- a/h_malloc.c
|
||||
+++ b/h_malloc.c
|
||||
@@ -85,6 +85,7 @@ static union {
|
||||
bool zero_on_free;
|
||||
bool purge_slabs;
|
||||
bool region_quarantine_protect;
|
||||
+ bool slot_randomize;
|
||||
};
|
||||
char padding[PAGE_SIZE];
|
||||
} ro __attribute__((aligned(PAGE_SIZE)));
|
||||
@@ -355,7 +356,7 @@ static u64 get_mask(size_t slots) {
|
||||
}
|
||||
|
||||
static size_t get_free_slot(struct random_state *rng, size_t slots, struct slab_metadata *metadata) {
|
||||
- if (SLOT_RANDOMIZE) {
|
||||
+ if (ro.slot_randomize) {
|
||||
// randomize start location for linear search (uniform random choice is too slow)
|
||||
unsigned random_index = get_random_u16_uniform(rng, slots);
|
||||
unsigned first_bitmap = random_index / 64;
|
||||
@@ -1061,17 +1062,24 @@ static inline void enforce_init(void) {
|
||||
}
|
||||
}
|
||||
|
||||
-COLD static void handle_hal_bugs(void) {
|
||||
+COLD static void handle_bugs(void) {
|
||||
char path[256];
|
||||
if (readlink("/proc/self/exe", path, sizeof(path)) == -1) {
|
||||
return;
|
||||
}
|
||||
+
|
||||
const char camera_provider[] = "/vendor/bin/hw/android.hardware.camera.provider@2.4-service_64";
|
||||
if (strcmp(camera_provider, path) == 0) {
|
||||
ro.zero_on_free = false;
|
||||
ro.purge_slabs = false;
|
||||
ro.region_quarantine_protect = false;
|
||||
}
|
||||
+
|
||||
+ // DeviceDescriptor sorting wrongly relies on malloc addresses
|
||||
+ const char audio_service[] = "/system/bin/audioserver";
|
||||
+ if (strcmp(audio_service, path) == 0) {
|
||||
+ ro.slot_randomize = false;
|
||||
+ }
|
||||
}
|
||||
|
||||
COLD static void init_slow_path(void) {
|
||||
@@ -1100,7 +1108,8 @@ COLD static void init_slow_path(void) {
|
||||
ro.purge_slabs = true;
|
||||
ro.zero_on_free = ZERO_ON_FREE;
|
||||
ro.region_quarantine_protect = true;
|
||||
- handle_hal_bugs();
|
||||
+ ro.slot_randomize = SLOT_RANDOMIZE;
|
||||
+ handle_bugs();
|
||||
|
||||
if (sysconf(_SC_PAGESIZE) != PAGE_SIZE) {
|
||||
fatal_error("page size mismatch");
|
@ -1,25 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tad <tad@spotco.us>
|
||||
Date: Tue, 15 Mar 2022 22:18:26 -0400
|
||||
Subject: [PATCH] Expand workaround to all camera executables
|
||||
|
||||
Signed-off-by: Tad <tad@spotco.us>
|
||||
Change-Id: I23513ec0379bbb10829f989690334e9704fd20e2
|
||||
---
|
||||
h_malloc.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/h_malloc.c b/h_malloc.c
|
||||
index dbedbd4..d0cf881 100644
|
||||
--- a/h_malloc.c
|
||||
+++ b/h_malloc.c
|
||||
@@ -1069,7 +1069,8 @@ COLD static void handle_bugs(void) {
|
||||
}
|
||||
|
||||
const char camera_provider[] = "/vendor/bin/hw/android.hardware.camera.provider@2.4-service_64";
|
||||
- if (strcmp(camera_provider, path) == 0) {
|
||||
+ // Any camera executable on system partition
|
||||
+ if (strcmp(camera_provider, path) == 0 || (strstr(path, "camera") != NULL && (strncmp("/system", path, 7) == 0 || strncmp("/vendor", path, 7) == 0))) {
|
||||
ro.zero_on_free = false;
|
||||
ro.purge_slabs = false;
|
||||
ro.region_quarantine_protect = false;
|
@ -130,11 +130,11 @@ fi;
|
||||
#sed -i -e '76,78d;' Android.bp; #fix compile under A10
|
||||
#awk -i inplace '!/ramdisk_available/' Android.bp; #fix compile under A10
|
||||
#git revert --no-edit 8974af86d12f7e29b54b5090133ab3d7eea0e519; #fix compile under A10
|
||||
#git revert --no-edit a28da3c65aed0528036da9ebd33e0c05b2c5884a; #fix compile under A8
|
||||
#git revert --no-edit a28da3c65aed0528036da9ebd33e0c05b2c5884a; #fix compile under A9
|
||||
#mv include/h_malloc.h . ; #fix compile under A10
|
||||
#awk -i inplace '!/recovery_available/' Android.bp; #fix compile under A9
|
||||
#awk -i inplace '!/system_shared_libs/' Android.bp; #fix compile under A9
|
||||
#sed -i 's/c17/c11/' Android.bp; #fix compile under A8
|
||||
#sed -i 's/c17/c11/' Android.bp; #fix compile under A9
|
||||
#sed -i 's/struct mallinfo info = {0};/struct mallinfo info = {};/' h_malloc.c; #fix compile under A8
|
||||
#fi;
|
||||
#fi;
|
||||
|
@ -135,11 +135,11 @@ rm -rfv androidtest; #fix compile under A11
|
||||
sed -i -e '76,78d;' Android.bp; #fix compile under A10
|
||||
awk -i inplace '!/ramdisk_available/' Android.bp; #fix compile under A10
|
||||
git revert --no-edit 8974af86d12f7e29b54b5090133ab3d7eea0e519; #fix compile under A10
|
||||
git revert --no-edit a28da3c65aed0528036da9ebd33e0c05b2c5884a; #fix compile under A8
|
||||
git revert --no-edit a28da3c65aed0528036da9ebd33e0c05b2c5884a; #fix compile under A9
|
||||
mv include/h_malloc.h . ; #fix compile under A10
|
||||
awk -i inplace '!/recovery_available/' Android.bp; #fix compile under A9
|
||||
awk -i inplace '!/system_shared_libs/' Android.bp; #fix compile under A9
|
||||
sed -i 's/c17/c11/' Android.bp; #fix compile under A8
|
||||
sed -i 's/c17/c11/' Android.bp; #fix compile under A9
|
||||
sed -i 's/struct mallinfo info = {0};/struct mallinfo info = {};/' h_malloc.c; #fix compile under A8
|
||||
fi;
|
||||
fi;
|
||||
|
@ -146,8 +146,23 @@ fi;
|
||||
|
||||
if [ "$DOS_GRAPHENE_MALLOC" = true ]; then
|
||||
if enterAndClear "external/hardened_malloc"; then
|
||||
applyPatch "$DOS_PATCHES_COMMON/android_external_hardened_malloc-legacy/0001-Broken_Audio.patch"; #DeviceDescriptor sorting wrongly relies on malloc addresses (GrapheneOS)
|
||||
applyPatch "$DOS_PATCHES_COMMON/android_external_hardened_malloc-legacy/0002-Broken_Cameras.patch"; #Expand workaround to all camera executables (DivestOS)
|
||||
applyPatch "$DOS_PATCHES_COMMON/android_external_hardened_malloc-modern/0001-Broken_Cameras-1.patch"; #Workarounds for Pixel 3 SoC era camera driver bugs (GrapheneOS)
|
||||
applyPatch "$DOS_PATCHES_COMMON/android_external_hardened_malloc-modern/0001-Broken_Cameras-2.patch"; #Expand workaround to all camera executables (DivestOS)
|
||||
applyPatch "$DOS_PATCHES_COMMON/android_external_hardened_malloc-modern/0002-Broken_Displays.patch"; #Add workaround for OnePlus 8 & 9 display driver crash (DivestOS)
|
||||
applyPatch "$DOS_PATCHES_COMMON/android_external_hardened_malloc-modern/0003-Broken_Audio.patch"; #Workaround for audio service sorting bug (GrapheneOS)
|
||||
sed -i 's/34359738368/2147483648/' Android.bp; #revert 48-bit address space requirement
|
||||
sed -i -e '76,78d;' Android.bp; #fix compile under A13
|
||||
sed -i -e '22,24d;' androidtest/Android.bp; #fix compile under A12
|
||||
awk -i inplace '!/vendor_ramdisk_available/' Android.bp; #fix compile under A11
|
||||
rm -rfv androidtest; #fix compile under A11
|
||||
sed -i -e '76,78d;' Android.bp; #fix compile under A10
|
||||
awk -i inplace '!/ramdisk_available/' Android.bp; #fix compile under A10
|
||||
git revert --no-edit 8974af86d12f7e29b54b5090133ab3d7eea0e519; #fix compile under A10
|
||||
git revert --no-edit a28da3c65aed0528036da9ebd33e0c05b2c5884a; #fix compile under A9
|
||||
mv include/h_malloc.h . ; #fix compile under A10
|
||||
awk -i inplace '!/recovery_available/' Android.bp; #fix compile under A9
|
||||
awk -i inplace '!/system_shared_libs/' Android.bp; #fix compile under A9
|
||||
sed -i 's/c17/c11/' Android.bp; #fix compile under A9
|
||||
fi;
|
||||
fi;
|
||||
|
||||
@ -786,6 +801,7 @@ cd "$DOS_BUILD_BASE";
|
||||
|
||||
sed -i 's/^YYLTYPE yylloc;/extern YYLTYPE yylloc;/' kernel/*/*/scripts/dtc/dtc-lexer.l* || true; #Fix builds with GCC 10
|
||||
rm -v kernel/*/*/drivers/staging/greybus/tools/Android.mk || true;
|
||||
sed -i '117ioutputEntry.setCompressedSize(-1);' external/jarjar/src/main/com/tonicsystems/jarjar/util/IoUtil.java; #Fix compile error
|
||||
#
|
||||
#END OF DEVICE CHANGES
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user