From 04fb2c838d935783db207ec1dfb1e7835599ca53 Mon Sep 17 00:00:00 2001 From: Florian Mayer Date: Mon, 9 Jan 2023 21:46:07 +0000 Subject: [PATCH] Add comment about out-of-bounds being on purpose Change-Id: I97e334f0555cce80eeab6567905054d807af3c91 --- init/test_upgrade_mte/mte_upgrade_test_helper.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/init/test_upgrade_mte/mte_upgrade_test_helper.cpp b/init/test_upgrade_mte/mte_upgrade_test_helper.cpp index 3188337ce..6728cc6d0 100644 --- a/init/test_upgrade_mte/mte_upgrade_test_helper.cpp +++ b/init/test_upgrade_mte/mte_upgrade_test_helper.cpp @@ -60,6 +60,10 @@ int main(int argc, char** argv) { if (prctl(PR_SET_TAGGED_ADDR_CTRL, res & ~PR_MTE_TCF_SYNC, 0, 0, 0) == -1) abort(); } std::unique_ptr f(new char[1]); + // This out-of-bounds is on purpose: we are testing MTE, which is designed to turn + // out-of-bound errors into segfaults. + // This binary gets run by src/com/android/tests/init/MteUpgradeTest.java, which + // asserts that it crashes as expected. f[17] = 'x'; char buf[1]; read(1, buf, 1);