From 479efb540a198a9b7cd278387b0d45009a05bb2b Mon Sep 17 00:00:00 2001 From: Todd Poynor Date: Thu, 21 Nov 2013 20:23:54 -0800 Subject: [PATCH 1/6] init.rc: mount pstore fs, set console-ramoops permissions Change-Id: I44cb00f9123c6044a03de926b6a616da753bb549 --- rootdir/init.rc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rootdir/init.rc b/rootdir/init.rc index a0a98134b..21ebccb79 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -136,6 +136,11 @@ loglevel 3 # checker programs. mkdir /dev/fscklogs 0770 root system +# pstore/ramoops previous console log + mount pstore pstore /sys/fs/pstore + chown system log /sys/fs/pstore/console-ramoops + chmod 0440 /sys/fs/pstore/console-ramoops + on post-fs # once everything is setup, no need to modify / mount rootfs rootfs / ro remount From e89e09dd2b9b42184973e3ade291186a2737bced Mon Sep 17 00:00:00 2001 From: Nick Kralevich Date: Tue, 10 Dec 2013 10:18:10 -0800 Subject: [PATCH 2/6] Fix overflow in adb_client Change-Id: I7f8582bd8a69d61ce47d11a9ffd0e901fc371037 Credit: Joshua Drake Bug: 12060953 --- adb/adb_client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adb/adb_client.c b/adb/adb_client.c index 9a812f0cf..89eb42813 100644 --- a/adb/adb_client.c +++ b/adb/adb_client.c @@ -228,7 +228,7 @@ int adb_connect(const char *service) } else { // if server was running, check its version to make sure it is not out of date char buf[100]; - int n; + size_t n; int version = ADB_SERVER_VERSION - 1; // if we have a file descriptor, then parse version result @@ -237,7 +237,7 @@ int adb_connect(const char *service) buf[4] = 0; n = strtoul(buf, 0, 16); - if(n > (int)sizeof(buf)) goto error; + if(n > sizeof(buf)) goto error; if(readx(fd, buf, n)) goto error; adb_close(fd); From ca53f0a0840ef859dbabfb089f2036656d1ca18c Mon Sep 17 00:00:00 2001 From: Nick Kralevich Date: Sat, 18 Jan 2014 15:28:11 -0800 Subject: [PATCH 3/6] don't load property_contexts from /data Bug: 12613118 (cherry picked from commit dc3a42bb11dc2aefee37f799b5a1cce87cf35aaf) Change-Id: If630478b0e3fdda8c1c14b3f41b717085acf9914 --- init/init.c | 1 - 1 file changed, 1 deletion(-) diff --git a/init/init.c b/init/init.c index 4266a73c4..08fd5fb96 100644 --- a/init/init.c +++ b/init/init.c @@ -842,7 +842,6 @@ static int bootchart_init_action(int nargs, char **args) #endif static const struct selinux_opt seopts_prop[] = { - { SELABEL_OPT_PATH, "/data/security/property_contexts" }, { SELABEL_OPT_PATH, "/property_contexts" }, { 0, NULL } }; From 02916aa20e3ffbe4b738bb12dc1607a7ec6a8c37 Mon Sep 17 00:00:00 2001 From: Nick Kralevich Date: Tue, 14 Jan 2014 16:34:56 -0800 Subject: [PATCH 4/6] Remove obsolete vdc call. Since ca8e66a8b0f843812014a28d49208f9f6f64ecbc, init has been handling reboots and filesystem unmounts. Remove obsolete call to vdc. Bug: 12504045 Change-Id: If8704ca042cb3a68857743b9973e48c52e7eb881 (cherry picked from commit 225459a5da21e9397ca49b0d9af7d5fe3462706b) --- adb/adb.c | 3 +-- adb/services.c | 15 +-------------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/adb/adb.c b/adb/adb.c index 72b7484af..99bea0f76 100644 --- a/adb/adb.c +++ b/adb/adb.c @@ -1313,12 +1313,11 @@ int adb_main(int is_daemon, int server_port) ** AID_NET_BT and AID_NET_BT_ADMIN to diagnose bluetooth (hcidump) ** AID_SDCARD_R to allow reading from the SD card ** AID_SDCARD_RW to allow writing to the SD card - ** AID_MOUNT to allow unmounting the SD card before rebooting ** AID_NET_BW_STATS to read out qtaguid statistics */ gid_t groups[] = { AID_ADB, AID_LOG, AID_INPUT, AID_INET, AID_GRAPHICS, AID_NET_BT, AID_NET_BT_ADMIN, AID_SDCARD_R, AID_SDCARD_RW, - AID_MOUNT, AID_NET_BW_STATS }; + AID_NET_BW_STATS }; if (setgroups(sizeof(groups)/sizeof(groups[0]), groups) != 0) { exit(1); } diff --git a/adb/services.c b/adb/services.c index 951048e58..89e595c57 100644 --- a/adb/services.c +++ b/adb/services.c @@ -116,23 +116,10 @@ void reboot_service(int fd, void *arg) { char buf[100]; char property_val[PROPERTY_VALUE_MAX]; - int pid, ret; + int ret; sync(); - /* Attempt to unmount the SD card first. - * No need to bother checking for errors. - */ - pid = fork(); - if (pid == 0) { - /* ask vdc to unmount it */ - execl("/system/bin/vdc", "/system/bin/vdc", "volume", "unmount", - getenv("EXTERNAL_STORAGE"), "force", NULL); - } else if (pid > 0) { - /* wait until vdc succeeds or fails */ - waitpid(pid, &ret, 0); - } - ret = snprintf(property_val, sizeof(property_val), "reboot,%s", (char *) arg); if (ret >= (int) sizeof(property_val)) { snprintf(buf, sizeof(buf), "reboot string too long. length=%d\n", ret); From 6941a83c2dd34df606df13972576fbc23172c3c5 Mon Sep 17 00:00:00 2001 From: Nick Kralevich Date: Sat, 18 Jan 2014 15:28:11 -0800 Subject: [PATCH 5/6] don't load property_contexts from /data Bug: 12613118 Change-Id: I5a84b13d2151075d5136e3682431fbcc9307df13 (cherry picked from commit dc3a42bb11dc2aefee37f799b5a1cce87cf35aaf) --- init/init.c | 1 - 1 file changed, 1 deletion(-) diff --git a/init/init.c b/init/init.c index 94a201196..bd7799e18 100644 --- a/init/init.c +++ b/init/init.c @@ -843,7 +843,6 @@ static int bootchart_init_action(int nargs, char **args) #endif static const struct selinux_opt seopts_prop[] = { - { SELABEL_OPT_PATH, "/data/security/property_contexts" }, { SELABEL_OPT_PATH, "/property_contexts" }, { 0, NULL } }; From efbf36f2dad8f083de6f48dbb682461d7cfa9781 Mon Sep 17 00:00:00 2001 From: JP Abgrall Date: Fri, 21 Feb 2014 12:05:01 -0800 Subject: [PATCH 6/6] init.rc: prep tcp_default_init_rwnd, set the default to 60 The kernel's default is between 4~20. Prepare for javaland to modify the value at runtime. It can be done via setprop sys.sysctl.tcp_def_init_rwnd Bug: 12020135 Change-Id: Id34194b085206fd02e316401c0fbbb9eb52522d2 (cherry picked from commit 7c862c8b5e59cbe216a5bc092c01f1ecba8e9de4) --- rootdir/init.rc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/rootdir/init.rc b/rootdir/init.rc index 21ebccb79..1ee9fbf4a 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -369,6 +369,9 @@ on boot setprop net.tcp.buffersize.gprs 4092,8760,11680,4096,8760,11680 setprop net.tcp.buffersize.evdo 4094,87380,262144,4096,16384,262144 +# Define default initial receive window size in segments. + setprop net.tcp.default_init_rwnd 60 + class_start core class_start main @@ -401,9 +404,15 @@ on property:vold.decrypt=trigger_shutdown_framework on property:sys.powerctl=* powerctl ${sys.powerctl} -# system server cannot write to /proc/sys files, so proxy it through init +# system server cannot write to /proc/sys files, +# and chown/chmod does not work for /proc/sys/ entries. +# So proxy writes through init. on property:sys.sysctl.extra_free_kbytes=* write /proc/sys/vm/extra_free_kbytes ${sys.sysctl.extra_free_kbytes} +# "tcp_default_init_rwnd" Is too long! +on property:sys.sysctl.tcp_def_init_rwnd=* + write /proc/sys/net/ipv4/tcp_default_init_rwnd ${sys.sysctl.tcp_def_init_rwnd} + ## Daemon processes to be run by init. ##