Merge "Use target.linux for all linux kernel based targets"
diff --git a/healthd/healthd_mode_charger.cpp b/healthd/healthd_mode_charger.cpp
index c76762d..032b214 100644
--- a/healthd/healthd_mode_charger.cpp
+++ b/healthd/healthd_mode_charger.cpp
@@ -19,7 +19,6 @@
#include <fcntl.h>
#include <inttypes.h>
#include <linux/input.h>
-#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/init/property_service.cpp b/init/property_service.cpp
index 223d34e..1a44fe3 100644
--- a/init/property_service.cpp
+++ b/init/property_service.cpp
@@ -33,6 +33,7 @@
#include <sys/types.h>
#include <sys/un.h>
#include <unistd.h>
+#include <wchar.h>
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
#include <sys/_system_properties.h>
@@ -160,6 +161,12 @@
return PROP_ERROR_INVALID_VALUE;
}
+ if (mbstowcs(nullptr, value.data(), 0) == static_cast<std::size_t>(-1)) {
+ LOG(ERROR) << "property_set(\"" << name << "\", \"" << value << "\") failed: "
+ << "value not a UTF8 encoded string";
+ return PROP_ERROR_INVALID_VALUE;
+ }
+
prop_info* pi = (prop_info*) __system_property_find(name.c_str());
if (pi != nullptr) {
// ro.* properties are actually "write-once".
diff --git a/init/property_service_test.cpp b/init/property_service_test.cpp
index 3a64e02..95dd340 100644
--- a/init/property_service_test.cpp
+++ b/init/property_service_test.cpp
@@ -21,8 +21,11 @@
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
#include <sys/_system_properties.h>
+#include <android-base/properties.h>
#include <gtest/gtest.h>
+using android::base::SetProperty;
+
namespace android {
namespace init {
@@ -50,5 +53,19 @@
ASSERT_EQ(0, close(fd));
}
+TEST(property_service, non_utf8_value) {
+ ASSERT_TRUE(SetProperty("property_service_utf8_test", "base_success"));
+ EXPECT_FALSE(SetProperty("property_service_utf8_test", "\x80"));
+ EXPECT_FALSE(SetProperty("property_service_utf8_test", "\xC2\x01"));
+ EXPECT_FALSE(SetProperty("property_service_utf8_test", "\xE0\xFF"));
+ EXPECT_FALSE(SetProperty("property_service_utf8_test", "\xE0\xA0\xFF"));
+ EXPECT_FALSE(SetProperty("property_service_utf8_test", "\xF0\x01\xFF"));
+ EXPECT_FALSE(SetProperty("property_service_utf8_test", "\xF0\x90\xFF"));
+ EXPECT_FALSE(SetProperty("property_service_utf8_test", "\xF0\x90\x80\xFF"));
+ EXPECT_FALSE(SetProperty("property_service_utf8_test", "\xF0\x90\x80"));
+ EXPECT_FALSE(SetProperty("property_service_utf8_test", "ab\xF0\x90\x80\x80qe\xF0\x90\x80"));
+ EXPECT_TRUE(SetProperty("property_service_utf8_test", "\xF0\x90\x80\x80"));
+}
+
} // namespace init
} // namespace android
diff --git a/libcutils/fs_config.cpp b/libcutils/fs_config.cpp
index bab095e..d54eeae 100644
--- a/libcutils/fs_config.cpp
+++ b/libcutils/fs_config.cpp
@@ -22,7 +22,6 @@
#include <errno.h>
#include <fcntl.h>
-#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/libcutils/properties.cpp b/libcutils/properties.cpp
index d2645e6..25ff1a3 100644
--- a/libcutils/properties.cpp
+++ b/libcutils/properties.cpp
@@ -21,7 +21,6 @@
#include <ctype.h>
#include <errno.h>
#include <inttypes.h>
-#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
diff --git a/libsparse/sparse_read.cpp b/libsparse/sparse_read.cpp
index 91d551c..4379635 100644
--- a/libsparse/sparse_read.cpp
+++ b/libsparse/sparse_read.cpp
@@ -21,7 +21,6 @@
#include <inttypes.h>
#include <fcntl.h>
#include <stdarg.h>
-#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/libunwindstack/Unwinder.cpp b/libunwindstack/Unwinder.cpp
index e648927..15a8893 100644
--- a/libunwindstack/Unwinder.cpp
+++ b/libunwindstack/Unwinder.cpp
@@ -52,7 +52,7 @@
}
frame->map_name = map_info->name;
- frame->map_offset = map_info->elf_offset;
+ frame->map_offset = map_info->offset;
frame->map_start = map_info->start;
frame->map_end = map_info->end;
frame->map_flags = map_info->flags;
diff --git a/libunwindstack/tests/UnwinderTest.cpp b/libunwindstack/tests/UnwinderTest.cpp
index 4d0366c..16640a1 100644
--- a/libunwindstack/tests/UnwinderTest.cpp
+++ b/libunwindstack/tests/UnwinderTest.cpp
@@ -95,6 +95,16 @@
info.elf = elf;
elf->FakeSetInterface(new ElfInterfaceFake(nullptr));
maps_.FakeAddMapInfo(info);
+
+ info.name = "/fake/fake.apk";
+ info.start = 0x43000;
+ info.end = 0x44000;
+ info.offset = 0x1d000;
+ info.flags = PROT_READ | PROT_WRITE;
+ elf = new ElfFake(nullptr);
+ info.elf = elf;
+ elf->FakeSetInterface(new ElfInterfaceFake(nullptr));
+ maps_.FakeAddMapInfo(info);
}
void SetUp() override {
@@ -170,6 +180,33 @@
EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags);
}
+TEST_F(UnwinderTest, non_zero_map_offset) {
+ ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame0", 0));
+
+ regs_.FakeSetPc(0x43000);
+ regs_.FakeSetSp(0x10000);
+ ElfInterfaceFake::FakePushStepData(StepData(0, 0, true));
+
+ Unwinder unwinder(64, &maps_, ®s_, process_memory_);
+ unwinder.Unwind();
+
+ ASSERT_EQ(1U, unwinder.NumFrames());
+
+ auto* frame = &unwinder.frames()[0];
+ EXPECT_EQ(0U, frame->num);
+ EXPECT_EQ(0U, frame->rel_pc);
+ EXPECT_EQ(0x43000U, frame->pc);
+ EXPECT_EQ(0x10000U, frame->sp);
+ EXPECT_EQ("Frame0", frame->function_name);
+ EXPECT_EQ(0U, frame->function_offset);
+ EXPECT_EQ("/fake/fake.apk", frame->map_name);
+ EXPECT_EQ(0x1d000U, frame->map_offset);
+ EXPECT_EQ(0x43000U, frame->map_start);
+ EXPECT_EQ(0x44000U, frame->map_end);
+ EXPECT_EQ(0U, frame->map_load_bias);
+ EXPECT_EQ(PROT_READ | PROT_WRITE, frame->map_flags);
+}
+
// Verify that no attempt to continue after the step indicates it is done.
TEST_F(UnwinderTest, no_frames_after_finished) {
ElfInterfaceFake::FakePushFunctionData(FunctionData("Frame0", 0));
diff --git a/logcat/getopt_long.cpp b/logcat/getopt_long.cpp
index 5f8dd66..da99906 100644
--- a/logcat/getopt_long.cpp
+++ b/logcat/getopt_long.cpp
@@ -49,7 +49,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/trusty/storage/tests/main.cpp b/trusty/storage/tests/main.cpp
index 1fd6f8d..4529136 100644
--- a/trusty/storage/tests/main.cpp
+++ b/trusty/storage/tests/main.cpp
@@ -16,7 +16,6 @@
#include <assert.h>
#include <stdint.h>
-#include <stdbool.h>
#include <gtest/gtest.h>
#include <trusty/lib/storage.h>