From d7312852eff445c027894be3339b9a8ff7423438 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Tue, 14 Nov 2017 19:33:34 +0000 Subject: [PATCH] linux-samsung-i9003: fix compilation with PARANOID_NETWORK disabled (#884) --- .../03_fix_paranoid_network_disabled.patch | 51 +++++++++++++++++++ device/linux-samsung-i9003/APKBUILD | 4 +- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 device/linux-samsung-i9003/03_fix_paranoid_network_disabled.patch diff --git a/device/linux-samsung-i9003/03_fix_paranoid_network_disabled.patch b/device/linux-samsung-i9003/03_fix_paranoid_network_disabled.patch new file mode 100644 index 000000000..52cee72ac --- /dev/null +++ b/device/linux-samsung-i9003/03_fix_paranoid_network_disabled.patch @@ -0,0 +1,51 @@ +This fixes compilation with ANDROID_PARANOID_NETWORK disabled. Without this +patch, compilation breaks with: + +/home/pmos/build/src/android_kernel_samsung_latona-7b8d73dd32e6cd21107f9a963a32a5ed237a6e78/security/commoncap.c: +In function 'cap_capable': +/home/pmos/build/src/android_kernel_samsung_latona-7b8d73dd32e6cd21107f9a963a32a5ed237a6e78/security/commoncap.c:91:40: +error: 'AID_NET_RAW' undeclared (first use in this function) + if (cap == CAP_NET_RAW && in_egroup_p(AID_NET_RAW)) + ^~~~~~~~~~~ +/home/pmos/build/src/android_kernel_samsung_latona-7b8d73dd32e6cd21107f9a963a32a5ed237a6e78/security/commoncap.c:91:40: +note: each undeclared identifier is reported only once for each function it +appears in +/home/pmos/build/src/android_kernel_samsung_latona-7b8d73dd32e6cd21107f9a963a32a5ed237a6e78/security/commoncap.c:93:42: +error: 'AID_NET_ADMIN' undeclared (first use in this function) + if (cap == CAP_NET_ADMIN && in_egroup_p(AID_NET_ADMIN)) +--- +From e9a85c71afa38ee304e71c86ca7d74ed4658318c Mon Sep 17 00:00:00 2001 +From: Tushar Behera +Date: Mon, 26 Mar 2012 16:54:15 +0530 +Subject: [PATCH] security: Add proper checks for Android specific capability + checks + +Commit b641072 ("security: Add AID_NET_RAW and AID_NET_ADMIN capability +check in cap_capable().") introduces additional checks for AID_NET_xxx +macros. Since the header file including those macros are conditionally +included, the checks should also be conditionally executed. + +Change-Id: Iaec5208d5b95a46b1ac3f2db8449c661e803fa5b +Signed-off-by: Tushar Behera +Signed-off-by: Andrey Konovalov +--- + security/commoncap.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/security/commoncap.c b/security/commoncap.c +index 897af00e477..0051ac2d058 100644 +--- a/security/commoncap.c ++++ b/security/commoncap.c +@@ -80,10 +80,12 @@ int cap_netlink_send(struct sock *sk, struct sk_buff *skb) + int cap_capable(const struct cred *cred, struct user_namespace *targ_ns, + int cap, int audit) + { ++#ifdef CONFIG_ANDROID_PARANOID_NETWORK + if (cap == CAP_NET_RAW && in_egroup_p(AID_NET_RAW)) + return 0; + if (cap == CAP_NET_ADMIN && in_egroup_p(AID_NET_ADMIN)) + return 0; ++#endif + + for (;;) { + /* The creator of the user namespace has all caps. */ diff --git a/device/linux-samsung-i9003/APKBUILD b/device/linux-samsung-i9003/APKBUILD index bd435b977..1c5a4d419 100644 --- a/device/linux-samsung-i9003/APKBUILD +++ b/device/linux-samsung-i9003/APKBUILD @@ -24,7 +24,7 @@ case $pkgver in *.*.*) _kernver=${pkgver%.*};; *.*) _kernver=$pkgver;; esac -pkgrel=9 +pkgrel=10 arch="armhf" pkgdesc="Samsung Galaxy SI SLC kernel" url="https://github.com/dhiru1602/android_kernel_samsung_latona" @@ -40,6 +40,7 @@ source=" 00_return_address.patch 01_twl_power_init.patch 02_mfd_driver_fix.patch + 03_fix_paranoid_network_disabled.patch init " subpackages="" @@ -133,4 +134,5 @@ d80980e9474c82ba0ef1a6903b434d8bd1b092c40367ba543e72d2c119301c8b2d05265740e4104c c40eaa11547f5bc2b1ff965506bdfe3015ff16e4b5ad9ccb3b8134ceafd1d32407c4ef2b213e02e036ce1e9bdcbfe768dff7d4b054bec77705a176c1f783b6f5 00_return_address.patch 1972a2b5c429d6bf5fa1423e8805bb89bbd80c4efe6d235cb2037de6ba4d15c01e90239392161d6e5a0802eafaab6e8b468a49a12dc5b66469a111262cde2047 01_twl_power_init.patch 5b951a2ab60a89fbc3ca209960987035001a6f9147f8ab5c05a6b49ec6dee75d0b6d053bef28df37e583bfc903599beed16692e25ee363e6200e14839d0dda65 02_mfd_driver_fix.patch +df62e03666313bb03d9a455eac875f170a55d378b6e56b847c1c6ff1ce5cfafcfdf1d7605754ca3c684840ea00357f9ec4c6621f6ff77377132a484b9258f6f7 03_fix_paranoid_network_disabled.patch dd4094d5f4ec281d32f12af88cb22a782e497c8e52f69cf60b73ac7d6171fc95f1f8040b3d0ad2ff3f016d22ac1d91c5b522e5d03203534a76742bc55a082af5 init"