Signed-off-by: Tad <tad@spotco.us>
This commit is contained in:
Tad 2022-03-16 11:14:24 -04:00
parent a9f6672fed
commit 352705fbf7
5 changed files with 15 additions and 15 deletions

View File

@ -5,17 +5,16 @@ Subject: [PATCH] use Scudo on 32-bit and hardened_malloc on 64-bit
Co-authored-by: anupritaisno1 <www.anuprita804@gmail.com> Co-authored-by: anupritaisno1 <www.anuprita804@gmail.com>
Signed-off-by: anupritaisno1 <www.anuprita804@gmail.com> Signed-off-by: anupritaisno1 <www.anuprita804@gmail.com>
Change-Id: Ib26dd69ff3bdcf4703ad51541ccb422e31a7c92d [tad@spotco.us]: kept Lineage's scudo 32-bit workaround
[tad@spotco.us]: disabled scudo for 32-bit like Lineage
--- ---
libc/Android.bp | 36 +++++++++++++--------- libc/Android.bp | 37 ++++++++++++++---------
libc/bionic/h_malloc_wrapper.cpp | 51 ++++++++++++++++++++++++++++++++ libc/bionic/h_malloc_wrapper.cpp | 51 ++++++++++++++++++++++++++++++++
libc/bionic/malloc_common.h | 8 +++++ libc/bionic/malloc_common.h | 8 +++++
3 files changed, 81 insertions(+), 14 deletions(-) 3 files changed, 82 insertions(+), 14 deletions(-)
create mode 100644 libc/bionic/h_malloc_wrapper.cpp create mode 100644 libc/bionic/h_malloc_wrapper.cpp
diff --git a/libc/Android.bp b/libc/Android.bp diff --git a/libc/Android.bp b/libc/Android.bp
index ce714054a..78a7ef23c 100644 index 49108bf35..77908e7d9 100644
--- a/libc/Android.bp --- a/libc/Android.bp
+++ b/libc/Android.bp +++ b/libc/Android.bp
@@ -50,6 +50,8 @@ libc_common_flags = [ @@ -50,6 +50,8 @@ libc_common_flags = [
@ -27,7 +26,7 @@ index ce714054a..78a7ef23c 100644
] ]
// Define some common cflags // Define some common cflags
@@ -122,20 +124,18 @@ libc32_scudo_product_variables = { @@ -122,20 +124,19 @@ libc32_scudo_product_variables = {
// ======================================================== // ========================================================
cc_defaults { cc_defaults {
name: "libc_native_allocator_defaults", name: "libc_native_allocator_defaults",
@ -45,6 +44,7 @@ index ce714054a..78a7ef23c 100644
lib32: { lib32: {
product_variables: libc32_scudo_product_variables, product_variables: libc32_scudo_product_variables,
- } - }
+ whole_static_libs: ["libjemalloc5"],
+ }, + },
+ lib64: { + lib64: {
+ cflags: ["-DH_MALLOC_PREFIX"], + cflags: ["-DH_MALLOC_PREFIX"],
@ -56,7 +56,7 @@ index ce714054a..78a7ef23c 100644
} }
// Functions not implemented by jemalloc directly, or that need to // Functions not implemented by jemalloc directly, or that need to
@@ -143,12 +143,20 @@ cc_defaults { @@ -143,12 +144,20 @@ cc_defaults {
cc_library_static { cc_library_static {
name: "libc_jemalloc_wrapper", name: "libc_jemalloc_wrapper",
defaults: ["libc_defaults"], defaults: ["libc_defaults"],

View File

@ -22,10 +22,10 @@ optimization in the future.
create mode 100644 libc/bionic/explicit_bzero.cpp create mode 100644 libc/bionic/explicit_bzero.cpp
diff --git a/libc/Android.bp b/libc/Android.bp diff --git a/libc/Android.bp b/libc/Android.bp
index ce714054a..49108bf35 100644 index 78a7ef23c..4ee36c8df 100644
--- a/libc/Android.bp --- a/libc/Android.bp
+++ b/libc/Android.bp +++ b/libc/Android.bp
@@ -1047,6 +1047,7 @@ cc_library_static { @@ -1055,6 +1055,7 @@ cc_library_static {
"bionic/error.cpp", "bionic/error.cpp",
"bionic/eventfd.cpp", "bionic/eventfd.cpp",
"bionic/exec.cpp", "bionic/exec.cpp",

View File

@ -1,4 +1,4 @@
From 4e6320c247b78f456a83a0393360e7be1105eb5a Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: anupritaisno1 <www.anuprita804@gmail.com> From: anupritaisno1 <www.anuprita804@gmail.com>
Date: Sun, 13 Sep 2020 09:35:41 +0000 Date: Sun, 13 Sep 2020 09:35:41 +0000
Subject: [PATCH] make hardened malloc available to apexes Subject: [PATCH] make hardened malloc available to apexes
@ -8,7 +8,7 @@ Subject: [PATCH] make hardened malloc available to apexes
1 file changed, 1 insertion(+) 1 file changed, 1 insertion(+)
diff --git a/apex/apex.go b/apex/apex.go diff --git a/apex/apex.go b/apex/apex.go
index 7da8e1cf2..66534426a 100644 index f86a0866e..77a75c17f 100644
--- a/apex/apex.go --- a/apex/apex.go
+++ b/apex/apex.go +++ b/apex/apex.go
@@ -570,6 +570,7 @@ func makeApexAvailableBaseline() map[string][]string { @@ -570,6 +570,7 @@ func makeApexAvailableBaseline() map[string][]string {

View File

@ -1,4 +1,4 @@
From 8c0f3c0e04d279daf9f0e9a338c698ed95a026b6 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com> From: Daniel Micay <danielmicay@gmail.com>
Date: Thu, 13 Dec 2018 09:26:25 -0500 Date: Thu, 13 Dec 2018 09:26:25 -0500
Subject: [PATCH] increase max_map_count for hardened malloc Subject: [PATCH] increase max_map_count for hardened malloc
@ -8,10 +8,10 @@ Subject: [PATCH] increase max_map_count for hardened malloc
1 file changed, 2 insertions(+) 1 file changed, 2 insertions(+)
diff --git a/rootdir/init.rc b/rootdir/init.rc diff --git a/rootdir/init.rc b/rootdir/init.rc
index a9af0b094da..9dd54445781 100644 index 23800b021..8125cb410 100644
--- a/rootdir/init.rc --- a/rootdir/init.rc
+++ b/rootdir/init.rc +++ b/rootdir/init.rc
@@ -854,6 +854,8 @@ on boot @@ -865,6 +865,8 @@ on boot
chown root system /sys/block/zram0/writeback chown root system /sys/block/zram0/writeback
chmod 0664 /sys/block/zram0/writeback chmod 0664 /sys/block/zram0/writeback

View File

@ -98,7 +98,7 @@ fi;
if enterAndClear "build/soong"; then if enterAndClear "build/soong"; then
applyPatch "$DOS_PATCHES/android_build_soong/0001-Enable_fwrapv.patch"; #Use -fwrapv at a minimum (GrapheneOS) applyPatch "$DOS_PATCHES/android_build_soong/0001-Enable_fwrapv.patch"; #Use -fwrapv at a minimum (GrapheneOS)
if [ "$DOS_GRAPHENE_MALLOC" = true ]; then applyPatch "$DOS_PATCHES/android_bionic/0002-hm_apex.patch"; fi; #(GrapheneOS) if [ "$DOS_GRAPHENE_MALLOC" = true ]; then applyPatch "$DOS_PATCHES/android_build_soong/0002-hm_apex.patch"; fi; #(GrapheneOS)
fi; fi;
if enterAndClear "device/qcom/sepolicy-legacy"; then if enterAndClear "device/qcom/sepolicy-legacy"; then