Merge "The unit of memory.soft_limit_in_bytes(memcg v1) or memory.low(memcg v2) should be 'M', 'MB' is the invalid argument." into main
diff --git a/debuggerd/debuggerd_test.cpp b/debuggerd/debuggerd_test.cpp
index 858956a..34f2c45 100644
--- a/debuggerd/debuggerd_test.cpp
+++ b/debuggerd/debuggerd_test.cpp
@@ -335,7 +335,7 @@
ConsumeFd(std::move(output_fd), &result);
ASSERT_MATCH(result, R"(signal 11 \(SIGSEGV\), code 1 \(SEGV_MAPERR\), fault addr 0x0+dead)");
- if (mte_supported()) {
+ if (mte_supported() && mte_enabled()) {
// Test that the default TAGGED_ADDR_CTRL value is set.
ASSERT_MATCH(result, R"(tagged_addr_ctrl: 000000000007fff3)"
R"( \(PR_TAGGED_ADDR_ENABLE, PR_MTE_TCF_SYNC, mask 0xfffe\))");
@@ -443,7 +443,7 @@
TEST_P(SizeParamCrasherTest, mte_uaf) {
#if defined(__aarch64__)
- if (!mte_supported()) {
+ if (!mte_supported() || !mte_enabled()) {
GTEST_SKIP() << "Requires MTE";
}
@@ -490,7 +490,7 @@
TEST_P(SizeParamCrasherTest, mte_oob_uaf) {
#if defined(__aarch64__)
- if (!mte_supported()) {
+ if (!mte_supported() || !mte_enabled()) {
GTEST_SKIP() << "Requires MTE";
}
@@ -522,7 +522,7 @@
TEST_P(SizeParamCrasherTest, mte_overflow) {
#if defined(__aarch64__)
- if (!mte_supported()) {
+ if (!mte_supported() || !mte_enabled()) {
GTEST_SKIP() << "Requires MTE";
}
@@ -565,7 +565,7 @@
TEST_P(SizeParamCrasherTest, mte_underflow) {
#if defined(__aarch64__)
- if (!mte_supported()) {
+ if (!mte_supported() || !mte_enabled()) {
GTEST_SKIP() << "Requires MTE";
}
@@ -614,7 +614,7 @@
// unsubtle chaos is sure to result.
// https://man7.org/linux/man-pages/man3/longjmp.3.html
#if defined(__aarch64__)
- if (!mte_supported()) {
+ if (!mte_supported() || !mte_enabled()) {
GTEST_SKIP() << "Requires MTE";
}
@@ -648,7 +648,7 @@
TEST_F(CrasherTest, mte_async) {
#if defined(__aarch64__)
- if (!mte_supported()) {
+ if (!mte_supported() || !mte_enabled()) {
GTEST_SKIP() << "Requires MTE";
}
@@ -678,7 +678,7 @@
TEST_F(CrasherTest, mte_multiple_causes) {
#if defined(__aarch64__)
- if (!mte_supported()) {
+ if (!mte_supported() || !mte_enabled()) {
GTEST_SKIP() << "Requires MTE";
}
@@ -764,7 +764,7 @@
TEST_F(CrasherTest, mte_register_tag_dump) {
#if defined(__aarch64__)
- if (!mte_supported()) {
+ if (!mte_supported() || !mte_enabled()) {
GTEST_SKIP() << "Requires MTE";
}
@@ -797,7 +797,7 @@
TEST_F(CrasherTest, mte_fault_tag_dump_front_truncated) {
#if defined(__aarch64__)
- if (!mte_supported()) {
+ if (!mte_supported() || !mte_enabled()) {
GTEST_SKIP() << "Requires MTE";
}
@@ -828,7 +828,7 @@
TEST_F(CrasherTest, mte_fault_tag_dump) {
#if defined(__aarch64__)
- if (!mte_supported()) {
+ if (!mte_supported() || !mte_enabled()) {
GTEST_SKIP() << "Requires MTE";
}
@@ -862,7 +862,7 @@
TEST_F(CrasherTest, mte_fault_tag_dump_rear_truncated) {
#if defined(__aarch64__)
- if (!mte_supported()) {
+ if (!mte_supported() || !mte_enabled()) {
GTEST_SKIP() << "Requires MTE";
}
diff --git a/debuggerd/libdebuggerd/test/tombstone_proto_to_text_test.cpp b/debuggerd/libdebuggerd/test/tombstone_proto_to_text_test.cpp
index aad209a..988ca0c 100644
--- a/debuggerd/libdebuggerd/test/tombstone_proto_to_text_test.cpp
+++ b/debuggerd/libdebuggerd/test/tombstone_proto_to_text_test.cpp
@@ -175,3 +175,8 @@
ProtoToString();
EXPECT_MATCH(text_, "\\(BuildId: 0123456789abcdef\\)\\nSYMBOLIZE 0123456789abcdef 12345\\n");
}
+
+TEST_F(TombstoneProtoToTextTest, uid) {
+ ProtoToString();
+ EXPECT_MATCH(text_, "\\nLOG uid: 0\\n");
+}
diff --git a/init/README.md b/init/README.md
index c9742ad..6a66f14 100644
--- a/init/README.md
+++ b/init/README.md
@@ -971,26 +971,13 @@
Bootcharting
------------
-This version of init contains code to perform "bootcharting": generating log
-files that can be later processed by the tools provided by <http://www.bootchart.org/>.
+Bootchart provides CPU and I/O load breakdown of all processes for the whole system.
+Refer to the instructions at
+ <https://source.android.com/docs/core/perf/boot-times#bootchart>.
On the emulator, use the -bootchart _timeout_ option to boot with bootcharting
activated for _timeout_ seconds.
-On a device:
-
- adb shell 'touch /data/bootchart/enabled'
-
-Don't forget to delete this file when you're done collecting data!
-
-The log files are written to /data/bootchart/. A script is provided to
-retrieve them and create a bootchart.tgz file that can be used with the
-bootchart command-line utility:
-
- sudo apt-get install pybootchartgui
- # grab-bootchart.sh uses $ANDROID_SERIAL.
- $ANDROID_BUILD_TOP/system/core/init/grab-bootchart.sh
-
One thing to watch for is that the bootchart will show init as if it started
running at 0s. You'll have to look at dmesg to work out when the kernel
actually started init.
diff --git a/init/compare-bootcharts.py b/init/compare-bootcharts.py
index 009b639..b299b7d 100755
--- a/init/compare-bootcharts.py
+++ b/init/compare-bootcharts.py
@@ -47,7 +47,7 @@
def analyze_process_maps(process_map1, process_map2, jiffy_record):
# List interesting processes here
processes_of_interest = [
- '/init',
+ '/system/bin/init',
'/system/bin/surfaceflinger',
'/system/bin/bootanimation',
'zygote64',
diff --git a/trusty/libtrusty/tipc-test/tipc_test.c b/trusty/libtrusty/tipc-test/tipc_test.c
index 9910aee..121837d 100644
--- a/trusty/libtrusty/tipc-test/tipc_test.c
+++ b/trusty/libtrusty/tipc-test/tipc_test.c
@@ -55,8 +55,6 @@
"}"
/* clang-format on */
-#define countof(arr) (sizeof(arr) / sizeof(arr[0]))
-
static const char *uuid_name = "com.android.ipc-unittest.srv.uuid";
static const char *echo_name = "com.android.ipc-unittest.srv.echo";
static const char *ta_only_name = "com.android.ipc-unittest.srv.ta_only";
@@ -906,14 +904,12 @@
static int send_fd_test(const struct tipc_test_params* params) {
int ret;
- int dma_buf[] = {-1, -1, -1};
+ int dma_buf = -1;
int fd = -1;
- volatile char* buf[countof(dma_buf)] = {MAP_FAILED, MAP_FAILED, MAP_FAILED};
+ volatile char* buf = MAP_FAILED;
BufferAllocator* allocator = NULL;
- uint i;
const size_t num_chunks = 10;
- const size_t buf_size = memref_chunk_size * num_chunks;
fd = tipc_connect(params->dev_name, receiver_name);
if (fd < 0) {
@@ -929,86 +925,56 @@
goto cleanup;
}
- for (i = 0; i < countof(dma_buf); i++) {
- ret = DmabufHeapAlloc(allocator, "system", buf_size, 0, 0 /* legacy align */);
- if (ret < 0) {
- fprintf(stderr, "Failed to create dma-buf fd of size %zu err (%d)\n", buf_size, ret);
- goto cleanup;
- }
- dma_buf[i] = ret;
+ size_t buf_size = memref_chunk_size * num_chunks;
+ dma_buf = DmabufHeapAlloc(allocator, "system", buf_size, 0, 0 /* legacy align */);
+ if (dma_buf < 0) {
+ ret = dma_buf;
+ fprintf(stderr, "Failed to create dma-buf fd of size %zu err (%d)\n", buf_size, ret);
+ goto cleanup;
}
- for (i = 0; i < countof(dma_buf); i++) {
- buf[i] = mmap(0, buf_size, PROT_READ | PROT_WRITE, MAP_SHARED, dma_buf[i], 0);
- if (buf[i] == MAP_FAILED) {
- fprintf(stderr, "Failed to map dma-buf: %s\n", strerror(errno));
- ret = -1;
- goto cleanup;
- }
-
- strcpy((char*)buf[i], "From NS");
+ buf = mmap(0, buf_size, PROT_READ | PROT_WRITE, MAP_SHARED, dma_buf, 0);
+ if (buf == MAP_FAILED) {
+ fprintf(stderr, "Failed to map dma-buf: %s\n", strerror(errno));
+ ret = -1;
+ goto cleanup;
}
- struct trusty_shm shm[] = {
- {
- .fd = dma_buf[0],
- .transfer = TRUSTY_SHARE,
- },
- {
- .fd = dma_buf[0],
- .transfer = TRUSTY_SEND_SECURE_OR_SHARE,
- },
- {
- .fd = dma_buf[1],
- .transfer = TRUSTY_LEND,
- },
- {
- .fd = dma_buf[1],
- .transfer = TRUSTY_SEND_SECURE_OR_SHARE,
- },
- {
- .fd = dma_buf[2],
- .transfer = TRUSTY_SEND_SECURE_OR_SHARE,
- },
+ strcpy((char*)buf, "From NS");
+
+ struct trusty_shm shm = {
+ .fd = dma_buf,
+ .transfer = TRUSTY_SHARE,
};
- for (i = 0; i < countof(shm); i++) {
- ssize_t rc = tipc_send(fd, NULL, 0, &shm[i], 1);
- if (rc < 0) {
- fprintf(stderr, "tipc_send failed: %zd\n", rc);
- ret = rc;
- goto cleanup;
- }
- char c;
- read(fd, &c, 1);
+ ssize_t rc = tipc_send(fd, NULL, 0, &shm, 1);
+ if (rc < 0) {
+ fprintf(stderr, "tipc_send failed: %zd\n", rc);
+ ret = rc;
+ goto cleanup;
}
+ char c;
+ read(fd, &c, 1);
+ tipc_close(fd);
ret = 0;
- for (i = 0; i < countof(buf); i++) {
- for (size_t skip = 0; skip < num_chunks; skip++) {
- int cmp = strcmp("Hello from Trusty!", (const char*)&buf[i][skip * memref_chunk_size])
- ? (-1)
- : 0;
- if (cmp) fprintf(stderr, "Failed: Unexpected content at page %zu in dmabuf\n", skip);
- ret |= cmp;
- }
+ for (size_t skip = 0; skip < num_chunks; skip++) {
+ int cmp = strcmp("Hello from Trusty!",
+ (const char*)&buf[skip * memref_chunk_size]) ? (-1) : 0;
+ if (cmp)
+ fprintf(stderr, "Failed: Unexpected content at page %zu in dmabuf\n", skip);
+ ret |= cmp;
}
cleanup:
- for (i = 0; i < countof(dma_buf); i++) {
- if (buf[i] != MAP_FAILED) {
- munmap((char*)buf[i], buf_size);
- }
- if (dma_buf[i] >= 0) {
- close(dma_buf[i]);
- }
+ if (buf != MAP_FAILED) {
+ munmap((char*)buf, buf_size);
}
+ close(dma_buf);
if (allocator) {
FreeDmabufHeapBufferAllocator(allocator);
}
- if (fd >= 0) {
- tipc_close(fd);
- }
+ tipc_close(fd);
return ret;
}