Commit graph

10481 commits

Author SHA1 Message Date
Christopher Ferris
a2142d2835 Fix last python3 issues.
Includes pointing to the python3 version of the clang bindings.

Also, remove stale .gitignore line.

Test: Ran bionic/libc/kernel/tools/update_all.py and verified
Test: the files generated the same exact way.
Change-Id: I4eb9dd7382bca013f70d921b6ef48c7e7478615a
2021-04-20 17:36:07 -07:00
Christopher Ferris
fae6ff2f9e Merge "Update for python3." 2021-04-20 20:49:48 +00:00
Treehugger Robot
8d36be9bb9 Merge "Ignore backup files left by emacs." 2021-04-20 01:24:49 +00:00
Christopher Ferris
ac7ec11473 Update for python3.
This fixes all of the problems with our kernel scripts, but not
the clang python script problems.

I also removed the updateGitFiles function since that code was
just silently failing any way. I replaced all calls with updateFiles.

Test: Ran script using python2 to verify it still works.
Test: Run script in python3 verifying that it starts to run.

Change-Id: I223a31a8324c59e6bc4067f48a6110361b3e26e8
2021-04-19 17:02:38 -07:00
Dan Albert
77d976cd65 Ignore backup files left by emacs.
Test: Added a file like this locally and the upload hook didn't care
Bug: None
Change-Id: I4c33f2517a9a83c7797d3ea9074fffeedf85dcaa
2021-04-19 14:05:59 -07:00
Elliott Hughes
6b586e7709 Force everything to use python3 for consistency.
Rather than "whatever people have installed as 'python' on their machine".

I've removed check-symbols.py because that's been broken for years and
we never even noticed, and I'm not sure it's worth fixing.

Test: treehugger, manual
Change-Id: Ieb996bbdf790a18d4b1fb46a409cc240ba2a2a49
2021-04-15 13:39:08 -07:00
Rupert Shuttleworth
e99df59d1e Make gensyscalls.py compatible with Python 3.
Test: Fixes bp2build; bazel build //bionic/...
Change-Id: I6ab66e99935b962f1ff99e478c0f55188f31b495
2021-04-15 06:14:48 -04:00
Elliott Hughes
f20b021903 Merge "Make res_init() work again." 2021-04-12 17:44:50 +00:00
Bram Bonné
f2bb4e6cec Merge "Revert "Reland: Soft-enable MAC address restrictions with allowlist."" 2021-04-09 07:56:36 +00:00
Josh Gao
44ec9c3252 Merge "Disable fdtrack post-fork." 2021-04-09 01:08:52 +00:00
Elliott Hughes
d0bbfa8327 Make res_init() work again.
Change 75830fb836 to fix _nres
initialization to be thread safe accidentally introduced a behavior
change whereby res_init() became a no-op. It also failed to remove all
direct accesses to _nres.

Move the file over to C++ so we can let RAII ensure we're always holding
a lock while using the global state, make all callers access the global
state via this class, and restore the previous behavior of res_init().

Test: atest DnsResolverTest
Bug: 166235340
Change-Id: Ib390a7eac063bc0ff5eeba755e8c74ef1383004e
2021-04-08 12:04:05 -07:00
Bram Bonné
bca8a4474b Revert "Reland: Soft-enable MAC address restrictions with allowlist."
Revert "Updates CTS tests for MAC address restrictions."

Revert submission 1528409-mac-softrestrict

Reason for revert: App compatibility
Reverted Changes:
I74a50b990:Return anonymized MAC for apps targeting SDK < 30
I8738f7912:Reland: Soft-enable MAC address restrictions with ...
Id13670747:Updates CTS tests for MAC address restrictions.

Change-Id: I64e17cb04acf2862bc657e60694067a456b4f936
2021-04-08 11:39:33 +02:00
Luke Huang
24e0b57429 Merge "Initialize _nres only once" 2021-04-08 02:35:46 +00:00
Josh Gao
dcc97c0887 Disable fdtrack post-fork.
Also delete some fdsan code that attempts to check for the post-fork
state, but never will, because we update the cached pid upon fork.

Bug: http://b/174542867
Test: /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Test: treehugger
Change-Id: I9b748dac9de9b4c741897d93e64d31737e52bf8e
2021-04-07 19:00:45 -07:00
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
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
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
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
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
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
b40eb10acc Merge "Update kernel update documentation." 2021-03-18 20:01:54 +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
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
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
eb33b5b7a8 Merge "Remove bazel_module.label from bionic genrules" 2021-03-16 21:40:04 +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
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
Liz Kammer
aab2ad700b Add missing includes for crtend modules
Test: convert bp2build_available targets to BUILD and bazel build
      --platforms=//build/bazel/platforms:generic_arm64 //bionic/...
Change-Id: I1cbdbf1d65d7dbe95665aaac08004c80f82433e9
2021-03-15 18:03:24 -04:00
Mitch Phillips
87f4a2e50b Merge "Mark MTE elf notes as sdk_version to allow SDK linkage." 2021-03-15 21:33:07 +00:00
Liz Kammer
821e375664 Merge "Merge crt cc_objects" 2021-03-15 19:02:32 +00:00
Lokesh Gidra
7839c173f1 Add userfaultfd syscall in SECCOMP allowlist
Enable userfaultfd syscall to be used by ART-GC.

Bug: 160737021
Test: manually tested by invoking userfaultfd syscall in ART
Change-Id: I9f98402a96bb8363a1e5fa49dbadbb37dc70d561
2021-03-11 19:30:08 +00:00
Peter Collingbourne
03e961e392 Merge "Teach debuggerd to pass the secondary ring buffer to __scudo_get_error_info()." 2021-03-11 01:15:49 +00:00
Liz Kammer
e718dd720d Merge crt cc_objects
Currently there is a pattern of `crtbegin_${type}1` and `crtbegin_${type}` modules, where the former
has sources and the latter depends on the former. The two modules for a type share many properties,
rather than duplicating these, we merge modules, such that each type only has a `crtbegin_${type}`
module.

Test: Treehugger
Change-Id: I7803ea0e97d660f620c334b6bfdfac22cb6e36d7
2021-03-10 19:32:17 +00:00
Nicolas Geoffray
ea8b224d7f Merge "Add min_sdk_version for ART module." 2021-03-09 08:47:47 +00:00
Peter Collingbourne
6ba27e04df Merge "Add some slack at the end of large allocations when target SDK level < S." 2021-03-09 01:15:54 +00:00
Elliott Hughes
b82f5cfeb2 Improve <sys/xattr.h> coverage.
Also fix a comment copy & paste mistake and some formatting.

Test: treehugger
Change-Id: I0af3ab2eb4f180f86b0ab7d2af260f0f30692fdd
2021-03-08 14:09:43 -08:00
Nicolas Geoffray
4647d4839f Add min_sdk_version for ART module.
Bug: 180399951
Test: m
Change-Id: I54eb06ae4a695ae184de4fb72fc0092910836652
2021-03-08 17:29:41 +00:00
Peter Collingbourne
2659d7b6c2 Add some slack at the end of large allocations when target SDK level < S.
This works around buggy applications that read a few bytes past the
end of their allocation, which would otherwise cause a segfault with
the concurrent Scudo change that aligns large allocations to the right.

Because the implementation of
android_set_application_target_sdk_version() lives in the linker,
we need to introduce a hook so that libc is notified when the target
SDK version changes.

Bug: 181344545
Change-Id: Id4be6645b94fad3f64ae48afd16c0154f1de448f
2021-03-05 14:29:17 -08:00
Mitch Phillips
22c90755ed Mark MTE elf notes as sdk_version to allow SDK linkage.
Binaries defined in Makefiles that use the SDK need a variant to link
to. Generate a SDK variant of the ELF note as well. This is necessary to
allow makefile-generated binaries and CTS tests to use heap MTE.

Bug: 156029370
Bug: 181133973

Test: atest CtsBionicTestCases on QEMU+MTE, observe previously-failing
      tests will now succeed.
Change-Id: I0a8243b0920769a196e7596904259e30c4a93105
2021-03-03 15:39:57 -08:00
Elliott Hughes
f443817ab6 Remove unused (and empty) file.
Spotted while looking at our shiny new coverage numbers. Though how the
change that removed the code from this file without removing the file
made it through code review... Clearly I wasn't paying attention that
day!

Test: treehugger
Change-Id: Id61bb48bae60660d2e5ba9b26f00a68e51157c6d
2021-03-03 14:31:35 -08:00
Liz Kammer
8d7082ebda Remove bazel_module.label from bionic genrules
Mixed builds can now use the label from an automatically converted
target.

Test: build/bazel/scripts/milestone-2/demo.sh full
Test: build/bazel/scripts/milestone-2/demo.sh generate
      build/bazel/scripts/milestone-2/demo.sh sync
      mixed build of libc
      build/bazel/scripts/milestone-2/demo.sh cleanup
Change-Id: I1499b75f1348bf342b4cd134606786150b2f8b26
2021-03-03 15:25:18 +00:00
Josh Gao
974721431d Merge "Add wrappers for pidfd_{open,getfd,send_signal}." 2021-03-01 21:06:17 +00:00