Commit graph

34598 commits

Author SHA1 Message Date
Elliott Hughes
39899f592b Fix return type of process_madvise().
Noticed this from
https://man7.org/linux/man-pages/man2/process_madvise.2.html but
independently confirmed by checking the kernel source.

Also fix the documentation.

Test: treehugger
Change-Id: I6beeeeb2178a58a22a36532e634917b3ae8767ee
2021-04-06 16:38:37 -07:00
Peter Collingbourne
d8b7066e65 Merge "Reset PAC keys on thread creation instead of on zygote fork." am: 2b9719e361
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1652994

Change-Id: I21f9909d64753b2316c39c9ecb8518b1c118fab7
2021-04-06 23:28:06 +00:00
Peter Collingbourne
2b9719e361 Merge "Reset PAC keys on thread creation instead of on zygote fork." 2021-04-06 23:02:29 +00:00
Luke Huang
75830fb836 Initialize _nres only once
Currently, the initialization of _nres is not thread-saferes_mkquery is not thread-safe,
which might cause memory double free problem if caller ran under multithread.

To fix it, only initialize _nres once.
Also remove the redundant code.

Test: atest DnsResolverTest
Bug: 166235340
Change-Id: I9caa6eab37cb530fc60dae9bcca9650973a4536a
2021-04-07 02:05:50 +08:00
Elliott Hughes
56f93fa5c1 Merge "setjmp/longjmp: avoid invalid values in the stack pointer." am: e71143e8c0 am: 0a8e61bcb0
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1663232

Change-Id: I288904abfd061a53411286a212b2ebc1dcdec24a
2021-04-06 17:10:10 +00:00
Elliott Hughes
0a8e61bcb0 Merge "setjmp/longjmp: avoid invalid values in the stack pointer." am: e71143e8c0
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1663232

Change-Id: I199739a9b012a66c7a89add8ef8f68738ebb3676
2021-04-06 16:27:50 +00:00
Elliott Hughes
e71143e8c0 Merge "setjmp/longjmp: avoid invalid values in the stack pointer." 2021-04-06 15:43:23 +00:00
Elliott Hughes
c0d41db92e setjmp/longjmp: avoid invalid values in the stack pointer.
arm64 was already being careful, but x86/x86-64 and 32-bit ARM could be
caught by a signal in a state where the stack pointer was mangled.

For 32-bit ARM I've taken care with the link register too, to avoid
potential issues with unwinding.

Bug: http://b/152210274
Test: treehugger
Change-Id: I1ce285b017a633c732dbe04743368f4cae27af85
2021-04-05 17:43:36 -07:00
Tom Cherry
10a7bd7599 Merge "Match 'Access denied finding property' log severity to SELinux" am: 87a205eefa am: 17d017b676
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1662899

Change-Id: I8cb90f3e0420da91952ba6ab156b9fec6793ce7f
2021-04-02 18:57:30 +00:00
Tom Cherry
17d017b676 Merge "Match 'Access denied finding property' log severity to SELinux" am: 87a205eefa
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1662899

Change-Id: Icc3be003904678482aa487b818071c5c413c0d99
2021-04-02 18:20:54 +00:00
Tom Cherry
87a205eefa Merge "Match 'Access denied finding property' log severity to SELinux" 2021-04-02 16:21:40 +00:00
Tom Cherry
8f11c5f789 Match 'Access denied finding property' log severity to SELinux
This log message exists to provide more context (the property name) to
SELinux denials for the same access check.  The SELinux log severity
is 'W' since SELinux denials do not necessarily point to user-visible
errors, therefore this message should be 'W' as well.

Bug: 181269159
Test: build
Change-Id: Ie25091d96214a175b7ca39d5615f9a09b789d1e3
2021-04-01 16:42:03 -07:00
George Burgess IV
cdd36b3674 Merge "fortify: mark all always_inline functions with no_stack_protector" am: 0ffd09ad0c am: 3a7ea1fb0e
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1651694

Change-Id: I3293b270134921d9cdbc3407bd9a7bc7f0b98566
2021-03-30 20:49:57 +00:00
George Burgess IV
3a7ea1fb0e Merge "fortify: mark all always_inline functions with no_stack_protector" am: 0ffd09ad0c
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1651694

Change-Id: I34200097c71071e97d618881ab79daf05de9dcdc
2021-03-30 20:08:10 +00:00
George Burgess IV
0ffd09ad0c Merge "fortify: mark all always_inline functions with no_stack_protector" 2021-03-30 19:25:20 +00:00
George Burgess IV
a1112fd880 fortify: mark all always_inline functions with no_stack_protector
FORTIFY'ed functions try to be as close to possible as 'invisible';
having stack protectors detracts from that.

Don't apply this to functions which clang has no chance of inlining
anyway (like variadic functions)

Bug: 182948263
Test: TreeHugger
Change-Id: I08cfec25464b8ea1e070942e3dc76fc84da73dd0
2021-03-29 15:39:50 -07:00
Peter Collingbourne
811d180e89 Reset PAC keys on thread creation instead of on zygote fork.
Resetting PAC keys on fork appears to lead to a number of problems. One
problem is that we are constrained in where we can run C++ code after
forking, and with ART those places are implementation-defined. For
example, in app zygotes, ART turns out to insert "interpreter frames"
in the stack trace. Returning into these interpreter frames may lead
to crashes due to failing the ROP protection check on return.

It seems better to reset keys on thread creation instead. We only need
to reset IA because only this key needs to be reset for reverse-edge
PAC, and resetting the other keys may be incompatible with future ABIs.

Chrome (and potentially other applications) has a sandbox that prevents
the use of the prctl, so we restrict its use to applications targeting
S and above.

Bug: 183024045
Change-Id: I1e6502a7d7df319d424e2b0f653aad9a343ae71b
2021-03-25 14:07:33 -07:00
Jingwen Chen
f7534889a4 Merge "bp2build: remove some bp2build_available props, use package_allowlist instead." am: c551fc7e7a am: ee0e30196b
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1625839

Change-Id: I831173bcc9e9ccf188139a4aae6df80ff2a3289f
2021-03-24 23:10:14 +00:00
Jingwen Chen
ee0e30196b Merge "bp2build: remove some bp2build_available props, use package_allowlist instead." am: c551fc7e7a
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1625839

Change-Id: I818652ae41ae7493c549b814cb13fbfb4c46b3b6
2021-03-24 22:33:25 +00:00
Jingwen Chen
c551fc7e7a Merge "bp2build: remove some bp2build_available props, use package_allowlist instead." 2021-03-24 21:38:07 +00:00
Jingwen Chen
c57947860d bp2build: remove some bp2build_available props, use package_allowlist instead.
Test: build/bazel/scripts/milestone-2/demo.sh full

Test: bazel query //bionic/...
Change-Id: I737574766be898279d8bf6f3f0adb43dcc40c220
2021-03-19 02:06:27 -04:00
Christopher Ferris
3ddeba91bc Merge "Update kernel update documentation." am: b40eb10acc am: d4837aec31
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1644526

Change-Id: I7e9ac0a1fceb24eea0a299f50892f9c15ad64731
2021-03-18 22:43:15 +00:00
Christopher Ferris
d4837aec31 Merge "Update kernel update documentation." am: b40eb10acc
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1644526

Change-Id: If8ff69d114e58479ba846a4cce1725143694a6aa
2021-03-18 22:09:51 +00:00
Christopher Ferris
b40eb10acc Merge "Update kernel update documentation." 2021-03-18 20:01:54 +00:00
Treehugger Robot
1133cae55b Merge "Remove __stack_chk_fail_local() completely." am: e5f7b3e2ca am: 699c9faada
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1641282

Change-Id: Ib7712129c907c20564815af8739e18b7608aecd1
2021-03-18 13:11:48 +00:00
Treehugger Robot
699c9faada Merge "Remove __stack_chk_fail_local() completely." am: e5f7b3e2ca
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1641282

Change-Id: I0b4cc84e87fc746c81b783b95ee54a5c9ae24414
2021-03-18 12:35:39 +00:00
Treehugger Robot
e5f7b3e2ca Merge "Remove __stack_chk_fail_local() completely." 2021-03-18 12:10:49 +00:00
Christopher Ferris
7e2f6ffeaf Update kernel update documentation.
Parts of the document have gone out of date, so update it.

Test: NA
Change-Id: Ia4bc534ca1cc9a538d5995126c541c2cd7029c57
2021-03-18 00:38:34 -07:00
Treehugger Robot
b244ac1d47 Merge "scandir: remove dead code." am: b6ed09d323 am: b966c33e09
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1641339

Change-Id: I6cf425e24379f0feb9a3beacee14cb0f3926f47b
2021-03-17 17:57:56 +00:00
Treehugger Robot
b966c33e09 Merge "scandir: remove dead code." am: b6ed09d323
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1641339

Change-Id: Iae147f53bc4915bc5b6c2c145daaf5c8a26956d8
2021-03-17 17:14:26 +00:00
Treehugger Robot
b6ed09d323 Merge "scandir: remove dead code." 2021-03-17 16:33:19 +00:00
Elliott Hughes
5501003be7 Remove __stack_chk_fail_local() completely.
As far as I can tell, clang never implemented this GCC workaround for
32-bit x86's terrible PIC code. Since the whole point of
__stack_chk_fail_local() requires that it's in the same executable or
library as its callers, any prebuilt with a dependency on this (because
it was built by GCC) already has its own copy anyway. And clang isn't
creating any new ones, so I think this has been dead for several years
now.

Test: treehugger
Change-Id: I96997bbf912bbff506db44c285d9941fef9f86ce
2021-03-17 09:02:34 -07:00
Treehugger Robot
c920f14a7c Merge "Clean up __stack_chk_fail_local slightly." am: 433293dbc9 am: e75355e03a
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1641340

Change-Id: I5ac25c9c56163b3d98b873d4ac683390589f00e5
2021-03-17 14:33:53 +00:00
Treehugger Robot
e75355e03a Merge "Clean up __stack_chk_fail_local slightly." am: 433293dbc9
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1641340

Change-Id: Ibb6b1d626d4f3670b4e4588c7d120260f7eb3bfb
2021-03-17 13:55:12 +00:00
Treehugger Robot
433293dbc9 Merge "Clean up __stack_chk_fail_local slightly." 2021-03-17 13:25:55 +00:00
Elliott Hughes
92da28625f Clean up __stack_chk_fail_local slightly.
Motivated by the fact that bazel doesn't like #include "../", but this
feels like it could use a deeper clean.

In fact, even after this change, I think we should remove this entirely,
since as far as I can tell Clang never implemented this GCC workaround
for 32-bit x86's awful PIC code.

Test: treehugger
Change-Id: I72715ee46f873f42d5707712aebe246ef78fcde1
2021-03-16 16:41:53 -07:00
Elliott Hughes
13a761032f scandir: remove dead code.
This is the second or third time I've scratched my head wondering why
this destructor has no coverage. I was tempted to leave it in with a
comment saying it should never be called, but that seemed sillier than
just replacing it with an assertion.

Test: treehugger
Change-Id: I3442d9f8a391fae668e77c6888a4457ededee494
2021-03-16 16:20:38 -07:00
Liz Kammer
b2b39f1e29 Merge "Remove bazel_module.label from bionic genrules" am: eb33b5b7a8 am: 2a2bebb557
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1611244

Change-Id: Ifd6be887a82a401ce1e771db589e17e2bf3376c8
2021-03-16 22:35:08 +00:00
Liz Kammer
2a2bebb557 Merge "Remove bazel_module.label from bionic genrules" am: eb33b5b7a8
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1611244

Change-Id: I246d7af7be08f51de7096e242013c5d101cd2158
2021-03-16 21:54:50 +00:00
Liz Kammer
eb33b5b7a8 Merge "Remove bazel_module.label from bionic genrules" 2021-03-16 21:40:04 +00:00
Treehugger Robot
3b4f4aff69 Merge "Depend on libasync_safe module instead of breaking package boundary." am: 35428fe99d am: 3f67de35b7
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1639799

Change-Id: Iea3acca89f1763b696e72e5404d1ac9973341011
2021-03-16 18:21:09 +00:00
Treehugger Robot
3f67de35b7 Merge "Depend on libasync_safe module instead of breaking package boundary." am: 35428fe99d
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1639799

Change-Id: Iaea0beeaef397fd064bc71233dec68be27470f13
2021-03-16 17:41:30 +00:00
Treehugger Robot
35428fe99d Merge "Depend on libasync_safe module instead of breaking package boundary." 2021-03-16 17:01:07 +00:00
Liz Kammer
76ae8abac5 Merge "Add missing includes for crtend modules" am: 6a4177c42d am: f8e3668ce2
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1637585

Change-Id: Ib58e435b7c02c2a6b18d515665d4f5c71765b534
2021-03-16 13:50:59 +00:00
Liz Kammer
f8e3668ce2 Merge "Add missing includes for crtend modules" am: 6a4177c42d
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1637585

Change-Id: Ibac754faca6cbda5772eee82994976fdc737b4ff
2021-03-16 13:03:30 +00:00
Liz Kammer
6a4177c42d Merge "Add missing includes for crtend modules" 2021-03-16 12:43:35 +00:00
Rupert Shuttleworth
78f48a511f Depend on libasync_safe module instead of breaking package boundary.
This makes Bazel conversion easier (because in Bazel package boundaries really matter).

Test: m libc still builds, and m also builds.
Change-Id: I5cfc9d83dffd3110ffad9ce03198e6141c8c5b33
2021-03-16 06:39:19 +00:00
Josh Gao
d03ad35fbd Merge "fdtrack: emit the most common stack in the abort message." am: 6ad715689d am: a78103a214
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1631062

Change-Id: I019a46bc66ebe0b0a5b1305d94c7db129abfe622
2021-03-16 02:48:45 +00:00
Josh Gao
a78103a214 Merge "fdtrack: emit the most common stack in the abort message." am: 6ad715689d
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1631062

Change-Id: If17f14cbc0f278bcb1b421a2e5a394c5be1dce7e
2021-03-16 02:08:59 +00:00
Josh Gao
6ad715689d Merge "fdtrack: emit the most common stack in the abort message." 2021-03-16 01:35:43 +00:00