mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2025-02-23 16:10:13 -05:00
Update LOS20 hardened_malloc patches
This commit is contained in:
parent
b8f39716f1
commit
11039a156d
@ -8,7 +8,7 @@ Subject: [PATCH] workarounds for Pixel 3 SoC era camera driver bugs
|
||||
1 file changed, 28 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/h_malloc.c b/h_malloc.c
|
||||
index aca3f02..32fb863 100644
|
||||
index 91eb6ca..824119b 100644
|
||||
--- a/h_malloc.c
|
||||
+++ b/h_malloc.c
|
||||
@@ -76,6 +76,9 @@ static union {
|
||||
@ -30,7 +30,7 @@ index aca3f02..32fb863 100644
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -693,7 +696,7 @@ static inline void deallocate_small(void *p, const size_t *expected_size) {
|
||||
@@ -694,7 +697,7 @@ static inline void deallocate_small(void *p, const size_t *expected_size) {
|
||||
if (likely(!is_zero_size)) {
|
||||
check_canary(metadata, p, size);
|
||||
|
||||
@ -39,16 +39,16 @@ index aca3f02..32fb863 100644
|
||||
memset(p, 0, size - canary_size);
|
||||
}
|
||||
}
|
||||
@@ -770,7 +773,7 @@ static inline void deallocate_small(void *p, const size_t *expected_size) {
|
||||
metadata->prev = NULL;
|
||||
@@ -772,7 +775,7 @@ static inline void deallocate_small(void *p, const size_t *expected_size) {
|
||||
|
||||
if (c->empty_slabs_total + slab_size > max_empty_slabs_total) {
|
||||
int saved_errno = errno;
|
||||
- if (!memory_map_fixed(slab, slab_size)) {
|
||||
+ if (ro.purge_slabs && !memory_map_fixed(slab, slab_size)) {
|
||||
label_slab(slab, slab_size, class);
|
||||
stats_slab_deallocate(c, slab_size);
|
||||
enqueue_free_slab(c, metadata);
|
||||
@@ -855,7 +858,7 @@ static void regions_quarantine_deallocate_pages(void *p, size_t size, size_t gua
|
||||
@@ -858,7 +861,7 @@ static void regions_quarantine_deallocate_pages(void *p, size_t size, size_t gua
|
||||
return;
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ index aca3f02..32fb863 100644
|
||||
memory_purge(p, size);
|
||||
} else {
|
||||
memory_set_name(p, size, "malloc large quarantine");
|
||||
@@ -1071,6 +1074,21 @@ static inline void enforce_init(void) {
|
||||
@@ -1074,6 +1077,21 @@ static inline void enforce_init(void) {
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ index aca3f02..32fb863 100644
|
||||
COLD static void init_slow_path(void) {
|
||||
static struct mutex lock = MUTEX_INITIALIZER;
|
||||
|
||||
@@ -1085,6 +1103,11 @@ COLD static void init_slow_path(void) {
|
||||
@@ -1088,6 +1106,11 @@ COLD static void init_slow_path(void) {
|
||||
ro.metadata_pkey = pkey_alloc(0, 0);
|
||||
#endif
|
||||
|
||||
@ -91,7 +91,7 @@ index aca3f02..32fb863 100644
|
||||
if (unlikely(sysconf(_SC_PAGESIZE) != PAGE_SIZE)) {
|
||||
fatal_error("runtime page size does not match compile-time page size which is not supported");
|
||||
}
|
||||
@@ -1362,7 +1385,7 @@ EXPORT void *h_calloc(size_t nmemb, size_t size) {
|
||||
@@ -1365,7 +1388,7 @@ EXPORT void *h_calloc(size_t nmemb, size_t size) {
|
||||
}
|
||||
total_size = adjust_size_for_canary(total_size);
|
||||
void *p = alloc(total_size);
|
||||
|
@ -10,10 +10,10 @@ Change-Id: I23513ec0379bbb10829f989690334e9704fd20e2
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/h_malloc.c b/h_malloc.c
|
||||
index 32fb863..3382623 100644
|
||||
index 824119b..bc6eb16 100644
|
||||
--- a/h_malloc.c
|
||||
+++ b/h_malloc.c
|
||||
@@ -1082,7 +1082,8 @@ COLD static void handle_bugs(void) {
|
||||
@@ -1085,7 +1085,8 @@ COLD static void handle_bugs(void) {
|
||||
|
||||
// Pixel 3, Pixel 3 XL, Pixel 3a and Pixel 3a XL camera provider
|
||||
const char camera_provider[] = "/vendor/bin/hw/android.hardware.camera.provider@2.4-service_64";
|
||||
|
@ -10,10 +10,10 @@ Signed-off-by: Tad <tad@spotco.us>
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/h_malloc.c b/h_malloc.c
|
||||
index 3382623..3b2856e 100644
|
||||
index bc6eb16..7f76cad 100644
|
||||
--- a/h_malloc.c
|
||||
+++ b/h_malloc.c
|
||||
@@ -1088,6 +1088,15 @@ COLD static void handle_bugs(void) {
|
||||
@@ -1091,6 +1091,15 @@ COLD static void handle_bugs(void) {
|
||||
ro.purge_slabs = false;
|
||||
ro.region_quarantine_protect = false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user