Commit graph

10929 commits

Author SHA1 Message Date
zijunzhao
195b90b83f Nullability check for math module
Bugs: b/245972273
Test: adb shell
Change-Id: I46bf02e1ed3d6e6143c780e30f95fa3af2745216
2023-02-09 00:25:29 +00:00
Treehugger Robot
bc516bf20a Merge "Nullability check for eventfd module" 2023-02-07 22:50:56 +00:00
zijunzhao
9729c193cb Nullability check for eventfd module
Bugs: b/245972273
Test: None
Change-Id: I5a74318850f3e49dd9d78180476e2a9d76853606
2023-02-07 20:47:11 +00:00
Treehugger Robot
f82ee4a37a Merge "Nullability check for klog module" 2023-02-07 16:35:27 +00:00
zijunzhao
1cda74daba Nullability check for stat module
Bugs: b/245972273
Test: None
Change-Id: I8611c7d7c22e2fb6b0cec4b5101dbcb3174ae706
2023-02-07 06:58:39 +00:00
Elliott Hughes
475275b3ec Merge "Fix setfsgid()/setfsuid() for LP32." 2023-02-06 21:22:36 +00:00
Treehugger Robot
a3357c28f5 Merge "Nullability check for quota module" 2023-02-04 04:12:16 +00:00
Elliott Hughes
8dc9f46a3f Fix setfsgid()/setfsuid() for LP32.
These are system calls where the "good" names are camped by
implementations that only work for 16-bit ids, and you need to say "32"
on LP32 to get sensible behavior.

Noticed when disabling CONFIG_UID16 in the kernel.

Bug: http://b/266732373
Test: llvm-objdump -d
Change-Id: Ib1b5822b030c4f86df755b129ec7b435a7f77cd3
2023-02-03 23:10:04 +00:00
zijunzhao
e716b1b3ee Nullability check for klog module
Bugs: b/245972273
Test: adb shell
Change-Id: I43634184ff8785fa8096d7e8034b22da452cfdd4
2023-02-03 21:56:56 +00:00
zijunzhao
4b8a126255 Nullability check for sysinfo module
Bugs: b/245972273
Test: None
Change-Id: Ie351c609136d1873d3969788246d8a4d8b77ac55
2023-02-03 20:05:05 +00:00
zijunzhao
7833a70000 Nullability check for quota module
Bugs: b/245972273
Test: adb shell
Change-Id: Ic300055163c852d1955d0dc419794b25395ce9a3
2023-02-03 20:03:34 +00:00
Mitch Phillips
3d577a836d Merge "Add the recoverable GWP-ASan feature." 2023-02-03 18:35:08 +00:00
Mitch Phillips
64c7d18f29 Merge "[GWP-ASan] Add TURN_ON_FOR_APP_SAMPLED_NON_CRASHING to android_mallopt" 2023-02-03 18:35:08 +00:00
Mitch Phillips
2480f491be [GWP-ASan] Add TURN_ON_FOR_APP_SAMPLED_NON_CRASHING to android_mallopt
This mode allows an android_mallopt(M_INITIALIZE_GWP_ASAN, ...) to turn
on the recoverable, sampled mode. This is the intended mode for
non-system apps that don't specify the gwpAsanMode in Android U.

Bug: 247012630
Test: Patch the zygote to use this option, launch an app with
gwpAsanMode unspecified, trigger a use-after-free, assert the app uses
the recoverable mode.

Change-Id: I701e10f44b2e2694789cc5ec6f0af4bc0c55b9e4
2023-02-02 15:58:35 -08:00
Mitch Phillips
a493fe4153 Add the recoverable GWP-ASan feature.
GWP-ASan's recoverable mode was landed upstream in
https://reviews.llvm.org/D140173.

This mode allows for a use-after-free or a buffer-overflow bug to be
detected by GWP-ASan, a crash report dumped, but then GWP-ASan (through
the preCrashReport() and postCrashReportRecoverableOnly() hooks) will
patch up the memory so that the process can continue, in spite of the
memory safety bug.

This is desirable, as it allows us to consider migrating non-system apps
from opt-in GWP-ASan to opt-out GWP-ASan. The major concern was "if we
make it opt-out, then bad apps will start crashing". If we don't crash,
problem solved :). Obviously, we'll need to do this with an amount of
process sampling to mitigate against the 70KiB memory overhead.

The biggest problem is that the debuggerd signal handler isn't the first
signal handler for apps, it's the sigchain handler inside of libart.
Clearly, the sigchain handler needs to ask us whether the crash is
GWP-ASan's fault, and if so, please patch up the allocator. Because of
linker namespace restrictions, libart can't directly ask the linker
(which is where debuggerd lies), so we provide a proxy function in libc.

Test: Build the platform, run sanitizer-status and various test apps
with recoverable gwp-asan. Assert that it doesn't crash, and we get a
debuggerd report.
Bug: 247012630

Change-Id: I86d5e27a9ca5531c8942e62647fd377c3cd36dfd
2023-02-02 15:35:25 -08:00
zijunzhao
3d59110f72 Nullability check for unistd module
Bugs: b/245972273
Test: None
Change-Id: I6037b1cd0bf233476a1cc0fbc8308a87de50c550
2023-02-01 20:40:35 +00:00
Treehugger Robot
b8a7a2ffbc Merge "Add BIONIC_COMPLICATED_NULLNESS as _Null_unspecified" 2023-02-01 01:41:10 +00:00
zijunzhao
93eb87007a Add BIONIC_COMPLICATED_NULLNESS as _Null_unspecified
In some cases, the nullability of the pointer argument is too
complicated. Developers have better check relevant manuals or
code before annotating.

Bugs: b/245972273
Test: None
Change-Id: I3589a5080b267d1766cc8ed99868129ac16e4012
2023-01-31 22:51:30 +00:00
Christopher Ferris
c36823f7e8 Merge "Purge memory." 2023-01-31 22:19:00 +00:00
Christopher Ferris
aa3e57469c Purge memory.
Some operations wind up allocating then freeing a significant
amount of memory. So after those operations, do a purge so that
the RSS of the process is not artificially inflated.

Bug: 262321164

Test: Ran unit tests.
Test: Verified after this change, the RSS does not go up after running
Test: am dumpheap -n <PID>.
Change-Id: I08477f8ce12c06fd2a068f536a81f4a577d619e2
2023-01-31 01:37:11 +00:00
zijunzhao
4aa1ea04d7 Nullability check for fcntl module
Bugs: b/245972273
Test: None
Change-Id: I48d23c7bc80863cd3a67ab424780308fe6929292
2023-01-30 19:48:44 +00:00
Elliott Hughes
b0360a94c3 Merge "Add (no-op) ifuncs for SVE optimized routines." 2023-01-27 00:06:57 +00:00
zijunzhao
64b1fe21b7 Nullability check for nl_types module
Bugs: b/245972273
Test: None
Change-Id: Idc05efd6613c99292bd3c095679ac20bb6e8bf8f
2023-01-26 06:48:13 +00:00
Elliott Hughes
3d8e98f8bd Add (no-op) ifuncs for SVE optimized routines.
This patch doesn't *enable* the SVE optimized routines, but it does let
us see if switching them to ifuncs will cause any app compat issues, so
that we can more easily use the optimized routines in future.

Test: treehugger
Change-Id: Ic5fe570bd21687da397b48127bf688f7ec68dd0c
2023-01-25 23:33:39 +00:00
Treehugger Robot
b1f9b1b224 Merge "Nullability check for utmp module" 2023-01-25 21:34:27 +00:00
zijunzhao
d9755064a6 Nullability check for utmp module
Bugs: b/245972273
Test: None
Change-Id: Ie37781b87ad13119d1ebc4cd053e184d482d5b58
2023-01-25 19:22:27 +00:00
Elliott Hughes
5ec0bfae50 Track upstream arm-optimized-routines changes.
The MTE-compatible routines are now faster than the incompatible ones,
so they merged them upstream.

I've left the ifunc boilerplate on the assumption that I'll be back
later to enable the new SVE variants.

Test: treehugger
Change-Id: Ic894bfb350b9aa70e307bca1c4978624b3e5f4fd
2023-01-25 18:12:18 +00:00
Elliott Hughes
98c641b096 Merge "Sync strptime.c with upstream." 2023-01-23 22:04:29 +00:00
Treehugger Robot
6ffb6e89f9 Merge "librust_baremetal: Add strtol" 2023-01-23 10:59:25 +00:00
Elliott Hughes
357908ddf6 Defer to getpagesize() in sysconf().
It makes sense that callers to getauxval() should have to pay for a
search --- that's exactly what they're asking for. But it seems silly
and unfair for the same to be true of sysconf() --- that's just an
implementation detail. Call getpagesize() directly instead.

Test: treehugger
Change-Id: I327adc55ace73bc6da68c4b34bf829d377bcbd1a
2023-01-19 21:30:26 +00:00
Christopher Ferris
cc66ba30e5 Merge "Add aliases for backtrace related options." 2023-01-18 18:57:11 +00:00
zijunzhao
4730fb6cc8 Nullability check for termios module
Bugs: b/245972273
Test: None
Change-Id: Ic91fa6ebc87bff513740c1b757a726505e4dae0e
2023-01-14 01:01:51 +00:00
zijunzhao
e951acd2ca Nullability check for execinfo module
Bugs: b/245972273
Test: None
Change-Id: I136926d5b82f62e11df716a26d0847a6bd83a419
2023-01-13 02:14:10 +00:00
Treehugger Robot
716ed9b931 Merge "librust_baremetal: Add memcpy_chk" 2023-01-12 16:26:17 +00:00
Junjie Hu
8655d1741f Add aliases for backtrace related options.
Using the long option names might not fit in the malloc debug option
property since properties have a 92 character limit.

This patch creates new aliases for the original options.

Bug: 264504531
Test: set new options pass
Test: Config unit tests pass.
Change-Id: Id985720f36a2bf0da7b35ff444c2c80eb1fb4363
2023-01-11 15:16:00 -08:00
Chih-hung Hsieh
42f97f5288 Merge "Disable clang-tidy for some malloc tests." 2023-01-11 04:38:25 +00:00
Treehugger Robot
5742addf96 Merge "Nullability check for inttypes module" 2023-01-11 02:38:35 +00:00
Chih-Hung Hsieh
7ab1c81f6b Disable clang-tidy for some malloc tests.
The clang-analyzer-unix.Malloc and other warnings in these
unit tests are either false positive or in
negative tests that can be ignored.

Bug: 259995529
Test: presubmits; make tidy-bionic-libc_subset
Change-Id: Iddabe613d21d3717ba34f9e4d5bb97436279649f
2023-01-10 16:57:44 -08:00
zijunzhao
6daedb7c41 Nullability check for inttypes module
Bugs: b/245972273
Test: None
Change-Id: Ibc6edd389a9f7cb4d2d5f625ba67163eeda98979
2023-01-11 00:32:16 +00:00
Florian Mayer
eae797db66 Merge "Plumb scudo_ring_buffer_size to debuggerd_process_info" 2023-01-10 21:23:33 +00:00
Greg Kaiser
2335213e04 Match argument order in cpp file
We swap the 2nd and 3rd arguments to the CallocEntry constructor
to match the order in the cpp file, and match the C calloc convention.

We also fix an invocation of this constructor.

Change-Id: Iebe16d82a74459e5e957c1d9e2cc1aebb15150d0
Test: TreeHugger
2023-01-09 21:14:18 +00:00
Chia-hung Duan
08af69ab7f Merge "Add the timestamps for each alloc data" 2023-01-08 01:23:56 +00:00
Treehugger Robot
57c8646f59 Merge "Nullability check for malloc module." 2023-01-07 01:28:42 +00:00
zijunzhao
979d39cb82 Nullability check for syslog module.
Bugs: b/245972273
Test: None
Change-Id: I630597ac2101e16f5566208019a9a54e78fe5667
2023-01-06 20:22:58 +00:00
Florian Mayer
347dc623ec Plumb scudo_ring_buffer_size to debuggerd_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: I18f166fc136ac8314d748eb80a806defcc25c9fd
2023-01-05 14:07:22 -08:00
Chia-hung Duan
f7e8b17dc5 Add the timestamps for each alloc data
With timestamps, we are able to tell the details of allocator
performance such as the average time for malloc() in different size
class, the potential contention time by examing the overlap between
operations, .etc.

Not all malloc et al. operations are recorded with timestamp. Only
operations relates to memory usage change will have them.

Test: All unit tests pass.

Change-Id: I5c2016246a6f10b221387001bb44778969bb26ae
2023-01-05 22:05:42 +00:00
Treehugger Robot
47fc44c73c Merge "Nullability check for time module." 2023-01-05 21:01:55 +00:00
Treehugger Robot
c22ef226a3 Merge "Merge librust_baremetal_defaults into its library" 2023-01-05 20:01:06 +00:00
zijunzhao
e620266d1c Nullability check for time module.
Bugs: b/245972273
Test: None
Change-Id: I65adc146f88bbd948f61d2f22bdec344faba09ae
2023-01-05 00:18:18 +00:00
Chih-hung Hsieh
2b76f88282 Merge "Disable clang-tidy for upstream files." 2023-01-04 01:22:03 +00:00