Commit graph

28600 commits

Author SHA1 Message Date
Florian Mayer
0633e569bc Merge "Match maximum command line size for startup tracing." 2019-05-07 10:34:05 +00:00
Yi Kong
0beddebef6 Merge "Exclude libgcc_stripped wherever libgcc is excluded"
am: af1467b2cd

Change-Id: I1e74c7b13ce0e0fa0e9c98cf9139f85e36b0645d
2019-05-06 20:12:46 -07:00
Yi Kong
af1467b2cd Merge "Exclude libgcc_stripped wherever libgcc is excluded" 2019-05-07 02:57:24 +00:00
Elliott Hughes
fd03d4a762 Merge "Track libziparchive API change."
am: 9433a0299e

Change-Id: I95726582b4e33e3adde298284af33f69792de10d
2019-05-06 17:13:58 -07:00
Ryan Prichard
ab399dfd4a Merge "Revert fwalk/sfp locking to fix concurrent reads"
am: f61ca22248

Change-Id: I2c9daf5835ba4a1d1d317f647a0192771244bba6
2019-05-06 17:13:25 -07:00
Yi Kong
7ac2afbde3 Exclude libgcc_stripped wherever libgcc is excluded
Test: manual testing
Bug: 130267141
Bug: 29275768
Change-Id: If50420c05d36e6f680a36673e7c26ca7deb93b28
2019-05-06 17:02:53 -07:00
Elliott Hughes
9433a0299e Merge "Track libziparchive API change." 2019-05-06 23:45:16 +00:00
Ryan Prichard
f61ca22248 Merge "Revert fwalk/sfp locking to fix concurrent reads" 2019-05-06 23:38:49 +00:00
dimitry
7f04880820 Enable native_bridge_support
Enable native bridge support for bionic libraries.
Makes it possible to use them in binaries for translated
architectures.

Bug: http://b/77159578
Test: make
Change-Id: Iccd4ad7aecfa5260cc15f09ca975d2e18987278a
2019-05-06 17:13:51 +02:00
George Burgess IV
db48e0c822 tests: use clang's -verify instead of FileCheck
Clang uses this for its own diagnostic tests. The nice feature it adds
here is that it fails if clang emits a diagnostic that we don't expect
(and we get to drop a dependency on FileCheck).

This also tweaks and renames file-check-cxx to reflect its new job.

Bug: 131861088
Test: mma
Change-Id: I77f7ce77869edaa23e2401e622ad7007d2fee06c
2019-05-04 11:53:12 -07:00
Ryan Prichard
c485cdb024 Revert fwalk/sfp locking to fix concurrent reads
The locking can fail in a couple of ways:

 - A concurrent fread from an unbuffered or line-buffered file flushes
   the output of other line-buffered files, and if _fwalk locks every
   file, then the fread blocks until other file reads have completed.

 - __sfp can initialize a file lock while _fwalk is locking/unlocking it.

For now, revert to the behavior Bionic had in previous releases. This
commit reverts the file locking parts of commit
468efc80da.

Bug: http://b/131251441
Bug: http://b/130189834
Test: bionic unit tests
Change-Id: I9e20b9cd8ccd14e7962f7308e174f08af72b56c6
2019-05-04 00:28:00 -07:00
Elliott Hughes
b51bb50471 Track libziparchive API change.
Bug: http://b/129068177
Test: treehugger
Change-Id: Ieccd528a34b66de59fad78586dead6b1df9cae98
2019-05-03 22:45:41 -07:00
Florian Mayer
f6d221eeed Match maximum command line size for startup tracing.
Fix too small buffer for the startup property not accounting for the
prefix.

Bug: 131893397

Change-Id: Iad2398bc09c61b1144430bcbef58e5a832b85b0a
2019-05-03 17:37:47 +01:00
Christopher Ferris
2541fd7acc Merge "Fix malloc_info missing large allocs."
am: 2c02e45f4b

Change-Id: I3902ab843027efa50fed5f2456cf9d6315c5ae32
2019-05-03 09:16:30 -07:00
Christopher Ferris
2c02e45f4b Merge "Fix malloc_info missing large allocs." 2019-05-03 16:06:26 +00:00
Christopher Ferris
db9706afc3 Fix malloc_info missing large allocs.
Also change the names of some of the functions to make it very obvious
that the functions being called are in je code.

Write new test to make sure mallinfo and malloc_info match.

Bug: 131864803

Test: New unit tests pass (along with all other bionic unit tests).
Change-Id: I26eda7e64f57a8c56cc8d70e3ed6a29dcb87f630
Merged-In: I26eda7e64f57a8c56cc8d70e3ed6a29dcb87f630
(cherry picked from commit 125d32cb46)
2019-05-03 07:21:45 -07:00
Christopher Ferris
878909e2aa Merge "Make purging clear the current thread cache too."
am: 1eb6d36ba8

Change-Id: Ida14ee2d68346a95064c3d1b2668c3da268d045d
2019-05-01 17:10:25 -07:00
Christopher Ferris
1eb6d36ba8 Merge "Make purging clear the current thread cache too." 2019-05-01 22:22:46 +00:00
Christopher Ferris
0f710fd593 Make purging clear the current thread cache too.
Bug: 131362671

Test: Ran bionic unit tests.
Test: Wrote a test that did a purge and verified that the tcache->ncached
Test: number went from 3 to 0. Also verified that mallinfo reflects the
Test: cached entries being flushed.
Change-Id: I64e35618fa3b523cf29bdaceedef676abe440dd3
2019-05-01 13:26:46 -07:00
Dimitry Ivanov
8f36962cc7 Merge "Remove dependency on unused libutils"
am: 911fbfc259

Change-Id: Iecb3e9333df1a3210e4ee0bb1044755f9cdf17a9
2019-05-01 02:47:32 -07:00
Dimitry Ivanov
911fbfc259 Merge "Remove dependency on unused libutils" 2019-05-01 09:37:56 +00:00
Elliott Hughes
6cd42edd45 Merge "malloc.h: explicitly suggest malloc_info() instead of mallinfo()."
am: 5997d53e69

Change-Id: I84d3752b1889bab02c7d5c559b14f49e32a31495
2019-04-30 22:12:08 -07:00
Elliott Hughes
5997d53e69 Merge "malloc.h: explicitly suggest malloc_info() instead of mallinfo()." 2019-05-01 05:03:15 +00:00
Elliott Hughes
4fa9b8cd2e malloc.h: explicitly suggest malloc_info() instead of mallinfo().
I've also sent a patch to the man7.org man page.

Change-Id: I715eacf129abe61562c6d79c4eda03bab31f9c77
2019-04-30 12:44:03 -07:00
dimitry
afe30a5281 Remove dependency on unused libutils
Test: make
Change-Id: I64f9390c680eeedec7acb8465bfde254b3c96904
2019-04-30 13:01:42 +02:00
Tom Cherry
0a656ffa25 Merge "Allow device launched before Q to use legacy OEM AID value"
am: 0cd818a377

Change-Id: Ifd14e71d6f25b892a21840ad21aa4245c08bb62d
2019-04-29 08:42:23 -07:00
Tom Cherry
0cd818a377 Merge "Allow device launched before Q to use legacy OEM AID value" 2019-04-29 15:25:25 +00:00
Neil Fuller
b87effbbdf Merge "Move /system dependency on tz_version to bionic"
am: f5eaea32b6

Change-Id: If638121775a3d416818dca51350a65f8eb720087
2019-04-29 06:10:57 -07:00
Neil Fuller
f5eaea32b6 Merge "Move /system dependency on tz_version to bionic" 2019-04-29 12:59:32 +00:00
Elliott Hughes
766c77f88e Merge "Fix running tests/benchmarks on the host."
am: dfa3231fae

Change-Id: I9f663c0f53cec6ffbb6327d6a0c0b8aebea68ebc
2019-04-27 09:30:13 -07:00
Elliott Hughes
dfa3231fae Merge "Fix running tests/benchmarks on the host." 2019-04-27 16:15:21 +00:00
Elliott Hughes
4da99ffe5e Fix running tests/benchmarks on the host.
This was broken by all the mainline modules stuff. It's quite a bit
hairier to set up now, given that we don't have an apexd on the host.
An alternative might be to actually set up a fake /apex that points to
the bootstrap directories?

Test: ./benchmarks/run-on-host.sh 64
Test: ./tests/run-on-host.sh 64
Change-Id: If2c277ba492c7c443cdf51526ea42f56568e2ea6
2019-04-26 17:45:17 -07:00
Ryan Prichard
4051029224 Merge "__cxa_finalize: skip fflush call on dlclose"
am: 34bf6107b6

Change-Id: I59568ea0f93338d3a2bdbd75490e41c0d18952b2
2019-04-26 15:07:12 -07:00
Ryan Prichard
34bf6107b6 Merge "__cxa_finalize: skip fflush call on dlclose" 2019-04-26 21:51:05 +00:00
Nick Kralevich
54ed6eef25 Merge changes I59a7c224,I82d28654
am: 70f090e4e8

Change-Id: I144e3378522abdd81ea8ae93fc41f63aeffe10c3
2019-04-26 14:22:17 -07:00
Treehugger Robot
70f090e4e8 Merge changes I59a7c224,I82d28654
* changes:
  Don't honor LIBC_HOOKS_ENABLE across a security boundary
  Don't honor LD_CONFIG_FILE across security transitions
2019-04-26 21:15:28 +00:00
Nick Kralevich
560de5f5c7 Don't honor LIBC_HOOKS_ENABLE across a security boundary
Similar to the way we handle LIBC_DEBUG_MALLOC_OPTIONS
(bug 68003719), filter LIBC_HOOKS_ENABLE when we cross a
security boundary. This prevents modifying the allocation
behavior of a privileged program.

Introduced in
db478a6274%5E%21/#F0
(bug 30561479)

Test: compiles and boots
Change-Id: I59a7c224734b0991fd62efb45ab599dab8570723
2019-04-26 12:58:00 -07:00
Nick Kralevich
99cec1892d Don't honor LD_CONFIG_FILE across security transitions
For security reasons, when a binary is executed which causes a security
transition (eg, a setuid binary, setgid binary, filesystem capabilities,
or SELinux domain transition), the AT_SECURE flag is set. This causes
certain blacklisted environment variables to be stripped before the
process is executed. The list of blacklisted environment variables is
stored in UNSAFE_VARIABLE_NAMES. Generally speaking, most environment
variables used internally by libc show up in this list.

Commit 02586a2a34 ("linker: the
global group is added to all built-in namespaces", Aug 2017) added
support for the environment variable LD_CONFIG_FILE. This debug build
only feature allows the caller to specify the path to the loader
configuration file. Like other linker environment variables, setting
this variable allows the calling process to control executed code of the
called process, which has security implications (on debuggable builds
only).

Add LD_CONFIG_FILE to UNSAFE_VARIABLE_NAMES. This has the effect of
stripping, on all build types, the LD_CONFIG_FILE environment variable.
This has three advantages:

1) Prevents security bugs should LD_CONFIG_FILE ever be inadvertantly
exposed on a production build.
2) Makes the behavior of userdebug and user builds more similar, helping
prevent build-type dependent bugs where someone may come to rely on this
debug-only feature.
3) Protect droidfood users against malicious applications which can
trigger a security transition, eg, the execution of crash_dump or the
renderscript compiler.

Alternative considered but rejected:

If we treated LD_CONFIG_FILE like LD_PRELOAD, we could expose this on
all build types, and remove the build-type dependent behavior. But this
is contrary to enh's Aug 02 2017 guidance at
https://android-review.googlesource.com/c/platform/bionic/+/449956

  i'm still uncomfortable about LD_CONFIG_FILE because i'd like
  to be reducing the number of environment variables that affect
  the linker in P rather than increasing them.

Test: atest CtsBionicTestCases
Test: atest linker-unit-tests
Change-Id: I82d286546ee079b5cde04428dc89941c253c2d20
2019-04-26 12:08:54 -07:00
Ryan Prichard
c5d8c6c6e4 __cxa_finalize: skip fflush call on dlclose
In __cxa_finalize, only call fflush(NULL) when the program is exiting, not
when a library is unloaded with dlclose. This change restores behavior
from 2015.

Flushing output is needed when the program exits, but flushing everything
is hazardous at other times because it can block -- fflush(NULL) locks
every file, so it also blocks on read operations.

Bug: http://b/130655235
Test: manual
Change-Id: I2f5ecffa6724bfd98a93d145ab5313c793c01ae6
2019-04-25 16:38:31 -07:00
dimitry
f114ee76c0 Merge "Make pthread_get/setschedparam weak for native bridge"
am: 9f193e14ed

Change-Id: I47eab7fcc2a9be1ea42bd20b91403715e65713fc
2019-04-25 12:19:31 -07:00
Treehugger Robot
9f193e14ed Merge "Make pthread_get/setschedparam weak for native bridge" 2019-04-25 18:57:22 +00:00
Tom Cherry
b368a0b2e4 Allow device launched before Q to use legacy OEM AID value
Devices launched before Q may be using OEM defined AID that are not in
the OEM_RESERVED ranges. Those devices should be allowed to keep using
legacy oem AID values given it may not be possible to upgrade the
userdata and persist files through OTA.

Bug: 131095318
Test: bionic-unit-tests

Change-Id: I73fc0c452420be5287adcacb36a1e772acc9bb3e
2019-04-25 09:26:48 -07:00
dimitry
c7b81108b4 Make pthread_get/setschedparam weak for native bridge
Bug: http://b/130825973
Test: run affected app on cuttlefish
Change-Id: I776f26f5eaebdfdb1256ff621bd05ef5a90b852a
2019-04-25 16:43:24 +02:00
Neil Fuller
a7db90f32d Move /system dependency on tz_version to bionic
Move /system dependency on tz_version to bionic from core-libart.

The file is not used by code but is useful on device to identify
the format / version / origin of the tzdata file. The
tz_version file identifies the Android release (e.g. 3.1 == Q), which
implies the version of zic used to generate tzdata, and any Android
revision of the tzdata (e.g. 2019a v2) that may have taken place. The
file was previously used by by the tzdatacheck binary but it has since
switched to using the copy in the runtime module.

The bionic README.md is also updated here to reflect latest locations of
scripts.

Bug: 131239046
Test: make installclean / make droid / inspect /system
Change-Id: Ib142f98aa30c8c9d5eda33df55d4191478570ced
2019-04-25 09:35:58 +01:00
Tom Cherry
5bd54f3b4e Merge "Refactor some pieces of grp_pwd.cpp"
am: 731ed0fb52

Change-Id: Ia1346fff98c2fbfc45449f48d70cafedefc9a174
2019-04-24 16:13:02 -07:00
Tom Cherry
731ed0fb52 Merge "Refactor some pieces of grp_pwd.cpp" 2019-04-24 23:02:06 +00:00
Elliott Hughes
3716c5320d Merge "threads.h: Add C11 thread support."
am: 8c3140a612

Change-Id: I2b015a37c469055a44ba36cd7855e2cb770d1df0
2019-04-24 13:56:32 -07:00
Tom Cherry
5fb07634c3 Refactor some pieces of grp_pwd.cpp
We loop through android_ids in many functions, but this can be
consolidated into find functions.

Test: bionic-unit-tests
Change-Id: I70c423affe49090a93e999c72bb4c84a068de5d8
2019-04-24 13:37:11 -07:00
Elliott Hughes
8c3140a612 Merge "threads.h: Add C11 thread support." 2019-04-24 20:33:08 +00:00
Elliott Hughes
4206711352 threads.h: Add C11 thread support.
FreeBSD, glibc, and musl have all implemented C11 threads at this
point. POSIX is looking at how to align with it. Probably time to jump
on the bandwagon ourselves...

Implemented in the same style as <termios.h> so we can provide this
functionality even on older API levels. This does mean that this is
strictly more expensive than calling pthread functions directly.

Although this isn't in POSIX yet, assume that it's going to be basically
the same as C11 and add the header test anyway. We should revisit this
when POSIX actually adds <threads.h>.

Test: new tests
Change-Id: I8602d67ce71ca7f8ed1529daa0a8ea1feb083dd6
2019-04-24 09:12:29 -07:00