Merge tag 'LA.QSSI.13.0.r1-10700-qssi.0' of https://git.codelinaro.org/clo/la/platform/bionic into HEAD

"LA.QSSI.13.0.r1-10700-qssi.0"

Change-Id: Ib3e902b32ab7a2d5d5ba5f5d7d2e7dbb05a3f285
This commit is contained in:
Jake Weinstein 2023-07-02 12:56:08 +09:00
commit 3b8b9420f8
5 changed files with 48 additions and 10 deletions

View File

@ -441,6 +441,17 @@ static void expect_ids(T ids, bool is_group) {
} }
return result; return result;
}; };
// AID_PRNG_SEEDER (1092) was added in TM-QPR2, but CTS is shared
// across Android 13 versions so we may or may not find it in this
// test (b/253185870).
if (android::base::GetIntProperty("ro.build.version.sdk", 0) == __ANDROID_API_T__) {
#ifndef AID_PRNG_SEEDER
#define AID_PRNG_SEEDER 1092
#endif
ids.erase(AID_PRNG_SEEDER);
expected_ids.erase(AID_PRNG_SEEDER);
}
EXPECT_EQ(expected_ids, ids) << return_differences(); EXPECT_EQ(expected_ids, ids) << return_differences();
} }
#endif #endif

View File

@ -43,6 +43,15 @@
// mutation. // mutation.
extern "C" const char* __gnu_basename(const char* path); extern "C" const char* __gnu_basename(const char* path);
// GWP-ASan tests can run much slower, especially when combined with HWASan.
// Triple the deadline to avoid flakes (b/238585984).
extern "C" bool GetInitialArgs(const char*** args, size_t* num_args) {
static const char* initial_args[] = {"--deadline_threshold_ms=270000"};
*args = initial_args;
*num_args = 1;
return true;
}
// This file implements "torture testing" under GWP-ASan, where we sample every // This file implements "torture testing" under GWP-ASan, where we sample every
// single allocation. The upper limit for the number of GWP-ASan allocations in // single allocation. The upper limit for the number of GWP-ASan allocations in
// the torture mode is is generally 40,000, so that svelte devices don't // the torture mode is is generally 40,000, so that svelte devices don't

View File

@ -222,6 +222,7 @@ class MemtagNoteTest : public testing::TestWithParam<std::tuple<MemtagNote, bool
TEST_P(MemtagNoteTest, SEGV) { TEST_P(MemtagNoteTest, SEGV) {
#if defined(__BIONIC__) && defined(__aarch64__) #if defined(__BIONIC__) && defined(__aarch64__)
SKIP_WITH_NATIVE_BRIDGE; // http://b/242170715
// Note that we do not check running_with_hwasan() - what matters here is whether the test binary // Note that we do not check running_with_hwasan() - what matters here is whether the test binary
// itself is built with HWASan. // itself is built with HWASan.
bool withHWASAN = __has_feature(hwaddress_sanitizer); bool withHWASAN = __has_feature(hwaddress_sanitizer);

View File

@ -19,24 +19,40 @@
#include <mntent.h> #include <mntent.h>
TEST(mntent, mntent_smoke) { TEST(mntent, mntent_smoke) {
// Read all the entries with getmntent().
FILE* fp = setmntent("/proc/mounts", "r"); FILE* fp = setmntent("/proc/mounts", "r");
ASSERT_TRUE(fp != nullptr); ASSERT_TRUE(fp != nullptr);
ASSERT_TRUE(getmntent(fp) != nullptr); std::vector<std::string> fsnames;
std::vector<std::string> dirs;
mntent* me;
while ((me = getmntent(fp)) != nullptr) {
fsnames.push_back(me->mnt_fsname);
dirs.push_back(me->mnt_dir);
}
bool saw_proc = false; ASSERT_EQ(1, endmntent(fp));
// Then again with getmntent_r(), checking they match.
fp = setmntent("/proc/mounts", "r");
ASSERT_TRUE(fp != nullptr);
struct mntent entry; struct mntent entry;
char buf[BUFSIZ]; char buf[BUFSIZ];
size_t i = 0;
while (getmntent_r(fp, &entry, buf, sizeof(buf)) != nullptr) { while (getmntent_r(fp, &entry, buf, sizeof(buf)) != nullptr) {
if (strcmp(entry.mnt_fsname, "proc") == 0 && strcmp(entry.mnt_dir, "/proc") == 0) { ASSERT_EQ(fsnames[i], entry.mnt_fsname);
saw_proc = true; ASSERT_EQ(dirs[i], entry.mnt_dir);
i++;
} }
}
ASSERT_TRUE(saw_proc);
ASSERT_EQ(1, endmntent(fp)); ASSERT_EQ(1, endmntent(fp));
// And just for good measure: we did see a /proc entry, right?
auto it = std::find(fsnames.begin(), fsnames.end(), "proc");
ASSERT_TRUE(it != fsnames.end());
size_t proc_index = it - fsnames.begin();
ASSERT_EQ("/proc", dirs[proc_index]);
} }
TEST(mntent, hasmntopt) { TEST(mntent, hasmntopt) {

View File

@ -19,7 +19,8 @@ __attribute__((noinline)) void modify_stack_protector_test() {
// We can't use memset here because it's fortified, and we want to test // We can't use memset here because it's fortified, and we want to test
// the line of defense *after* that. // the line of defense *after* that.
// Without volatile, the generic x86/x86-64 targets don't write to the stack. // Without volatile, the generic x86/x86-64 targets don't write to the stack.
volatile char* p; // We can't make a constant change, since the existing byte might already have
p = reinterpret_cast<volatile char*>(&p + 1); // had that value.
*p = '\0'; volatile char* p = reinterpret_cast<volatile char*>(&p + 1);
*p = ~*p;
} }