aboutsummaryrefslogtreecommitdiff
path: root/patches
diff options
context:
space:
mode:
authorMoyster <oysterized@gmail.com>2018-01-31 16:48:33 +0100
committerMoyster <oysterized@gmail.com>2018-05-26 14:02:27 +0200
commitdb9f3c5a0dd5203ccf5f55eeec9f0859038c1f65 (patch)
tree3af96ab79a372a3da2e19379787b2b7ae0d230a8 /patches
parent31d8eb6c36643519d78d8ae5d762e57e7f3acfb3 (diff)
patch: remove forced_shim_libs, remove cap_sys_nice on sf (easier to
build on non-lineage based roms)
Diffstat (limited to 'patches')
-rw-r--r--patches/bionic/0001-linker-Allow-devices-to-force-shim-libs.patch147
-rw-r--r--patches/build/soong/0002-soong-Add-a-function-to-return-list-of-forced-shim-l.patch25
-rw-r--r--patches/install.sh2
-rw-r--r--patches/system/core/0001-fs_config-remove-cap_sys_nice-from-SF-fixes-for-old-.patch31
-rw-r--r--patches/vendor/lineage/0001-lineage-Export-forced-shims-list-to-soong.patch37
5 files changed, 32 insertions, 210 deletions
diff --git a/patches/bionic/0001-linker-Allow-devices-to-force-shim-libs.patch b/patches/bionic/0001-linker-Allow-devices-to-force-shim-libs.patch
deleted file mode 100644
index bcab3a5..0000000
--- a/patches/bionic/0001-linker-Allow-devices-to-force-shim-libs.patch
+++ /dev/null
@@ -1,147 +0,0 @@
-From 9a8e59412302d554788422549d20c65c5ba2993f Mon Sep 17 00:00:00 2001
-From: "Christopher R. Palmer" <crpalmer@gmail.com>
-Date: Thu, 16 Mar 2017 21:33:27 -0400
-Subject: [PATCH] linker: Allow devices to force shim libs
-
-There are certain contexts in which the environment is cleansed.
-Two examples that I know of are gps processes and mali gles blobs.
-
-Generally, it is a better idea to use the environment variable because
-then you can customize it on a per-service / script level and it is
-easier to test and debug changes on the fly.
-
-However, to avoid having libdimytry hexedit these blobs, allow a
-last resort device level forced list of shim libraries.
-
-[rashed]
-Adapt for blueprint and add go module for dynamic C++ flag setting
-
-Change-Id: I2f6aff9325beb5aa2f748bf72e6c3c0535d5aac2
----
- linker/Android.bp | 20 ++++++++++++++++++
- linker/forced-shims.go | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++
- linker/linker.cpp | 11 ++++++++--
- 3 files changed, 84 insertions(+), 2 deletions(-)
- create mode 100644 linker/forced-shims.go
-
-diff --git a/linker/Android.bp b/linker/Android.bp
-index 2e2ef3342..182a70353 100644
---- a/linker/Android.bp
-+++ b/linker/Android.bp
-@@ -1,3 +1,23 @@
-+bootstrap_go_package {
-+ name: "soong-forced-shims",
-+ pkgPath: "android/soong/forced_shims",
-+ deps: [
-+ "blueprint",
-+ "blueprint-pathtools",
-+ "soong",
-+ "soong-android",
-+ "soong-cc",
-+ ],
-+ srcs: [
-+ "forced-shims.go",
-+ ],
-+ pluginFor: ["soong_build"],
-+}
-+
-+forced_shims_defaults {
-+ name: "forced_shims_defaults",
-+}
-+
- cc_library_static {
- name: "liblinker_malloc",
- defaults: ["linux_bionic_supported"],
-diff --git a/linker/forced-shims.go b/linker/forced-shims.go
-new file mode 100644
-index 000000000..4a973be62
---- /dev/null
-+++ b/linker/forced-shims.go
-@@ -0,0 +1,55 @@
-+// Copyright (C) 2017 The LineageOS Project
-+//
-+// Licensed under the Apache License, Version 2.0 (the "License");
-+// you may not use this file except in compliance with the License.
-+// You may obtain a copy of the License at
-+//
-+// http://www.apache.org/licenses/LICENSE-2.0
-+//
-+// Unless required by applicable law or agreed to in writing, software
-+// distributed under the License is distributed on an "AS IS" BASIS,
-+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-+// See the License for the specific language governing permissions and
-+// limitations under the License.
-+package lineage;
-+
-+import (
-+ "android/soong/android"
-+ "android/soong/cc"
-+
-+ "github.com/google/blueprint"
-+)
-+
-+func init() {
-+ android.RegisterModuleType("forced_shims_defaults", forcedShimsFactory)
-+}
-+
-+func forcedShimsFactory() (blueprint.Module, []interface{}) {
-+ module, props := cc.DefaultsFactory()
-+ android.AddLoadHook(module, forcedShims)
-+
-+ return module, props
-+}
-+
-+func forcedShims(ctx android.LoadHookContext) {
-+ type props struct {
-+ Cppflags []string
-+ }
-+
-+ p := &props{}
-+ p.Cppflags = globalDefaults(ctx)
-+
-+ ctx.AppendProperties(p)
-+}
-+
-+func globalDefaults(ctx android.BaseContext) ([]string) {
-+ var cppFlags []string
-+
-+ device_forced_shim_libs := ctx.DeviceConfig().ForcedShims()
-+ if (len(device_forced_shim_libs) > 0) {
-+ cppFlags = append(cppFlags, "-DFORCED_SHIM_LIBS=")
-+ cppFlags = append(cppFlags, device_forced_shim_libs)
-+ }
-+
-+ return cppFlags
-+}
-diff --git a/linker/linker.cpp b/linker/linker.cpp
-index 8cafa6ea8..469eb4ab8 100644
---- a/linker/linker.cpp
-+++ b/linker/linker.cpp
-@@ -715,8 +715,7 @@ static void reset_g_active_shim_libs(void) {
- }
- }
-
--void parse_LD_SHIM_LIBS(const char* path) {
-- g_ld_all_shim_libs.clear();
-+void parse_shim_libs(const char* path) {
- if (path != nullptr) {
- // We have historically supported ':' as well as ' ' in LD_SHIM_LIBS.
- for (const auto& pair : android::base::Split(path, " :")) {
-@@ -730,6 +729,14 @@ void parse_LD_SHIM_LIBS(const char* path) {
- reset_g_active_shim_libs();
- }
-
-+void parse_LD_SHIM_LIBS(const char* path) {
-+ g_ld_all_shim_libs.clear();
-+#ifdef FORCED_SHIM_LIBS
-+ parse_shim_libs(FORCED_SHIM_LIBS);
-+#endif
-+ parse_shim_libs(path);
-+}
-+
- template<typename F>
- static void for_each_matching_shim(const char *const path, F action) {
- if (path == nullptr) return;
---
-2.11.0
-
diff --git a/patches/build/soong/0002-soong-Add-a-function-to-return-list-of-forced-shim-l.patch b/patches/build/soong/0002-soong-Add-a-function-to-return-list-of-forced-shim-l.patch
deleted file mode 100644
index 479a4a5..0000000
--- a/patches/build/soong/0002-soong-Add-a-function-to-return-list-of-forced-shim-l.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From cf146811021a5f267faef7d191aa3c3a073d2dfa Mon Sep 17 00:00:00 2001
-From: Mister Oyster <oysterized@gmail.com>
-Date: Mon, 18 Dec 2017 13:14:35 +0100
-Subject: [PATCH] soong: Add a function to return list of forced shim libs
-
-Change-Id: I87343b922019db4240148ed9f5c04bfa37f9dd4b
----
- android/config.go | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/android/config.go b/android/config.go
-index 268d121..4bae523 100644
---- a/android/config.go
-+++ b/android/config.go
-@@ -501,3 +501,7 @@ func (c *deviceConfig) CoverageEnabledForPath(path string) bool {
- }
- return coverage
- }
-+
-+func (c *deviceConfig) ForcedShims() string {
-+ return String(c.config.ProductVariables.Lineage.Linker_forced_shim_libs)
-+}
---
-2.11.0
-
diff --git a/patches/install.sh b/patches/install.sh
index 9073f82..43ce4a0 100644
--- a/patches/install.sh
+++ b/patches/install.sh
@@ -4,7 +4,7 @@ echo $1
rootdirectory="$PWD"
# ---------------------------------
-dirs="bionic build/make/core build/soong frameworks/av frameworks/base hardware/interfaces system/core vendor/lineage"
+dirs="build/make/core build/soong frameworks/av frameworks/base hardware/interfaces system/core"
# red + nocolor
RED='\033[0;31m'
diff --git a/patches/system/core/0001-fs_config-remove-cap_sys_nice-from-SF-fixes-for-old-.patch b/patches/system/core/0001-fs_config-remove-cap_sys_nice-from-SF-fixes-for-old-.patch
new file mode 100644
index 0000000..4771b6e
--- /dev/null
+++ b/patches/system/core/0001-fs_config-remove-cap_sys_nice-from-SF-fixes-for-old-.patch
@@ -0,0 +1,31 @@
+From 6f8136eb44240ef1d77d02d5119d689183831335 Mon Sep 17 00:00:00 2001
+From: Dmitry Smirnov <divis1969@gmail.com>
+Date: Mon, 14 Nov 2016 23:30:38 +0300
+Subject: [PATCH] Remove CAP_SYS_NICE from surfaceflinger
+
+This capability causes surfaceflinger to be treated as a secure process
+(AT_SECURE) and linker ignores LD_PRELOAD and LD_SHIM_LIBS but we need these!
+
+Change-Id: Ie9451a970bf43ec864b626e4d3e646bd17869c67
+---
+ libcutils/fs_config.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/libcutils/fs_config.cpp b/libcutils/fs_config.cpp
+index cb15b57b8..97d824979 100644
+--- a/libcutils/fs_config.cpp
++++ b/libcutils/fs_config.cpp
+@@ -182,8 +182,8 @@ static const struct fs_path_config android_files[] = {
+ "system/bin/run-as" },
+
+ // Support FIFO scheduling mode in SurfaceFlinger.
+- { 00755, AID_SYSTEM, AID_GRAPHICS, CAP_MASK_LONG(CAP_SYS_NICE),
+- "system/bin/surfaceflinger" },
++ /* { 00755, AID_SYSTEM, AID_GRAPHICS, CAP_MASK_LONG(CAP_SYS_NICE),
++ "system/bin/surfaceflinger" }, */
+
+ // Support hostapd administering a network interface.
+ { 00755, AID_WIFI, AID_WIFI, CAP_MASK_LONG(CAP_NET_ADMIN) |
+--
+2.14.1
+
diff --git a/patches/vendor/lineage/0001-lineage-Export-forced-shims-list-to-soong.patch b/patches/vendor/lineage/0001-lineage-Export-forced-shims-list-to-soong.patch
deleted file mode 100644
index ac517c2..0000000
--- a/patches/vendor/lineage/0001-lineage-Export-forced-shims-list-to-soong.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From dd9e633d2274339daf03ab49f52a36332f1fbdc2 Mon Sep 17 00:00:00 2001
-From: Rashed Abdel-Tawab <rashed@linux.com>
-Date: Wed, 8 Nov 2017 17:41:47 -0500
-Subject: [PATCH] lineage: Export forced shims list to soong
-
-Change-Id: Ie53c39e194ca4f15317beb4c485acf01b7d78781
----
- build/soong/android/variable.go | 1 +
- build/soong/soong_config.mk | 1 +
- 2 files changed, 2 insertions(+)
-
-diff --git a/build/soong/android/variable.go b/build/soong/android/variable.go
-index c56c36b8..c6e0e587 100644
---- a/build/soong/android/variable.go
-+++ b/build/soong/android/variable.go
-@@ -6,5 +6,6 @@ type Product_variables struct {
- }
-
- type ProductVariables struct {
-+ Linker_forced_shim_libs *string `json:",omitempty"`
- Needs_text_relocations *bool `json:",omitempty"`
- }
-diff --git a/build/soong/soong_config.mk b/build/soong/soong_config.mk
-index 331f123c..6f978537 100644
---- a/build/soong/soong_config.mk
-+++ b/build/soong/soong_config.mk
-@@ -4,6 +4,7 @@ lineage_soong:
- $(hide) (\
- echo '{'; \
- echo '"Lineage": {'; \
-+ echo ' "Linker_forced_shim_libs": "$(LINKER_FORCED_SHIM_LIBS)",'; \
- echo ' "Needs_text_relocations": $(if $(filter true,$(TARGET_NEEDS_PLATFORM_TEXT_RELOCATIONS)),true,false)'; \
- echo '},'; \
- echo '') > $(SOONG_VARIABLES_TMP)
---
-2.11.0
-