Merge "Nullability check for regex module."
diff --git a/README.md b/README.md
index 85c8190..8d8e583 100644
--- a/README.md
+++ b/README.md
@@ -246,6 +246,7 @@
### Debugging tips
1. Key error for a new codename in libc/libc.map.txt
+
e.g. what you add in libc/libc.map.txt is:
```
@@ -271,6 +272,7 @@
Solution: Ask in the team and wait for the update.
2. Use of undeclared identifier of the new system call in the test
+
Possible Solution: Check everything ready in the files mentioned above first.
Maybe glibc matters. Follow the example and try #if defined(__GLIBC__).
@@ -323,7 +325,7 @@
Note that we use our own custom gtest runner that offers a superset of the
options documented at
-<https://github.com/google/googletest/blob/master/googletest/docs/AdvancedGuide.md#running-test-programs-advanced-options>,
+<https://github.com/google/googletest/blob/main/docs/advanced.md#running-test-programs-advanced-options>,
in particular for test isolation and parallelism (both on by default).
### Device tests via CTS
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 18e8bbc..f56e16a 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -83,5 +83,10 @@
{
"name": "toybox-tests"
}
+ ],
+ "kernel-presubmit": [
+ {
+ "name": "CtsBionicTestCases"
+ }
]
}
diff --git a/libc/bionic/android_unsafe_frame_pointer_chase.cpp b/libc/bionic/android_unsafe_frame_pointer_chase.cpp
index a1cb3c6..1a59718 100644
--- a/libc/bionic/android_unsafe_frame_pointer_chase.cpp
+++ b/libc/bionic/android_unsafe_frame_pointer_chase.cpp
@@ -72,7 +72,13 @@
size_t num_frames = 0;
while (1) {
+#if defined(__riscv)
+ // Frame addresses seem to have been implemented incorrectly for RISC-V.
+ // See https://reviews.llvm.org/D87579.
+ auto* frame = reinterpret_cast<frame_record*>(begin - 16);
+#else
auto* frame = reinterpret_cast<frame_record*>(begin);
+#endif
if (num_frames < num_entries) {
buf[num_frames] = __bionic_clear_pac_bits(frame->return_addr);
}
diff --git a/libc/bionic/strtol.cpp b/libc/bionic/strtol.cpp
index ec72b09..05b4b53 100644
--- a/libc/bionic/strtol.cpp
+++ b/libc/bionic/strtol.cpp
@@ -208,9 +208,6 @@
return StrToI<long long, LLONG_MIN, LLONG_MAX, wchar_t>(s, end, base);
}
-// Public API since L, but not in any header.
-__strong_alias(strtoq, strtoll);
-
unsigned long strtoul(const char* s, char** end, int base) {
return StrToU<unsigned long, ULONG_MAX, char>(s, end, base);
}
@@ -234,6 +231,3 @@
uintmax_t wcstoumax(const wchar_t* s, wchar_t** end, int base) {
return StrToU<uintmax_t, UINTMAX_MAX, wchar_t>(s, end, base);
}
-
-// Public API since L, but not in any header.
-__strong_alias(strtouq, strtoull);
diff --git a/libc/libc.map.txt b/libc/libc.map.txt
index dc1b6f6..5695dc6 100644
--- a/libc/libc.map.txt
+++ b/libc/libc.map.txt
@@ -1037,12 +1037,10 @@
strtold_l; # introduced=21
strtoll;
strtoll_l; # introduced=21
- strtoq; # introduced=21
strtoul;
strtoull;
strtoull_l; # introduced=21
strtoumax;
- strtouq; # introduced=21
strxfrm;
strxfrm_l; # introduced=21
swapoff; # introduced-arm=19 introduced-arm64=21 introduced-x86=19 introduced-x86_64=21
diff --git a/libc/malloc_debug/backtrace.cpp b/libc/malloc_debug/backtrace.cpp
index ab5c505..0649571 100644
--- a/libc/malloc_debug/backtrace.cpp
+++ b/libc/malloc_debug/backtrace.cpp
@@ -83,41 +83,24 @@
uintptr_t ip = _Unwind_GetIP(context);
- // The instruction pointer is pointing at the instruction after the return
- // call on all architectures.
- // Modify the pc to point at the real function.
- if (ip != 0) {
-#if defined(__arm__)
- // If the ip is suspiciously low, do nothing to avoid a segfault trying
- // to access this memory.
- if (ip >= 4096) {
- // Check bits [15:11] of the first halfword assuming the instruction
- // is 32 bits long. If the bits are any of these values, then our
- // assumption was correct:
- // b11101
- // b11110
- // b11111
- // Otherwise, this is a 16 bit instruction.
- uint16_t value = (*reinterpret_cast<uint16_t*>(ip - 2)) >> 11;
- if (value == 0x1f || value == 0x1e || value == 0x1d) {
- ip -= 4;
- } else {
- ip -= 2;
- }
- }
-#elif defined(__aarch64__)
- // All instructions are 4 bytes long, skip back one instruction.
- ip -= 4;
+ // `ip` is the address of the instruction *after* the call site in
+ // `context`, so we want to back up by one instruction. This is hard for
+ // every architecture except arm64, so we just make sure we're *inside*
+ // that instruction, not necessarily at the start of it. (If the value
+ // is too low to be valid, we just leave it alone.)
+ if (ip >= 4096) {
+#if defined(__aarch64__)
+ ip -= 4; // Exactly.
+#elif defined(__arm__) || defined(__riscv)
+ ip -= 2; // At least.
#elif defined(__i386__) || defined(__x86_64__)
- // It's difficult to decode exactly where the previous instruction is,
- // so subtract 1 to estimate where the instruction lives.
- ip--;
+ ip -= 1; // At least.
#endif
+ }
- // Do not record the frames that fall in our own shared library.
- if (g_current_code_map && (ip >= g_current_code_map->start) && ip < g_current_code_map->end) {
- return _URC_NO_REASON;
- }
+ // Do not record the frames that fall in our own shared library.
+ if (g_current_code_map && (ip >= g_current_code_map->start) && ip < g_current_code_map->end) {
+ return _URC_NO_REASON;
}
state->frames[state->cur_frame++] = ip;
diff --git a/tests/signal_test.cpp b/tests/signal_test.cpp
index 7f7f3db..fa648d2 100644
--- a/tests/signal_test.cpp
+++ b/tests/signal_test.cpp
@@ -823,9 +823,9 @@
#endif
TEST(signal, sigset_size) {
- // The setjmp implementations assume that sigset_t can fit in a
- // long. This is true because ARM and x86 have broken rt signal support,
- // and AArch64 and x86_64 both have a SIGRTMAX defined as 64.
+ // The setjmp implementations assume that sigset_t can fit in a long.
+ // This is true because the 32-bit ABIs have broken rt signal support,
+ // but the 64-bit ABIs both have a SIGRTMAX defined as 64.
#if defined(__BIONIC__)
static_assert(sizeof(sigset_t) <= sizeof(long), "sigset_t doesn't fit in a long");
#endif