Commit graph

1000 commits

Author SHA1 Message Date
Peter Collingbourne
7285c0d1bb tombstoned: Rename proto tombstone before text tombstone.
Because the log message "Tombstone written to: $NAME" is written
before renaming the proto tombstone, it is possible that a tool that
automatically downloads new proto tombstones by watching for this
log message will fail to download the tombstone. For the tool that
I am developing, this occurs < 0.1% of the time. Fix the issue by
renaming the proto tombstone first.

Bug: 328531087
Change-Id: I5b751585f2fce897ca7eb76c0466a0c33a93d851
2024-03-21 18:28:08 -07:00
Mitch Phillips
da9ec0cd05 Merge "[MTE] Implement permissive (recoverable) MTE for apps" into main 2024-03-19 19:06:13 +00:00
Florian Mayer
effe539c30 Merge "Do not chmod ANRs" into main 2024-03-19 18:25:42 +00:00
Elliott Hughes
0fee60a79a Merge "Use _Fork()." into main 2024-03-19 14:48:20 +00:00
Mitch Phillips
31407917f8 [MTE] Implement permissive (recoverable) MTE for apps
Extends the recoverable native crash handling support to also allow for
MTE crashes to be recovered from in apps. Backs onto the existing
GWP-ASan recoverable handling.

At least for system/core, I've renamed the (now) generic "recoverable
crash" variables to remove the notion of GWP-ASan.

Permissive MTE should no longer crash an app, and crashes are still
visible in the AppExitInfo API and tombstones.

Test: atest CtsTaggingHostTestCases
Bug: 328793166
Change-Id: I4c6ffa85af0e0d9b72d0ccd606bb6e1ca464cfff
2024-03-19 11:26:02 +01:00
Florian Mayer
e95d781041 Do not chmod ANRs
The code was only meant for native tombstones. It might be a good idea
to make ANRs also readable by shell / adb, but in that case we have to
do more changes to make sure all files in /data/anr are. We can revert
if we implement that

Test: m
Bug: 329827513
Change-Id: Ic98c452ca500fe766a70173bef4ac1ea57438989
2024-03-18 17:19:51 -07:00
Florian Mayer
c923ea5a6d Merge "Update test for more accurate memtag_handle_longjmp" into main 2024-03-12 18:12:46 +00:00
Florian Mayer
1fef1b1359 Update test for more accurate memtag_handle_longjmp
Change-Id: Ie5482d343c37ee8cf57a8ce105a0c8a363e5761e
2024-03-07 17:12:57 -08:00
Treehugger Robot
98c2d78b4f Merge "Revert^2 "Add TEST_MAPPING for debuggerd CTS"" into main 2024-03-05 18:55:59 +00:00
Florian Mayer
e6462f91c2 Add test for invalid setjmp in MTE
BYPASS_INCLUSIVE_LANGUAGE_REASON=man is for manpage

Test: atest debuggerd_test
Change-Id: I774095b79baadb4f692f4b97b47df80e635e3a1c
2024-03-04 12:17:19 -08:00
Florian Mayer
b7e9941744 Revert^2 "Add TEST_MAPPING for debuggerd CTS"
This reverts commit aa48834485.

Reason for revert: fixed in https://r.android.com/2985051

Change-Id: I76a53df9fb585d90778019e74472ad294963a91c
2024-03-01 01:52:23 +00:00
Elliott Hughes
06053405e9 Use _Fork().
POSIX issue 8 has a standard way to avoid pthread_atfork() handlers.

Change-Id: I801c55dc3fb9e14cc03f854992d60872c5468ab5
2024-02-29 23:02:38 +00:00
Ryan Prichard
bc227038c0 debuggerd_test: fix invalid regexs
\(fault address prefixed with --->)

should be

    \(fault address prefixed with --->\)

Test: debuggerd_test
Bug: 175635923
Bug: 327668317
Change-Id: I03bf8969e9818956ae79b916ab852efaf4f2f78a
2024-02-29 14:40:57 -08:00
Oluwarotimi Adesina
aa48834485 Revert "Add TEST_MAPPING for debuggerd CTS"
This reverts commit d059478ee1.

Reason for revert: Potential culprit for b/327525776- verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.

Change-Id: I4b713aa46b2869a677a210cfce6ae880366b045e
2024-02-29 15:10:09 +00:00
Florian Mayer
d685442133 Merge "Add TEST_MAPPING for debuggerd CTS" into main 2024-02-29 02:29:09 +00:00
Florian Mayer
d059478ee1 Add TEST_MAPPING for debuggerd CTS
Change-Id: I3bba97e7a0a2b053c6d5577496efa2dca29035d4
2024-02-28 11:12:58 -08:00
Elliott Hughes
77a80d1744 Merge "Remove support for Linux before 3.11 (without O_TMPFILE)." into main 2024-02-27 16:14:52 +00:00
Elliott Hughes
aa1d18a59b Remove support for Linux before 3.11 (without O_TMPFILE).
We don't support kernels that old any more.

Test: treehugger
Change-Id: Ia664de6921901dec54644cff9f51e8514258e257
2024-02-27 16:14:12 +00:00
Christopher Ferris
2bf7db3de0 Format all of the blueprint files.
I'm tired of seeing the bpfmt warning, so fix this for all debuggerd
blueprint files.

Test: Compiles
Change-Id: I3b25365a7272aebe9cbac28455cf8b9b86b04c6e
2024-02-26 13:34:38 -08:00
Florian Mayer
d3fb7a6355 Merge "Make tombstones 664." into main 2024-02-26 21:12:25 +00:00
Florian Mayer
877d1f6694 Make tombstones 664.
They are still restricted by SELinux, and apps still cannot open them
because they don't have `open` SELinux permission.

Bug: 312740614
Change-Id: I83b7e6ed39f5af64f161af3b3e8e33af0d125b20
2024-02-23 15:31:30 -08:00
Florian Mayer
23e9289e69 minor doc improvement for tombstone fd code
Change-Id: I8037d9dd5a6c0e86e853d001ccedc472ce61d107
2024-02-23 22:16:03 +00:00
Christopher Ferris
3e662d3c7f Fix up the debuggerd policy files.
A few files were changed without using the generate script. Modify
the original policy file and generate all of the policy files
properly.

Test: Verify the generated files are the same as before.
Change-Id: Ic6979c06c5d290b3047c8307e86ec1e78a242d44
2024-02-22 16:23:46 -08:00
Treehugger Robot
acafa40d82 Merge changes from topics "crashapi2", "crashapi3" into main
* changes:
  use new location of crash_detail API
  Add tests for android_replace_crash_detail_[name|data]
2024-02-21 07:42:42 +00:00
Mitch Phillips
acd092ad4e Merge "Update debuggerd for stack MTE." into main 2024-02-16 09:01:34 +00:00
Florian Mayer
920d95b1c8 use new location of crash_detail API
Bug: 155462331
Change-Id: I862f91368d421363adbbf002fe3c7d446c437b03
2024-02-14 12:58:18 -08:00
Florian Mayer
aced3aa5c6 Add tests for android_replace_crash_detail_[name|data]
Bug: 155462331
Change-Id: I1ca4ae6d700dfbaf0bc4e511da0788edd969fca3
2024-02-14 12:01:49 -08:00
Florian Mayer
75800c9c3a Merge "Read data set by android_add_crash_detail into tombstone." into main 2024-02-14 17:06:07 +00:00
Florian Mayer
5fa6663458 Read data set by android_add_crash_detail into tombstone.
Bug: 155462331
Bug: 309446525
Change-Id: I6d01aafca48e0e5e8cbd5ae87add6aec0c429503
2024-02-13 18:13:22 -08:00
Mitch Phillips
bf2d6dd7d4 Update debuggerd for stack MTE.
Two things need changing for debuggerd_test to pass.

 1. The seccomp policy needs to allow for PROT_MTE (0x20) in both
    mprotect() and mmap(). Stack MTE processes do a mprotect()/mmap() of
    the stack when launching a process.
 2. The fault address and stack pointer need to be untagged when trying
    to figure out the stack overflow cause.

Bug: 320448268
Bug: 292478827
Test: atest debuggerd_test --iterations=10
Change-Id: I56471c32ca40edffbb61b7547bdf2b85a6eb1ff7
2024-02-06 15:18:04 +01:00
Devin Moore
b56e4743f6 Change debuggerd client param from pid to tid
Change the header param to be `tid` and remove a local `pid` variable
to use `tid` instead.

Test: m
Bug: 316970771
Change-Id: I53c13081d72f46446ac6e85df77a160ef4f50c05
2024-01-31 23:44:01 +00:00
Andy Hung
42f8cd3bf9 debuggerd: dump frozen Java processes
Test: stacks <pid>
Test: adb shell debuggerd -b <pid>
Bug: 319754740
Change-Id: Iae230ff34409bee4a325113aed65433292975427
2024-01-12 14:06:43 -08:00
Spandan Das
e010614a4a Merge "Make apex availability of libpropertyinfoparser and libpropertyinfoparser explicit" into main 2024-01-04 17:46:17 +00:00
Treehugger Robot
8880209aae Merge "Make apex availability of libdebuggerd explicit" into main 2024-01-04 02:49:43 +00:00
Spandan Das
2e5cfbc1a4 Make apex availability of libpropertyinfoparser and libpropertyinfoparser explicit
The availability to runtime apex was done implicitly using a baseline map in
build/soong/apex/apex.go. Make this explicit in Android.bp

Bug: 281077552
Test: m nothing
Change-Id: Iba1f30ef57c0707189ec79813ef501029135eeba
2024-01-04 01:34:40 +00:00
Christopher Ferris
20f50ec9ab Avoid sleep in test.
For the tombstoned.proto test, remove arbitrary sleep and add loop
checking for the file being present.

Bug: 317286869

Test: Ran the tests on device and all pass.
Test: Modify the test and force the timeout to verify the timeout logic.
Change-Id: I9b246c8fee83909459d5c42debdb546794070845
2024-01-03 04:32:35 +00:00
Spandan Das
e6bc0264a9 Make apex availability of libdebuggerd explicit
The availability to runtime apex was done implicitly using a baseline map in
build/soong/apex/apex.go. Make this explicit in Android.bp

Bug: 281077552
Test: m nothing
Change-Id: I365270bc90380211c40294dff145ebc01eb8c14f
2024-01-02 22:40:46 +00:00
Steven Moreland
2be4bedea1 raise debuggerd_test timeout
Possible solution for b/317286869.

Test: N/A
Change-Id: I93743d596d5b8d7c867253d1aafc709453995fed
2024-01-02 21:37:38 +00:00
Florian Mayer
cdf55585a7 Use correct stack depot size in __scudo_get_error
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.

Bug: 309446692
Change-Id: Ib64b9d042b2a2088484ec5e61944c089a1d85314
2023-12-13 22:21:19 +00:00
Treehugger Robot
1f5b0f9fee Merge "Handle scudo_stack_depot_size = 0" into main 2023-12-12 01:24:03 +00:00
Florian Mayer
f9566853bd Merge "Use scudo_stack_depot_size from process_info" into main 2023-12-11 23:38:13 +00:00
Siim Sammul
73ade16187 Merge "Move tombstone_proto_to_text out of libdebuggerd." into main 2023-12-06 10:13:18 +00:00
Treehugger Robot
1772cd427c Merge "Match upstream API change" into main 2023-12-06 01:28:10 +00:00
Florian Mayer
6757ecd2a3 Match upstream API change
Change was done in
e68c265543

Change-Id: Id1a288dfdb5edb7cb7d639ec4548926cc4085d8c
2023-12-06 00:16:43 +00:00
Siim Sammul
c08a34e3dc Move tombstone_proto_to_text out of libdebuggerd.
This is done so that we could depend on it elsewhere without needing all the unrelated methods.
Needed for ag/24553347

Bug: 296207744
Test: refactoring build
Change-Id: I7c6733208f3ae63ba9559753a24cffcb8e1b9d1e
2023-12-05 10:14:27 +00:00
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