Merge "init: run vendor commands in a separate SELinux context"
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 5b5eff4..304ce4e 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -60,3 +60,4 @@
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib64/hw/gatekeeper.$(TARGET_DEVICE).so)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/vendor)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/init.rc)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/root)
diff --git a/adb/services.cpp b/adb/services.cpp
index ca34556..aff7012 100644
--- a/adb/services.cpp
+++ b/adb/services.cpp
@@ -58,6 +58,7 @@
#include "transport.h"
struct stinfo {
+ const char* service_name;
void (*func)(int fd, void *cookie);
int fd;
void *cookie;
@@ -65,7 +66,7 @@
static void service_bootstrap_func(void* x) {
stinfo* sti = reinterpret_cast<stinfo*>(x);
- adb_thread_setname(android::base::StringPrintf("service %d", sti->fd));
+ adb_thread_setname(android::base::StringPrintf("%s svc %d", sti->service_name, sti->fd));
sti->func(sti->fd, sti->cookie);
free(sti);
}
@@ -160,8 +161,7 @@
return true;
}
-void reboot_service(int fd, void* arg)
-{
+void reboot_service(int fd, void* arg) {
if (reboot_service_impl(fd, static_cast<const char*>(arg))) {
// Don't return early. Give the reboot command time to take effect
// to avoid messing up scripts which do "adb reboot && adb wait-for-device"
@@ -236,8 +236,7 @@
#endif // !ADB_HOST
-static int create_service_thread(void (*func)(int, void *), void *cookie)
-{
+static int create_service_thread(const char* service_name, void (*func)(int, void*), void* cookie) {
int s[2];
if (adb_socketpair(s)) {
printf("cannot create service socket pair\n");
@@ -258,6 +257,7 @@
if (sti == nullptr) {
fatal("cannot allocate stinfo");
}
+ sti->service_name = service_name;
sti->func = func;
sti->cookie = cookie;
sti->fd = s[1];
@@ -281,7 +281,7 @@
} else if(!strncmp("dev:", name, 4)) {
ret = unix_open(name + 4, O_RDWR | O_CLOEXEC);
} else if(!strncmp(name, "framebuffer:", 12)) {
- ret = create_service_thread(framebuffer_service, 0);
+ ret = create_service_thread("fb", framebuffer_service, nullptr);
} else if (!strncmp(name, "jdwp:", 5)) {
ret = create_jdwp_connection_fd(atoi(name+5));
} else if(!strncmp(name, "shell", 5)) {
@@ -289,17 +289,17 @@
} else if(!strncmp(name, "exec:", 5)) {
ret = StartSubprocess(name + 5, nullptr, SubprocessType::kRaw, SubprocessProtocol::kNone);
} else if(!strncmp(name, "sync:", 5)) {
- ret = create_service_thread(file_sync_service, NULL);
+ ret = create_service_thread("sync", file_sync_service, nullptr);
} else if(!strncmp(name, "remount:", 8)) {
- ret = create_service_thread(remount_service, NULL);
+ ret = create_service_thread("remount", remount_service, nullptr);
} else if(!strncmp(name, "reboot:", 7)) {
void* arg = strdup(name + 7);
if (arg == NULL) return -1;
- ret = create_service_thread(reboot_service, arg);
+ ret = create_service_thread("reboot", reboot_service, arg);
} else if(!strncmp(name, "root:", 5)) {
- ret = create_service_thread(restart_root_service, NULL);
+ ret = create_service_thread("root", restart_root_service, nullptr);
} else if(!strncmp(name, "unroot:", 7)) {
- ret = create_service_thread(restart_unroot_service, NULL);
+ ret = create_service_thread("unroot", restart_unroot_service, nullptr);
} else if(!strncmp(name, "backup:", 7)) {
ret = StartSubprocess(android::base::StringPrintf("/system/bin/bu backup %s",
(name + 7)).c_str(),
@@ -312,17 +312,20 @@
if (sscanf(name + 6, "%d", &port) != 1) {
return -1;
}
- ret = create_service_thread(restart_tcp_service, (void *) (uintptr_t) port);
+ ret = create_service_thread("tcp", restart_tcp_service, reinterpret_cast<void*>(port));
} else if(!strncmp(name, "usb:", 4)) {
- ret = create_service_thread(restart_usb_service, NULL);
+ ret = create_service_thread("usb", restart_usb_service, nullptr);
} else if (!strncmp(name, "reverse:", 8)) {
ret = reverse_service(name + 8);
} else if(!strncmp(name, "disable-verity:", 15)) {
- ret = create_service_thread(set_verity_enabled_state_service, (void*)0);
+ ret = create_service_thread("verity-on", set_verity_enabled_state_service,
+ reinterpret_cast<void*>(0));
} else if(!strncmp(name, "enable-verity:", 15)) {
- ret = create_service_thread(set_verity_enabled_state_service, (void*)1);
+ ret = create_service_thread("verity-off", set_verity_enabled_state_service,
+ reinterpret_cast<void*>(1));
} else if (!strcmp(name, "reconnect")) {
- ret = create_service_thread(reconnect_service, const_cast<atransport*>(transport));
+ ret = create_service_thread("reconnect", reconnect_service,
+ const_cast<atransport*>(transport));
#endif
}
if (ret >= 0) {
@@ -484,14 +487,14 @@
return nullptr;
}
- int fd = create_service_thread(wait_for_state, sinfo.get());
+ int fd = create_service_thread("wait", wait_for_state, sinfo.get());
if (fd != -1) {
sinfo.release();
}
return create_local_socket(fd);
} else if (!strncmp(name, "connect:", 8)) {
char* host = strdup(name + 8);
- int fd = create_service_thread(connect_service, host);
+ int fd = create_service_thread("connect", connect_service, host);
if (fd == -1) {
free(host);
}
diff --git a/adb/shell_service.cpp b/adb/shell_service.cpp
index ee821f8..5b48da0 100644
--- a/adb/shell_service.cpp
+++ b/adb/shell_service.cpp
@@ -435,8 +435,7 @@
void Subprocess::ThreadHandler(void* userdata) {
Subprocess* subprocess = reinterpret_cast<Subprocess*>(userdata);
- adb_thread_setname(android::base::StringPrintf(
- "shell srvc %d", subprocess->pid()));
+ adb_thread_setname(android::base::StringPrintf("shell svc %d", subprocess->pid()));
D("passing data streams for PID %d", subprocess->pid());
subprocess->PassDataStreams();
diff --git a/adb/test_device.py b/adb/test_device.py
index 9e1a2ec..ddceda9 100644
--- a/adb/test_device.py
+++ b/adb/test_device.py
@@ -1237,7 +1237,7 @@
return m.group(2)
return None
- def test_killed_when_pushing_a_large_file(self):
+ def disabled_test_killed_when_pushing_a_large_file(self):
"""
While running adb push with a large file, kill adb server.
Occasionally the device becomes offline. Because the device is still
@@ -1268,7 +1268,7 @@
# 4. The device should be online
self.assertEqual(self._get_device_state(serialno), 'device')
- def test_killed_when_pulling_a_large_file(self):
+ def disabled_test_killed_when_pulling_a_large_file(self):
"""
While running adb pull with a large file, kill adb server.
Occasionally the device can't be connected. Because the device is trying to
diff --git a/adb/transport.cpp b/adb/transport.cpp
index 1b597fd..34cc026 100644
--- a/adb/transport.cpp
+++ b/adb/transport.cpp
@@ -748,9 +748,6 @@
}
int atransport::Write(apacket* p) {
-#if ADB_HOST
- std::lock_guard<std::mutex> lock(write_msg_lock_);
-#endif
return write_func_(p, this);
}
@@ -758,11 +755,6 @@
if (!kicked_) {
kicked_ = true;
CHECK(kick_func_ != nullptr);
-#if ADB_HOST
- // On host, adb server should avoid writing part of a packet, so don't
- // kick a transport whiling writing a packet.
- std::lock_guard<std::mutex> lock(write_msg_lock_);
-#endif
kick_func_(this);
}
}
diff --git a/adb/transport.h b/adb/transport.h
index 374bfc3..79e3075 100644
--- a/adb/transport.h
+++ b/adb/transport.h
@@ -181,7 +181,6 @@
std::atomic<ConnectionState> connection_state_;
#if ADB_HOST
std::deque<std::shared_ptr<RSA>> keys_;
- std::mutex write_msg_lock_;
bool has_send_connect_on_error_ = false;
#endif
diff --git a/base/Android.bp b/base/Android.bp
index 82aee2a..da262d2 100644
--- a/base/Android.bp
+++ b/base/Android.bp
@@ -95,7 +95,6 @@
"errors_unix.cpp",
],
cppflags: ["-Wexit-time-destructors"],
- host_ldlibs: ["-lrt"],
},
windows: {
srcs: [
@@ -138,7 +137,6 @@
},
linux: {
srcs: ["chrono_utils_test.cpp"],
- host_ldlibs: ["-lrt"],
},
windows: {
srcs: ["utf8_test.cpp"],
diff --git a/bootstat/bootstat.cpp b/bootstat/bootstat.cpp
index 7c0b15e..17986b9 100644
--- a/bootstat/bootstat.cpp
+++ b/bootstat/bootstat.cpp
@@ -204,6 +204,7 @@
{"reboot,shell", 66},
{"reboot,adb", 67},
{"reboot,userrequested", 68},
+ {"shutdown,container", 69}, // Host OS asking Android Container to shutdown
};
// Converts a string value representing the reason the system booted to an
diff --git a/fs_mgr/fs_mgr_fstab.cpp b/fs_mgr/fs_mgr_fstab.cpp
index 31c8803..bce245c 100644
--- a/fs_mgr/fs_mgr_fstab.cpp
+++ b/fs_mgr/fs_mgr_fstab.cpp
@@ -779,47 +779,21 @@
}
/*
- * Returns the 1st matching fstab_rec that follows the start_rec.
- * start_rec is the result of a previous search or NULL.
+ * Returns the fstab_rec* whose mount_point is path.
+ * Returns nullptr if not found.
*/
-struct fstab_rec* fs_mgr_get_entry_for_mount_point_after(struct fstab_rec* start_rec,
- struct fstab* fstab,
- const std::string& path) {
- int i;
+struct fstab_rec* fs_mgr_get_entry_for_mount_point(struct fstab* fstab, const std::string& path) {
if (!fstab) {
return nullptr;
}
-
- if (start_rec) {
- for (i = 0; i < fstab->num_entries; i++) {
- if (&fstab->recs[i] == start_rec) {
- i++;
- break;
- }
- }
- } else {
- i = 0;
- }
-
- for (; i < fstab->num_entries; i++) {
+ for (int i = 0; i < fstab->num_entries; i++) {
if (fstab->recs[i].mount_point && path == fstab->recs[i].mount_point) {
return &fstab->recs[i];
}
}
-
return nullptr;
}
-/*
- * Returns the 1st matching mount point.
- * There might be more. To look for others, use fs_mgr_get_entry_for_mount_point_after()
- * and give the fstab_rec from the previous search.
- */
-struct fstab_rec *fs_mgr_get_entry_for_mount_point(struct fstab *fstab, const char *path)
-{
- return fs_mgr_get_entry_for_mount_point_after(NULL, fstab, path);
-}
-
int fs_mgr_is_voldmanaged(const struct fstab_rec *fstab)
{
return fstab->fs_mgr_flags & MF_VOLDMANAGED;
diff --git a/fs_mgr/include_fstab/fstab/fstab.h b/fs_mgr/include_fstab/fstab/fstab.h
index 8a18ec0..ef51724 100644
--- a/fs_mgr/include_fstab/fstab/fstab.h
+++ b/fs_mgr/include_fstab/fstab/fstab.h
@@ -70,7 +70,6 @@
int fs_mgr_add_entry(struct fstab* fstab, const char* mount_point, const char* fs_type,
const char* blk_device);
-struct fstab_rec* fs_mgr_get_entry_for_mount_point(struct fstab* fstab, const char* path);
int fs_mgr_is_voldmanaged(const struct fstab_rec* fstab);
int fs_mgr_is_nonremovable(const struct fstab_rec* fstab);
int fs_mgr_is_verified(const struct fstab_rec* fstab);
@@ -95,6 +94,7 @@
// TODO: move this into separate header files under include/fs_mgr/*.h
#ifdef __cplusplus
std::string fs_mgr_get_slot_suffix();
+struct fstab_rec* fs_mgr_get_entry_for_mount_point(struct fstab* fstab, const std::string& path);
#endif
#endif /* __CORE_FS_TAB_H */
diff --git a/init/init.cpp b/init/init.cpp
index 816efab..51a98a2 100644
--- a/init/init.cpp
+++ b/init/init.cpp
@@ -419,8 +419,7 @@
return;
}
- LOG(INFO) << "Handling SIGTERM, shutting system down";
- HandlePowerctlMessage("shutdown");
+ HandlePowerctlMessage("shutdown,container");
}
static void InstallSigtermHandler() {
diff --git a/init/persistent_properties.cpp b/init/persistent_properties.cpp
index 71f2355..21adce9 100644
--- a/init/persistent_properties.cpp
+++ b/init/persistent_properties.cpp
@@ -43,7 +43,6 @@
namespace {
-constexpr const uint32_t kMagic = 0x8495E0B4;
constexpr const char kLegacyPersistentPropertyDir[] = "/data/property";
void AddPersistentProperty(const std::string& name, const std::string& value,
@@ -140,85 +139,6 @@
return persistent_properties;
}
-class PersistentPropertyFileParser {
- public:
- PersistentPropertyFileParser(const std::string& contents) : contents_(contents), position_(0) {}
- Result<PersistentProperties> Parse();
-
- private:
- Result<std::string> ReadString();
- Result<uint32_t> ReadUint32();
-
- const std::string& contents_;
- size_t position_;
-};
-
-Result<PersistentProperties> PersistentPropertyFileParser::Parse() {
- if (auto magic = ReadUint32(); magic) {
- if (*magic != kMagic) {
- return Error() << "Magic value '0x" << std::hex << *magic
- << "' does not match expected value '0x" << kMagic << "'";
- }
- } else {
- return Error() << "Could not read magic value: " << magic.error();
- }
-
- if (auto version = ReadUint32(); version) {
- if (*version != 1) {
- return Error() << "Version '" << *version
- << "' does not match any compatible version: (1)";
- }
- } else {
- return Error() << "Could not read version: " << version.error();
- }
-
- auto num_properties = ReadUint32();
- if (!num_properties) {
- return Error() << "Could not read num_properties: " << num_properties.error();
- }
-
- PersistentProperties result;
- while (position_ < contents_.size()) {
- auto name = ReadString();
- if (!name) {
- return Error() << "Could not read name: " << name.error();
- }
- if (!StartsWith(*name, "persist.")) {
- return Error() << "Property '" << *name << "' does not starts with 'persist.'";
- }
- auto value = ReadString();
- if (!value) {
- return Error() << "Could not read value: " << value.error();
- }
- AddPersistentProperty(*name, *value, &result);
- }
-
- return result;
-}
-
-Result<std::string> PersistentPropertyFileParser::ReadString() {
- auto string_length = ReadUint32();
- if (!string_length) {
- return Error() << "Could not read size for string";
- }
-
- if (position_ + *string_length > contents_.size()) {
- return Error() << "String size would cause it to overflow the input buffer";
- }
- auto result = std::string(contents_, position_, *string_length);
- position_ += *string_length;
- return result;
-}
-
-Result<uint32_t> PersistentPropertyFileParser::ReadUint32() {
- if (position_ + 3 > contents_.size()) {
- return Error() << "Input buffer not large enough to read uint32_t";
- }
- uint32_t result = *reinterpret_cast<const uint32_t*>(&contents_[position_]);
- position_ += sizeof(uint32_t);
- return result;
-}
-
Result<std::string> ReadPersistentPropertyFile() {
const std::string temp_filename = persistent_property_filename + ".tmp";
if (access(temp_filename.c_str(), F_OK) == 0) {
@@ -240,24 +160,13 @@
auto file_contents = ReadPersistentPropertyFile();
if (!file_contents) return file_contents.error();
- // Check the intermediate "I should have used protobufs from the start" format.
- // TODO: Remove this.
- auto parsed_contents = PersistentPropertyFileParser(*file_contents).Parse();
- if (parsed_contents) {
- LOG(INFO) << "Intermediate format persistent property file found, converting to protobuf";
-
- // Update to the protobuf format
- WritePersistentPropertyFile(*parsed_contents);
- return parsed_contents;
- }
-
PersistentProperties persistent_properties;
if (persistent_properties.ParseFromString(*file_contents)) return persistent_properties;
// If the file cannot be parsed in either format, then we don't have any recovery
// mechanisms, so we delete it to allow for future writes to take place successfully.
unlink(persistent_property_filename.c_str());
- return Error() << "Unable to parse persistent property file: " << parsed_contents.error();
+ return Error() << "Unable to parse persistent property file: Could not parse protobuf";
}
Result<Success> WritePersistentPropertyFile(const PersistentProperties& persistent_properties) {
@@ -288,25 +197,24 @@
// Persistent properties are not written often, so we rather not keep any data in memory and read
// then rewrite the persistent property file for each update.
void WritePersistentProperty(const std::string& name, const std::string& value) {
- auto file_contents = ReadPersistentPropertyFile();
- PersistentProperties persistent_properties;
+ auto persistent_properties = LoadPersistentPropertyFile();
- if (!file_contents || !persistent_properties.ParseFromString(*file_contents)) {
+ if (!persistent_properties) {
LOG(ERROR) << "Recovering persistent properties from memory: "
- << (!file_contents ? file_contents.error_string() : "Could not parse protobuf");
+ << persistent_properties.error();
persistent_properties = LoadPersistentPropertiesFromMemory();
}
- auto it = std::find_if(persistent_properties.mutable_properties()->begin(),
- persistent_properties.mutable_properties()->end(),
+ auto it = std::find_if(persistent_properties->mutable_properties()->begin(),
+ persistent_properties->mutable_properties()->end(),
[&name](const auto& record) { return record.name() == name; });
- if (it != persistent_properties.mutable_properties()->end()) {
+ if (it != persistent_properties->mutable_properties()->end()) {
it->set_name(name);
it->set_value(value);
} else {
- AddPersistentProperty(name, value, &persistent_properties);
+ AddPersistentProperty(name, value, &persistent_properties.value());
}
- if (auto result = WritePersistentPropertyFile(persistent_properties); !result) {
+ if (auto result = WritePersistentPropertyFile(*persistent_properties); !result) {
LOG(ERROR) << "Could not store persistent property: " << result.error();
}
}
diff --git a/libbacktrace/Android.bp b/libbacktrace/Android.bp
index e889bdd..69d7b6d 100644
--- a/libbacktrace/Android.bp
+++ b/libbacktrace/Android.bp
@@ -94,7 +94,6 @@
],
static_libs: ["libcutils"],
- host_ldlibs: ["-lrt"],
},
linux_bionic: {
enabled: true,
@@ -229,15 +228,11 @@
android: {
cflags: ["-DENABLE_PSS_TESTS"],
shared_libs: [
- "libdl",
"libutils",
],
},
linux: {
host_ldlibs: [
- "-lpthread",
- "-lrt",
- "-ldl",
"-lncurses",
],
static_libs: ["libutils"],
diff --git a/libcutils/fs_config.cpp b/libcutils/fs_config.cpp
index 1185040..bab095e 100644
--- a/libcutils/fs_config.cpp
+++ b/libcutils/fs_config.cpp
@@ -80,7 +80,6 @@
{ 00775, AID_ROOT, AID_ROOT, 0, "data/preloads" },
{ 00771, AID_SYSTEM, AID_SYSTEM, 0, "data" },
{ 00755, AID_ROOT, AID_SYSTEM, 0, "mnt" },
- { 00755, AID_ROOT, AID_ROOT, 0, "root" },
{ 00750, AID_ROOT, AID_SHELL, 0, "sbin" },
{ 00777, AID_ROOT, AID_ROOT, 0, "sdcard" },
{ 00751, AID_ROOT, AID_SDCARD_R, 0, "storage" },
diff --git a/liblog/Android.bp b/liblog/Android.bp
index b98d18f..d5bb29e 100644
--- a/liblog/Android.bp
+++ b/liblog/Android.bp
@@ -91,9 +91,6 @@
not_windows: {
srcs: ["event_tag_map.cpp"],
},
- linux: {
- host_ldlibs: ["-lrt"],
- },
linux_bionic: {
enabled: true,
},
diff --git a/libnativebridge/Android.bp b/libnativebridge/Android.bp
index b3c42f0..089f3b8 100644
--- a/libnativebridge/Android.bp
+++ b/libnativebridge/Android.bp
@@ -22,13 +22,6 @@
cppflags: [
"-fvisibility=protected",
],
-
- host_ldlibs: ["-ldl"],
- target: {
- android: {
- shared_libs: ["libdl"],
- },
- },
}
subdirs = ["tests"]
diff --git a/libnativebridge/tests/Android.bp b/libnativebridge/tests/Android.bp
index e31dae0..9e2e641 100644
--- a/libnativebridge/tests/Android.bp
+++ b/libnativebridge/tests/Android.bp
@@ -25,14 +25,6 @@
],
header_libs: ["libnativebridge-dummy-headers"],
cppflags: ["-fvisibility=protected"],
- target: {
- android: {
- shared_libs: ["libdl"],
- },
- host: {
- host_ldlibs: ["-ldl"],
- },
- },
}
cc_library_shared {
diff --git a/libnativeloader/Android.bp b/libnativeloader/Android.bp
index 13f9744..4b21edc 100644
--- a/libnativeloader/Android.bp
+++ b/libnativeloader/Android.bp
@@ -11,14 +11,6 @@
"libnativebridge",
"libbase",
],
- target: {
- android: {
- shared_libs: ["libdl"],
- },
- host: {
- host_ldlibs: ["-ldl"],
- },
- },
cflags: [
"-Werror",
"-Wall",
@@ -27,5 +19,4 @@
"-fvisibility=hidden",
],
export_include_dirs: ["include"],
- local_include_dirs: ["include"],
}
diff --git a/libsparse/Android.bp b/libsparse/Android.bp
index 6ec0991..b894656 100644
--- a/libsparse/Android.bp
+++ b/libsparse/Android.bp
@@ -15,19 +15,11 @@
cflags: ["-Werror"],
local_include_dirs: ["include"],
export_include_dirs: ["include"],
+ shared_libs: [
+ "libz",
+ "libbase",
+ ],
target: {
- host: {
- shared_libs: [
- "libz-host",
- "libbase",
- ],
- },
- android: {
- shared_libs: [
- "libz",
- "libbase",
- ],
- },
windows: {
enabled: true,
},
diff --git a/libunwindstack/Android.bp b/libunwindstack/Android.bp
index ca05516..cf2ac4e 100644
--- a/libunwindstack/Android.bp
+++ b/libunwindstack/Android.bp
@@ -143,14 +143,6 @@
"libgmock",
],
- target: {
- linux: {
- host_ldlibs: [
- "-lrt",
- ],
- },
- },
-
data: [
"tests/files/elf32.xz",
"tests/files/elf64.xz",
@@ -178,14 +170,6 @@
srcs: [
"tools/unwind.cpp",
],
-
- target: {
- linux: {
- host_ldlibs: [
- "-lrt",
- ],
- },
- },
}
cc_binary {
diff --git a/libutils/tests/Android.bp b/libutils/tests/Android.bp
index 0869175..3fadef4 100644
--- a/libutils/tests/Android.bp
+++ b/libutils/tests/Android.bp
@@ -44,7 +44,6 @@
"libcutils",
"libutils",
"libbase",
- "libdl",
],
},
linux: {
@@ -59,7 +58,6 @@
"liblog",
"libbase",
],
- host_ldlibs: ["-ldl"],
},
},
diff --git a/libziparchive/Android.bp b/libziparchive/Android.bp
index f395c74..e3faee3 100644
--- a/libziparchive/Android.bp
+++ b/libziparchive/Android.bp
@@ -69,11 +69,11 @@
shared_libs: [
"liblog",
"libbase",
+ "libz",
],
target: {
android: {
shared_libs: [
- "libz",
"libutils",
],
},
@@ -81,18 +81,8 @@
static_libs: ["libutils"],
},
linux_bionic: {
- static_libs: ["libz"],
enabled: true,
},
- linux: {
- shared_libs: ["libz-host"],
- },
- darwin: {
- shared_libs: ["libz-host"],
- },
- windows: {
- shared_libs: ["libz-host"],
- },
},
}
@@ -105,7 +95,7 @@
"libziparchive_defaults",
"libziparchive_flags",
],
- shared_libs: ["libz-host"],
+ shared_libs: ["libz"],
static_libs: ["libutils"],
}
diff --git a/reboot/reboot.c b/reboot/reboot.c
index f0cf40c..fe763a8 100644
--- a/reboot/reboot.c
+++ b/reboot/reboot.c
@@ -21,13 +21,13 @@
#include <cutils/android_reboot.h>
#include <unistd.h>
-int main(int argc, char *argv[])
-{
+int main(int argc, char* argv[]) {
int ret;
size_t prop_len;
char property_val[PROPERTY_VALUE_MAX];
- const char *cmd = "reboot";
- char *optarg = "";
+ static const char reboot[] = "reboot";
+ const char* cmd = reboot;
+ char* optarg = "";
opterr = 0;
do {
@@ -60,19 +60,23 @@
prop_len = snprintf(property_val, sizeof(property_val), "%s,%s", cmd, optarg);
if (prop_len >= sizeof(property_val)) {
- fprintf(stderr, "reboot command too long: %s\n", optarg);
+ fprintf(stderr, "%s command too long: %s\n", cmd, optarg);
exit(EXIT_FAILURE);
}
ret = property_set(ANDROID_RB_PROPERTY, property_val);
- if(ret < 0) {
- perror("reboot");
+ if (ret < 0) {
+ perror(cmd);
exit(EXIT_FAILURE);
}
// Don't return early. Give the reboot command time to take effect
// to avoid messing up scripts which do "adb shell reboot && adb wait-for-device"
- while(1) { pause(); }
+ if (cmd == reboot) {
+ while (1) {
+ pause();
+ }
+ }
fprintf(stderr, "Done\n");
return 0;
diff --git a/rootdir/Android.mk b/rootdir/Android.mk
index 48a46c6..e199ed4 100644
--- a/rootdir/Android.mk
+++ b/rootdir/Android.mk
@@ -127,7 +127,7 @@
#
# create some directories (some are mount points) and symlinks
LOCAL_POST_INSTALL_CMD := mkdir -p $(addprefix $(TARGET_ROOT_OUT)/, \
- sbin dev proc sys system data oem acct config storage mnt root $(BOARD_ROOT_EXTRA_FOLDERS)); \
+ sbin dev proc sys system data oem acct config storage mnt $(BOARD_ROOT_EXTRA_FOLDERS)); \
ln -sf /system/etc $(TARGET_ROOT_OUT)/etc; \
ln -sf /data/user_de/0/com.android.shell/files/bugreports $(TARGET_ROOT_OUT)/bugreports; \
ln -sf /sys/kernel/debug $(TARGET_ROOT_OUT)/d; \
diff --git a/run-as/run-as.cpp b/run-as/run-as.cpp
index e7b8cc2..b27cfad 100644
--- a/run-as/run-as.cpp
+++ b/run-as/run-as.cpp
@@ -194,6 +194,7 @@
ScopedMinijail j(minijail_new());
minijail_change_uid(j.get(), uid);
minijail_change_gid(j.get(), gid);
+ minijail_keep_supplementary_gids(j.get());
minijail_enter(j.get());
if (selinux_android_setcontext(uid, 0, info.seinfo, pkgname) < 0) {