Commit graph

1005 commits

Author SHA1 Message Date
Florian Mayer
4841207b53 Handle scudo_stack_depot_size = 0
Bug: 309446692
Change-Id: Ic55294316137847041f1e829cb0243aae8926379
2023-12-04 17:29:23 -08:00
Florian Mayer
e8fcfee409 Use scudo_stack_depot_size from process_info
This is a no-op but will be used in upcoming scudo changes that allow to
change the depot size at process startup time, and as such we will no
longer be able to call __scudo_get_stack_depot_size in debuggerd.

We already did the equivalent change for the ring buffer size in
https://r.android.com/q/topic:%22scudo_ring_buffer_size%22

Bug: 309446692
Change-Id: I761a7602c54a1f8f2d0575c5e011820d8dbaab63
2023-12-04 16:48:45 -08:00
Christopher Ferris
c7cc571fa1 Avoid crashing on bad architecture value.
The only way to get a bad architecture value in the protobuf is if
the data was corrupted or an unsupported architecture was added without
the register support.

If the protobuf is corrupted, this is strictly better since it
still produces a tombstone with the data present.

If there is an unsupported architecture, it will still result in a tombstone,
only the registers would not be present. It would also be very obviously
a problem that needs to be fixed. Again, this is strictly better since
the crash in generation is not necessarily visible unless you look at
the log. Here, the data is in the log and in the tombstone.

This also removes the only dependency in this file on the async_safe
library.

Test: Ran unit tests.
Test: Forced an invalid architecture and verified tombstone is present
Test: with error message, and error message printed in the log.
Change-Id: I8e4a2e3f778fafb5b7241c2f23d5f867f1341ed8
2023-11-17 22:12:14 +00:00
Christopher Ferris
1503890fc6 Update to support new shared_ptr returns.
Bug: 309857311

Test: All unit tests pass.
Change-Id: Ia44ebeb558d3d1101ab63b064731656f0f89c487
2023-11-10 00:05:49 -08:00
Mattias Simonsson
38ab045342 debuggerd_test: Scale timeouts by HwTimeoutMultiplier
Timeouts in tombstoned.cpp and intercept_manager.cpp are scaled
by HwTimeoutMultiplier, but the timeouts in debuggerd_test.cpp
are not, which means the CrasherTest#intercept_timeout test will
fail for any platform that has a high enough HwTimeoutMultiplier.

Bug: 309532789
Test: debuggerd_test.CrasherTest#intercept_timeout
Change-Id: I83cd01e87644c011efa155a32fd5d92cc8a43a95
2023-11-08 14:56:48 -08:00
Christopher Ferris
6aa72490dc Add new segv type SEGV_CPERR.
The new 6.6 kernel headers added a new segv type, SEGV_CPERR. Add this
to the switch statement.

Test: Unit tests pass.
Change-Id: I77eb4748e51c7e7d7291bfd2180b0ccb3b5a6ded
2023-10-31 14:01:09 -07:00
Christopher Ferris
b92b52c071 Add ability to handle multiple intercepts per pid.
While doing this, refactor the intercept code to be easier to understand.

The primary use case for this is to perform a parallel stack dump (both Java and native) for specific ANRs.

Add tests for all of the different intercept conditions.

Modify the tests to display the error message from the intercept
response if there is an error.

Bug: 254634348
Test: All unit tests pass.
Test: Ran debuggerd on native and java processes.
Test: Created a bugreport without error.
Change-Id: Ic531ccee05b9a470748b815cf109e0076150a0b6
2023-10-19 15:13:59 +00:00
Elliott Hughes
041afb2883 Add the missing copyright headers to the .S files.
Dates taken from `git log --follow`.

Test: treehugger
Change-Id: I80e9ea6aa01f8e0553295453749afcbc3af827f9
2023-09-28 10:41:21 -07:00
Christopher Ferris
f58b009b7b Disable warning which is not detecting problems.
A clang update enabled -Wreorder-init-list by default. Since it doesn't
provide any benefit to the debuggerd code, disable the warning.

Test: Builds without warnings.
Change-Id: I75cfe064ba92c74312ba33f329b1364258eba06c
2023-09-12 13:01:10 -07:00
Andrei Diea
e3bda36e0b debuggerd: add socksetopt to seccomp policy
aosp/2734054 added socket timeouts for nonblocking liblog ops.
seccomp policy was not updated so tests failed when unallowed
socksetopt syscall was made.

Bug: 298420226
Test: atest debuggerd_test

Change-Id: Iace232ec8b94e5d316d344abc5d866fe314607e0
Signed-off-by: Andrei Diea <adiea@google.com>
2023-09-05 19:29:13 +00:00
Christopher Ferris
9f32fba6d3 Merge "Fix potential miscellaneous debuggerd issues." into main 2023-08-10 19:53:19 +00:00
Christopher Ferris
3a0833c9cd Fix potential miscellaneous debuggerd issues.
Check for the log opening failing.

Add the ability to put error messages in the log and tombstone so
that it's clear if the log reading failed in some way.

Adjust test so that if there is a log or if no log exists, the test
will still pass.

Print an <unknown> if the command line is unreadable instead of nothing.

Test: Ran unit tests.
Test: Induced error and verified error message is save in tombstone.
Change-Id: I2fce8078573b40b9fed3cd453235f3824cadb5e3
2023-08-09 17:31:55 -07:00
Treehugger Robot
cf32fd18d4 Merge "debuggerd: fix passing of fdsan_table to crash_dump" into main 2023-08-09 23:15:06 +00:00
Tomislav Novak
24a7df5d38 debuggerd: fix passing of fdsan_table to crash_dump
Commit aosp/1259140 moved fdsan_table into debugger_process_info, which
is populated conditionally. This introduced a bug where the process that
receives BIONIC_SIGNAL_DEBUGGER (35) does not propagate the fdsan_table
pointer to crash_dump:

  $ adb shell kill -SIG35 <pid>
  $ adb logcat -s DEBUG
  E DEBUG   : failed to read fdsan table entry 0: I/O error

Fdsan in warn-only mode uses BIONIC_SIGNAL_DEBUGGER[1], so the generated
tombstones don't have any fd ownership info.

Fix it by calling get_process_info() irrespective of the signal being
handled, taking care to preserve the previous behavior of not showing
abort messages set by applications in non-fatal dumps.

Test: debuggerd_test
Test: send SIG35 to arbitrary process and inspect the log and tombstone
Test: crasher fdsan_file

[1] 20ad9129e7/libc/bionic/fdsan.cpp (166)

Change-Id: I76931ca4825e846fc99f26fa590c045130abb850
2023-08-09 15:19:51 -07:00
Treehugger Robot
8f5fab42df Merge "crasher: add pac and bti crashes." into main 2023-08-08 23:47:21 +00:00
Elliott Hughes
1b13b14758 crasher: add pac and bti crashes.
Also add the missing `.size` directives to all the assembler functions
for slightly improved backtraces.

Test: crasher64 pac; crasher64 bti
Change-Id: I8e0c127cbff56c33637e6ca8f1d927b971951807
2023-08-08 16:06:24 -07:00
Christopher Ferris
48d6e0452e Make libdebuggerd ramdisk available.
Test: Builds and debuggerd unit tests pass.
Change-Id: I2a5bd96e349f81ae0bec8dbffc49646c1f58bfea
2023-07-31 14:24:01 -07:00
Andrew Walbran
9fbd1683d4 Add safety comments.
These will soon be required by a lint.

Bug: 290018030
Test: m vm virtmgr
Change-Id: Id628b2a88f1cb0235fbccc748c52514e64561fe5
2023-07-10 14:56:20 +01:00
Kelvin Zhang
786dac3d50 Update some fs_mgr/debuggerd to use getpagesize() instead of PAGE_SIZE
Test: th
Bug: 279808236
Change-Id: I9d30cfe19d2b1a7d624cc5425e4315dc6e3b2ad2
2023-06-27 10:50:07 -07:00
Christopher Ferris
1442d47bd6 Merge "Check get_gwp_asan_callbacks before calling." 2023-05-26 19:03:01 +00:00
Christopher Ferris
004a16739d Check get_gwp_asan_callbacks before calling.
When using the bootstrap linker, the get_gwp_asan_callbacks is
not set. Therefore, check it is not nullptr before calling it
during crash processing.

Bug: 284098779

Test: Ran crasher64 using /system/bin/bootstrap/linker64 and verify
Test: debuggerd code does not crash.
Test: All unit tests pass.
Change-Id: Ifc710fe4bef24661700444a1b69432bfc29d580f
2023-05-25 12:42:41 -07:00
Treehugger Robot
2dc80e3805 Merge "Updated the policy file associated with riscv64" 2023-05-25 17:29:40 +00:00
liwentao
4d8f37edae Updated the policy file associated with riscv64
The generate.sh script can generate the file, but current policy file does not match it.
And the rules are not appropriate, like missing "sysinfo", causing the
debuggerd_test to fail in system model. So we match the policy to
what it should be.

Test: make debuggerd_test

Change-Id: I57ebd7713f2ab939d01bfefcc7935e234fdd3e13
Signed-off-by: liwentao <liwentao@eswincomputing.com>
2023-05-25 18:08:02 +08:00
Christopher Ferris
98d6242dc7 Limit the number of log messages in a tombstone.
Some testing environments can have a test that is sending many
thousands of messages to the log. When this type of process crashes
all of these log messages are captured and can cause OOM errors
while creating the tombstone.

Added a test to verify the log messages are truncated. Leaving this
test disabled for now since it is inherently flaky due to having to
assume that 500 messages are in the log.

Added a test for a newline in a log message since it's somewhat
related to this change.

NOTE: The total number of messages is capped at 500, but if a message
contains multiple newlines, the total messages will exceed 500.
Counting messages this way seems to be in the spirit of the cap,
that a process logging a large message with multiple newlines does
not completely fill the tombstone log data.

Bug: 269182937
Bug: 282661754

Test: All unit tests pass.
Test: The disabled max_log_messages test passes.
Change-Id: If18e62b29f899c2c4670101b402e37762bffbec6
2023-05-24 20:10:55 +00:00
Frederick Mayle
56abaa0959 debuggerd: simplify output handling
Just noticed some opportunities while skimming.

Test: adb shell debuggerd $(adb shell pidof com.android.systemui)
Test: All unit tests pass (both 32 bit and 64 bit).
Test: Ran unit tests in a loop hundreds of times.
Change-Id: I428d0cf599ed603a21944b084b95594db893cbd5
2023-05-19 15:19:06 -07:00
Frederick Mayle
52205b8206 debuggerd_client_test: less racy test setup
Make sure that all the threads have started up, otherwise the main part
of the test might not be testing as stressful a situation as expected.
Note that the "race" moniker is still valid because of the debuggerd
timeout.

The test is now faster (405ms) when run under good conditions.

Test: atest 'debuggerd_test:debuggerd_client#race'
Test: Ran debuggerd_client.race 1000 times on its own.
Test: Ran the whole suite of debuggerd unit tests 1000 times.
Change-Id: I487e7654a71df9f1799f09c6f385c929ddf2f234
2023-05-17 12:50:51 -07:00
Christopher Ferris
bda1064160 Re-add code to skip gettings logs on logd crashes.
Also add new unit tests to verify this behavior.

Bug: 276934420

Test: New unit tests pass.
Test: Ran new unit tests without pthread_setname_np call and verified
Test: the tests fail.
Test: Force crash logd and verify log messages are not gathered.
Test: Force crash a logd thread and verify log messages are not gathered.
Change-Id: If8effef68f629432923cdc89e57d28ef5b8b4ce2
2023-04-24 18:31:29 -07:00
Florian Mayer
152de539df Merge "Print number of frames" 2023-04-10 20:59:18 +00:00
Florian Mayer
59e632a292 Print number of frames
liblog can drop data when debuggerd is overloaded, which leads to
truncated tombstones. by adding the count separately, automation can
easily see whether it is dealing with a truncated tombstone or not.

Bug: 269537146
Change-Id: Ia991537efc0d6b57cbff23ee45af6521467aa20d
2023-04-06 23:38:40 +00:00
Kevin Jeon
2a70a7432c Merge "Add pointer dereference in debuggerd error msg" 2023-04-05 22:34:51 +00:00
Kevin Jeon
06af624e66 Add pointer dereference in debuggerd error msg
This change adds a missing pointer dereference to the InterceptResponse
when checking for a size mismatch.

Test: build
Bug: N/A
Change-Id: I88afed6f1c0f33fe237d337b0fb8fc0a0c0e3bac
2023-04-05 16:32:39 -04:00
Treehugger Robot
1c324d3559 Merge "Handle with the nonnull case in a tricky way" 2023-04-01 02:46:24 +00:00
zijunzhao
fa8037c207 Handle with the nonnull case in a tricky way
The func readdir() is not allowed to pass a nullptr.
Bug: b/245972273
Test: mm

Change-Id: Idbb3f552b026dc6d727886d22989d3359ed6633b
2023-03-31 23:50:37 +00:00
Mitch Phillips
5a2a302108 Merge "[debuggerd] New protocol to AM to handle recoverable crashes." 2023-03-29 20:28:35 +00:00
Elliott Hughes
3b1e71c63b Merge "riscv64: fix debuggerd_test build." 2023-03-21 18:56:36 +00:00
Shikha Panwar
e11ab73647 Merge "Add tombstone_handler for crashes in Microdroid" 2023-03-21 18:14:12 +00:00
Elliott Hughes
857e29c356 riscv64: fix debuggerd_test build.
This adds the missing assembler for riscv64, even though I don't have a
working tombstoned yet to test it with. There's a distinct possibility
we'll be back to fix the test (because although "register 1" is harmless
for the other architectures, it's the ra register on riscv64; the default
link register), but at least this lets us build the test.

I've also simplified all the assembly to be the simplest sequence I
know that writes 0 to address 0 (because if there was a reason to use
so many instructions before, I want to know what it is so I can write
the missing comment!).

Test: treehugger
Change-Id: I10d117eaedf361d9759a450e0973d07c4f97090e
2023-03-20 17:48:53 -07:00
Elliott Hughes
7e82c0037b riscv64: fix mips-ism.
r29 is the stack pointer on mips, but it's x2 on riscv64 (and the git
history shows that this was indeed copy & pasted from the mips code)
and since bionic always sets up a signal stack with sigaltstack() I
doubt the comment was relevant even on mips (but no-one ever used it,
so who'd know?).

While I'm here, stop using decimal arithmetic --- the whole point was to
have each register contain the value that was obviously appropriate for
that register. (riscv64's mips-like mess of registers all over the place
means that's not going to be super readable, but there's no reason to
make it worse.)

Also, even though I personally prefer the 0xdead from the old mips code,
everyone else is using 0xa5a5, so let's make riscv64 match the others.

Test: treehugger
Change-Id: Ibbae821bc0a02e07164147d621e342224528c2c9
2023-03-20 16:08:15 -07:00
Elliott Hughes
fa4dd04889 Merge "Fix riscv64's crash glue." 2023-03-20 22:16:50 +00:00
Shikha Panwar
abde59e689 Add tombstone_handler for crashes in Microdroid
This changes the crash export mechanism in Microdroid. For this, we
create module tombstone_handler which exports methods very similar to
tombstoned.h

For Microdroid (detected using prop: ro.hardware): It calls newly
introduces microdroid specific methods to connect/notify completion of
crash.

Individual methods:
connect -> For Android, it would connect to
tombstoned which would send it the fd corresponding to newly created
file on /data/tombstone_ . For Microdroid, we connect to tombstone
server on host via vsock & populate these sockets as the output fd.
crash_dump, in the later case, would directly write on the socket(s).

notify_completion: For Microdroid, it would simply shutdown the vsock
connections.

Note when OS is not Microdroid: It calls corresponding methods of
tombstoned_client, essentially serving as a proxy.

Detailed design: go/vm-tombstone
Test: atest MicrodroidHostTests#testTombstonesAreGeneratedUponUserspaceCrash
Bug: 243494912

Change-Id: I68537b967f2ee48c1647f0f923aa79e8bcc66942
2023-03-20 11:46:09 +00:00
Treehugger Robot
a4aab52663 Merge "Remove floating point register cruft." 2023-03-18 00:15:36 +00:00
Elliott Hughes
d284414786 Fix riscv64's crash glue.
When this was translated to riscv64, someone "fixed" the crashing bugs
that were the whole point of these two functions. Fix them back so they
actually crash, and add the CFI directives.

Test: treehugger
Change-Id: I312c51fa4c893d27b0f4e39383521657a5870a0d
2023-03-17 00:42:15 +00:00
Elliott Hughes
d5c90b0337 Match the arm/arm64 style in the x86/x86-64 files.
Test: treehugger
Change-Id: Id67cfeab293c7530aa1905a39455e8513d51e978
2023-03-17 00:40:26 +00:00
Elliott Hughes
f9cd73f851 Remove floating point register cruft.
We stopped showing floating point registers years ago, but some cruft
remains.

Test: treehugger
Change-Id: Ib89032db90a31a49d090bc5d99f9c401af734e7a
2023-03-17 00:38:26 +00:00
Mitch Phillips
dd5a80dff5 [debuggerd] New protocol to AM to handle recoverable crashes.
See aosp/2485756 for more details, but this patch introduces a new
protocol between debuggerd and ActivityManager. This new protocol allows
ActivityManager to correctly handle recoverable crashes.

Bug: 270720163
Test: atest CtsGwpAsanTestCases
Change-Id: Icac6262d608dd57a5daf51699064ab28b0c4703f
2023-03-14 16:25:44 -07:00
Christopher Ferris
4761355a54 Fix unwind information for crash assembler.
Test: Crash on arm, arm64, x86, x86_64 and verified full stack is
Test: found in tombstone.
Change-Id: I809ec66d6ce9af378c8e8b04cc1c85b51a61779f
2023-03-13 14:44:22 -07:00
Treehugger Robot
b3bf57dbe9 Merge "Accept SEGV_MTESERR in CrasherTest.mte_async test." 2023-03-09 00:34:39 +00:00
Peter Collingbourne
91e816aa0e Accept SEGV_MTESERR in CrasherTest.mte_async test.
This is possible when upgrading to sync mode.

Change-Id: I71c213cb9ddda87765a0dc2ff5455f0eb7b484fe
2023-03-07 21:27:09 -08:00
zijunzhao
f5e1533f2f Suppress the error warning
Bug: https://android-build.googleplex.com/builds/pending/P51300433/aosp_bramble-userdebug/latest/view/logs/build_error.log
Test: None
Change-Id: I2fbd3d8772c50ed9de1c2ba9eb2234966c7dcb84
2023-03-08 02:40:09 +00:00
Treehugger Robot
a010a27da9 Merge "crash_dump: suggest lldbclient.py rather than gdbclient.py." 2023-03-01 04:00:33 +00:00
Elliott Hughes
5a4e62513f crash_dump: suggest lldbclient.py rather than gdbclient.py.
They're the same script right now, but gdbclient.py is a bit misleading,
even if we're not likely to ever actually remove it.

Test: treehugger
Change-Id: Ic514f98bf13b3e699be4dbad2bafef22d41d9ffd
2023-02-28 22:16:19 +00:00
Mitch Phillips
70aa219034 [gwp-asan] fix tests under clang coverage, and extend invariants
1. Fixes this test under clang coverage, which is run under presubmit
   for TEST_MAPPING files. When we spawn under a minijail, and the
   process exited normally (which is the case for recoverable), clang
   coverage would use atexit handlers to dump some stuff using banned
   prctl's and other syscalls. Instead of allow-listing them all which
   sounds like a huge pain, call _exit() which skips those handlers.

2. Extends the invariant testing to make sure that recoverable GWP-ASan
   recovers both the first time, and a second time in a different slot.

Bug: N/A
Test: CLANG_COVERAGE=true NATIVE_COVERAGE_PATHS="*" atest debuggerd_test
Change-Id: I6059e21db4c2898b1c9777a00d2a54497d80ef79
2023-02-22 12:27:37 -08:00
Mitch Phillips
8fe5127027 Recoverable GWP-ASan: Don't tell ActivityManager
Currently, debuggerd tells the teacher that an app that received a fatal
signal. On the playground, dobbing on a process that doesn't actually
need to be killed is considered a friendship-ending move.

Because recoverable GWP-ASan is *supposed* to not crash your app,
suppress this behaviour and don't let ActivityManager know about the
crash.

Bug: N/A
Test: Run a use-after-free in an app that's using recoverable GWP-ASan,
through the 'libc.debug.gwp_asan.recoverable.<app_name>=1' and
'libc.debug.gwp_asan.process_sampling.<app_name>=1' sysprops.

Change-Id: I033ea67d577573df10936e37db7302d4f4bc0069
2023-02-07 17:06:32 -08:00
Mitch Phillips
6e0eb996b3 Merge "Add recoverable GWP-ASan." 2023-02-03 18:35:08 +00:00
Mitch Phillips
18ce54241c Add recoverable GWP-ASan.
Recoverable GWP-ASan is a mode landed upstream in
https://reviews.llvm.org/D140173. For more information about why/what it
is, see
https://android-review.git.corp.google.com/c/platform/bionic/+/2394588.

This patch makes debuggerd call the required libc callbacks for GWP-ASan
to recover from the memory corruption. It also adds the functionality
that libart/sigchain eventually ends up calling, which dumps a GWP-ASan
report for the first error encountered.

Test: Build the platform, run sanitizer-status in recoverable mode,
asserting that it doesn't crash but we get a debuggerd report.
Bug: 247012630

Change-Id: I27212f7250844c20a8fd1e961417cdb4e5bd3626
2023-02-01 15:25:29 -08:00
Christopher Ferris
22035ccb01 Display offset in backtraces if necessary.
When moving to a proto tombstone, backtraces no longer contain
an offset when a frame is in a shared library from an apk.
Add the offset display again if needed, and add a test to
verify this behavior.

Bug: 267341682

Test: All unit tests pass.
Test: Dumped a process running through an apk to verify the offset
Test: is present.
Change-Id: Ib720ccb5bfcc8531d1e407f3d01817e8a0b9128c
2023-01-31 17:53:45 -08:00
Florian Mayer
1d79a07586 [MTE] add link to SAC docs to tombstones
Test: m, flash, look at tombstone
Change-Id: I091d3dc9207d0ba7e692dcc28adc04aec33cf336
2023-01-26 02:09:57 +00:00
Florian Mayer
8b91862b8f [Refactor] move memory map printing to helper
An early return out of this function makes it harder to add new prints
after the memory maps.

Test: m, flash, look at tombstone
Change-Id: Id06e432918d69ac3307761b244473b6b7ab769e8
2023-01-26 01:39:15 +00:00
Florian Mayer
3d11890797 Merge "[MTE] warn about async crashes being imprecise" 2023-01-20 02:12:42 +00:00
Florian Mayer
5fcdfd2504 [MTE] warn about async crashes being imprecise
Bug: 175335730
Change-Id: If666c98b53dee1c63c48887f4448bc54f78a0a9f
2023-01-20 00:33:29 +00:00
Treehugger Robot
a812f45678 Merge "Pass fault address to GWP-ASan's changed API." 2023-01-17 20:29:46 +00:00
Florian Mayer
30a25286c4 Handle scudo_ring_buffer_size = 0
Bug: 263287052
Change-Id: I0bec3a817d7a16c72d5dfeddd0dcc86830f5a311
2023-01-12 16:06:10 -08:00
Mitch Phillips
8a34b179ad Pass fault address to GWP-ASan's changed API.
GWP-ASan changed one of the APIs upstream to now take the fault address
as well. This is to support the recoverable mode.

Add the fault address as well.

Test: gwp_asan_unittest
Bug: N/A
Change-Id: I8a4edd3fad159d91cc036050d330bbb8f9c8d435
2023-01-12 09:48:11 -08:00
Florian Mayer
fe9d83251b Merge "Use scudo_ring_buffer_size from process_info" 2023-01-10 21:23:33 +00:00
Elliott Hughes
c0748f0276 Merge "debuggerd: show syscall in SYS_SECCOMP one-liners." 2023-01-05 23:30:08 +00:00
Florian Mayer
bd49c387f0 Use scudo_ring_buffer_size from process_info
This is a no-op but will be used in upcoming scudo changes that allow to
change the buffer size at process startup time, and as such we will no
longer be able to call __scudo_get_ring_buffer_size in debuggerd.

Bug: 263287052
Change-Id: I350421d1fcdf22ce3b8b73780b88c1e10fa8a074
2023-01-05 15:14:56 -08:00
Elliott Hughes
d32733dbc7 debuggerd: show syscall in SYS_SECCOMP one-liners.
The current logging...
```
F libc    : Fatal signal 31 (SIGSYS), code 1 (SYS_SECCOMP) in tid 6640 (logcat), pid 6640 (logcat)
```
...isn't super useful if crash_dump then fails, because you have no idea
what syscall caused the problem.

We already include the fault address in this line for relevant cases,
so include the syscall number in this case.

Bug: http://b/262391724
Test: treehugger
Change-Id: I45ad7d99c9904bab32b65efeb19be232e59ab3a4
2023-01-05 00:55:38 +00:00
Florian Mayer
c3a7e4862c Merge "static_assert to catch struct mismatches earlier" 2023-01-04 23:46:59 +00:00
Chih-Hung Hsieh
7e575a07be Disable clang-tidy on crash test.
Bug: 263274255
Test: presubmit; make tidy-system-core-debuggerd_subset
Change-Id: I2eb5dcb87894b3282ff19e006f6a0209c9153519
2023-01-03 15:58:29 -08:00
Florian Mayer
ab644a0e6e static_assert to catch struct mismatches earlier
Change-Id: Ia6294c6f8848d0d3d0d7d901e3b78ac3babdf7ac
2022-12-21 17:39:54 -08:00
Elliott Hughes
a27f23e61e Remove an unnecessary #include.
This confused me while doing a code search.

Test: treehugger
Change-Id: Ic8d63a3f5b8efb8557d0033d458f5265762da716
2022-12-13 17:08:24 +00:00
Chih-Hung Hsieh
3ec1e81425 Suppress clang-tidy on crasher.cpp
* Intentional crash test code with null/free/escape warnings.

Test: make tidy-system-core-debuggerd_subset
Change-Id: Ib1255c17a374729c82aa246c6a59156dbc4e1b77
2022-12-05 11:28:40 -08:00
Elliott Hughes
2f883314b9 riscv64 doesn't require a 32-bit crash dump policy.
Test: `mm -j` in bionic
Change-Id: I6c2e91b540f544b1ca428692ebfb25697b0cb6e4
2022-11-14 20:06:16 +00:00
Treehugger Robot
da644317e3 Merge "Clean up some unneeded non-neon support." 2022-10-31 18:51:46 +00:00
Elliott Hughes
7a30483996 Clean up some unneeded non-neon support.
It's 2022.

Test: treehugger
Change-Id: If7feede199545cf36ae4759b635a56d1421e505f
2022-10-31 15:38:01 +00:00
Treehugger Robot
cb881e7cf0 Merge "Add riscv support for heap_addr_in_register" 2022-10-29 18:23:31 +00:00
haocheng.zy@linux.alibaba.com
3f4d036cb6 Add riscv support for heap_addr_in_register
Change-Id: I42a93a96c8c9c7a32d32674535ff466380e3c2fa
Signed-off-by: haocheng.zy <haocheng.zy@linux.alibaba.com>
2022-10-29 14:57:23 +00:00
Christopher Ferris
fac411d97c Remove unnecessary logging.
Test: Extra logging no longers happens.
Change-Id: Ia179ebe5d16e0bde7d6ec66e39d4484ff18f2b1e
2022-10-27 17:56:27 -07:00
Nikita Ioffe
75be784fba Switch to tombstoned.microdroid
The long term plan is to completely remove tombstoned from microdroid (b/243494912), however it might take time some time to implement it.

In the meantime, we've recently removed cgroups support from the microdroid kernel. This means that starting a tombstoned results in a bunch of non-fatal errors in the logs that are related to the fact that tombstoned service specifies task_profiles.

To get rid of these error messages we temporary add a microdroid variant of the tombstoned (tombstoned.microdroid) that doesn't specify task_profiles.

Bug: 239367015
Test: microdroid presubmit
Change-Id: Ia7d37ede2276790008702e48fdfaf37f4c1fd251
2022-10-24 15:56:33 +00:00
Elliott Hughes
356e83b23f riscv64 has no "other" to need an sepolicy.
Fixes
```
out/soong/installs-aosp_riscv64.mk:56833: error: overriding commands for target `out/target/product/generic_riscv64/system/etc/seccomp_policy/crash_dump.riscv64.policy', previously defined at out/soong/installs-aosp_riscv64.mk:56829
```

Test: m
Change-Id: I78a1c6b10dac2da704515f33b492ff37cc086dd6
2022-10-17 21:42:32 +00:00
Evgenii Stepanov
4a93612db3 Merge "Harden CrasherTest::Trap under sanitizers." 2022-10-17 20:47:31 +00:00
Evgenii Stepanov
361455eb37 Harden CrasherTest::Trap under sanitizers.
The use of __builtin_abort in CrasherTest::Trap breaks with
-ftrap-function=abort, because then the argument of Trap is no longer in
the first argument register at the time of crash.

This flag is added when *any* sanitizer is enabled on the target, even harmless
ones like memtag-heap. See sanitize.go:769.

Fix CrasherTest::Trap to be a little more reliable.

Test: debuggerd_test with SANITIZE_TARGET=memtag_heap
Change-Id: I150f1c0355bd6f2bfabfa5a7bba125acdde1120e
2022-10-13 16:40:05 -07:00
Liu Cunyuan
8c0101b971 Add tomstone proto support for riscv64
Signed-off-by: Liu Cunyuan <liucunyuan.lcy@linux.alibaba.com>
Signed-off-by: Mao Han <han_mao@linux.alibaba.com>
Change-Id: Ie22c2895fc30fab68eddc18713c80e403f44b203
2022-10-12 22:31:45 +00:00
Chen Guoyin
a22af66e4b Add seccomp policy for riscv64 crash_dump
Signed-off-by: Chen Guoyin <chenguoyin.cgy@linux.alibaba.com>
Signed-off-by: Mao Han <han_mao@linux.alibaba.com>
Change-Id: Ie58bd7cf5dde792d8fba78602b5f53471752ab24
2022-10-12 22:31:39 +00:00
Xia Lifang
b13a10bb5d Add riscv64 support for debuggerd/crasher
Signed-off-by: Xia Lifang <lifang_xia@linux.alibaba.com>
Signed-off-by: Mao Han <han_mao@linux.alibaba.com>
Change-Id: I521c6da61cf2f6f67a73febf368068c430d94cdb
2022-10-12 22:30:27 +00:00
Florian Mayer
7a6079000c [MTE] add device config for permissive mode
Change-Id: Ifb16c0f29f07870f59ab50522d010689ee232de8
2022-10-03 09:58:39 -07:00
Florian Mayer
1ee1567b93 Merge "Do not use GetBoolProperty in signal handler" 2022-09-16 21:31:12 +00:00
Florian Mayer
094917deb7 Do not use GetBoolProperty in signal handler
This uses an std::string, which causes a heap allocation, which is not
async-safe.

Test: atest --no-bazel-mode permissive_mte_test
Change-Id: I4bd53d42d9a6a659abe62a964f14c81d9ec059d0
2022-09-16 12:01:40 -07:00
Elliott Hughes
b795d6fa4b Fix the build with a newer LLVM.
Unify all our "noinline" variants to the current most common one, not
least because the new [[noinline]] syntax is fussier about where it goes.

Test: treehugger
Change-Id: Icfcb75c9d687f0f05c19f66ee778fd8962519436
2022-09-14 20:16:25 +00:00
Florian Mayer
565305b852 Merge "[MTE] only upgrade to SYNC mode for MTE crashes" 2022-09-14 01:22:45 +00:00
Florian Mayer
d705c2dbcd [MTE] only upgrade to SYNC mode for MTE crashes
Bug: 244471804
Test: atest mte_ugprade_test on emulator
Change-Id: Ie974cf2dec96267012f1b01b9a40dad86551b1be
2022-09-13 15:35:07 -07:00
Elliott Hughes
df2e7eb3cc Explain how to get a tombstone proto.
There's a link here from the javadoc, but a link to the javadoc from
here seems like a good idea.

Test: N/A
Change-Id: I89a29f72d086d08174e72f7d0aa0421fe417f733
2022-09-12 22:24:18 +00:00
Alessandra Loro
7bd6dca855 Resolve ro.debuggable at build time
Test: n/a
Bug: 243645021

Change-Id: I42c4b1e81383d83c73a565c5e74ac22f17389faf
2022-09-01 13:32:36 +00:00
Jiyong Park
eb769d687a Use liblog_for_runtime_apex instead of liblog
liblog_for_runtime_apex is a static variant of liblog which is
explicitly marked as available to the runtime APEX. Any static
dependency to liblog from inside the runtime APEX is changed from liblog
to liblog_for_runtime_apex.

Previously, to support the need for using liblog inside the runtime
APEX, the entire (i.e. both static and shared variants) liblog module
was marked as available to the runtime APEX, although in reality only
the static variant of the library was needed there. This was not only
looking dirty, but also has caused a problem like b/241259844.

To fix this, liblog is separated into two parts. (1) liblog and (2)
liblog_for_runtime_apex. (1) no longer is available to the runtime APEX
and is intended to be depended on in most cases: either from the
non-updatable platform, or from other APEXes. (2) is a static library
which is explicitly marked as available to the runtime APEX and also
visible to certain modules that are included in the runtime APEX.

Bug: 241259844
Test: m and check that liblog depends on stub library of libc
Change-Id: I10edd4487a6f090ef026acffe1ffbd067387a0d3
2022-08-19 13:21:02 +09:00
Peter Collingbourne
73583331a0 Merge "Fix scudo MTE tests." 2022-07-01 17:09:55 +00:00
Peter Collingbourne
7827991d7f Fix scudo MTE tests.
r.android.com/2108505 was intended to fix a crash in Scudo in
the case where the stack depot, region info or ring buffer were
unreadable. However, it also ended up introducing a number of bugs into
the code. It failed to call __scudo_get_error_info if the page at the
fault address was unreadable. This can happen in legitimate crash cases
if a primary allocation was close to the boundary of a mapped region,
or if the allocation was a secondary allocation with guard pages. It
also used long as the type for tags, whereas Scudo expects it to be
char. In combination this ended up causing most of the MTE tests to
fail. Therefore, mostly revert that change.

Fix the original crash by null checking the pointers returned by
AllocAndReadFully before proceeding with the rest of the function.

Bug: 233720136
Change-Id: I04d70d2abffaa35fe315d15d9224f9b412a9825d
2022-06-30 18:54:19 -07:00
Bob Badour
453d3e4924 [LSC] Add LOCAL_LICENSE_KINDS to system/core
Added SPDX-license-identifier-Apache-2.0 to:
  debuggerd/test_permissive_mte/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all
Change-Id: Ic48cf8a972147eba8a955136be74204c013ca436
2022-06-16 10:01:01 -07:00
Florian Mayer
514c41c6e2 Merge "Add permissive MTE mode." 2022-06-15 16:58:25 +00:00
Christopher Ferris
d17cefe7e4 Merge "Fix scudo fault address processing." 2022-06-01 20:20:09 +00:00
Christopher Ferris
7c2e7e31f6 Fix fallback paths for dumping threads.
In the fallback path, if the non-main thread is the target
to be dumped, then no other threads are dumped when creating
a tombstone. Fix this and add unit tests to verify that
this all threads, including the main thread are dumped.

Bug: 234058038

Test: All unit tests pass.
Test: debuggerd -b media.swcodec process
Test: debuggerd media.swcodec process
Change-Id: Ibb75264f7b3847acdbab939a66902d986c0d0e5c
2022-05-27 13:05:56 -07:00