Commit graph

481 commits

Author SHA1 Message Date
Hans Boehm
b708511f78 Merge "Prepare to fail in RefBase destructor if count is untouched"
am: f502182ac6

Change-Id: I91ff7140a9a72c910ef01a2e13f277fa36c82b50
2018-08-06 11:01:28 -07:00
Hans Boehm
9d3146af22 Prepare to fail in RefBase destructor if count is untouched
Move towards crashing if a normally configured RefBase object is
destroyed without ever incrementing the reference count. We've been
threatening to do this for a long time. The previously last known
violation had been fixed.

This also fixes stack trace printing from RefBase, which had previously
been broken, and which we found necessary to track down further
violations of this rule.

Unfortunately, we found several more violations with the aid of
that fix. After existing CLs are submitted, there are
still some failures, but they are no longer numerous. Thus this CL
doesn't actually crash in the event of a violation, but does log a
verbose stack trace if it encounters one.

Bugs have been filed against the remaining known RefBase client offenders.
We plan to enable crashing on usage violations once those are fixed.

The fix for the stack trace printing breakage unfortunately requires
the use of weak symbols in order to avoid a circular build dependency.
We expect to eventually replace this with execinfo.h functionality.

Some random reformatting, driven by consistency with current formatting
requirements.

Add missing include to BacktraceMap.h.

Bug: 79112958
Bug: 30292291
Test: Boot AOSP, Master
Change-Id: I8151c54560c3b6f75ffc4c48229f0388a2066958
2018-08-03 17:56:47 -07:00
Josh Gao
9404f2da14 Merge changes from topic "looper_unique_fd"
am: 7e7cefa2c7

Change-Id: Id920135cff272f593b71ef8cb7ff41ee16de4484
2018-07-23 14:36:43 -07:00
Josh Gao
2d08ae57d4 libutils: switch Looper's fds to unique_fd.
Switch Looper to using unique_fd for its owned file descriptors, to
benefit from fdsan.

Bug: http://b/111560345
Test: treehugger
Change-Id: I8efff7741ed19fd71f82f7e604b4f1c66fc5ea2b
2018-07-18 18:12:12 -07:00
Yi Kong
2a6a58a818 Merge "[libutils] Modernize codebase by replacing NULL with nullptr"
am: ab3203f383

Change-Id: I5c2aaaea705a3ab82a5ad999f813e4cc22e63401
2018-07-17 10:06:10 -07:00
Yi Kong
e1731a4f2e [libutils] Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning.

Test: m
Bug: 68236239
Change-Id: I5e89ec8c42151875439d2656475a8739ab9cb7dc
2018-07-16 18:11:34 -07:00
Yi Kong
0f45e589ef Merge "Modernize codebase by replacing NULL with nullptr"
am: 9154fbc8df

Change-Id: I439ffa4df2e5672ed2b66d88abbb61ed67355926
2018-07-13 21:38:41 -07:00
Yi Kong
c1a1562548 Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning for binder.

Test: m
Bug: 68236239
Change-Id: I8184bd6aa4ebff1bd8c88dad16886e98df853b03
2018-07-13 15:28:59 -07:00
Jiyong Park
4ebda908de Shared libs are supported in recovery mode
am: 011ee12b1d

Change-Id: I867dbafecf11215b82d952c532774cdf12c6e782
2018-06-13 16:43:09 -07:00
Jiyong Park
011ee12b1d Shared libs are supported in recovery mode
adbd has been built as a static executable since the same binary was
copied to the recovery partition where shared library is not supported.
However, since we now support shared library in the recovery partition,
adbd is built as a dynamic executable.

In addition, the dependency from adbd to libdebuggerd_handler is removed
as debuggerd is handled by the dynamic linker.

A few more modules in /system/core are marked as recovery_available:
true as they are transitive dependencies of the dynamic linker.

This change also includes ld.config.recovery.txt which is the linker
config file for the recovery mode. It is installed to /etc/ld.config.txt
and contains linker namespace config for the dynamic binaries under
/sbin.

Bug: 63673171
Test: `adb reboot recovery; adb devices` shows the device ID
Test: Select 'mount /system' in the recovery mode, then `adb shell`.
$ lsof -p `pidof adbd` shows that libm.so, libc.so, etc. are loaded from
the /lib directory.

Change-Id: I363d5a787863f1677ee40afb5d5841321ddaae77
2018-06-10 08:32:24 +09:00
Jiyong Park
dfe433db47 Merge "Mark as recovery_available: true" am: 9f6f8bf0dc
am: d7fece5d91

Change-Id: Id59445da13aeef13784f04daebc8a96a7d506cbb
2018-05-21 22:32:36 -07:00
Jiyong Park
612210c75b Mark as recovery_available: true
Libraries that are direct or indirect dependencies of modules installed
to recovery partition (e.g. toybox) are marked as recovery_available:
true. This allows a recovery variant of the lib is created when it is
depended by other recovery or recovery_available modules.

Bug: 67916654
Bug: 64960723
Test: m -j
Change-Id: Ie59155c08890e96ce1893fa3687afcf763d7aea3
2018-05-15 09:47:04 +09:00
Pirama Arumuga Nainar
87013686ad Merge "Remove more semicolons at the end of namespaces" am: d652a9e231
am: b2206b0d43

Change-Id: Ie6da257aac75729e056918f4a5f2c9e339ff05ab
2018-04-12 09:36:44 -07:00
Pirama Arumuga Nainar
90affce0c8 Remove more semicolons at the end of namespaces
These warnings are triggered by -Wextra-semi (and not -Weverything, as
incorrectly mentioned in I49b6e6af483e011632e6a34c0663c93e5c385aa6).
This warning is added to Hidl-generated libs.

To appease clang-format, this patch also fixes some extra newlines.

Test: Build
Change-Id: I63cf5d8ecba46ad87876ff21848bfff04b12ec6e
2018-04-11 23:14:13 -07:00
Pirama Arumuga Nainar
2a8e2cd325 Merge "Remove extra semicolon at end of namespace" am: 1d2bf45b55
am: c309a0715f

Change-Id: I1a1b0c6c6837f2985bdccfd5b3f4d05a1feec006
2018-04-10 17:43:07 -07:00
Pirama Arumuga Nainar
eab48ce0d5 Remove extra semicolon at end of namespace
Upcoming clang update to r328903 adds a new warning:
  warning: extra ';' outside of a function is incompatible with C++98
  [-Wc++98-compat-extra-semi]

which is included in -Weverything.

We can just delete the extra semicolon (even though we use gnu99), and
save the extra byte.

Test: Build

Change-Id: I49b6e6af483e011632e6a34c0663c93e5c385aa6
2018-04-10 22:10:54 +00:00
Jiyong Park
d3c26ed8bc Merge "Revert "libutilscallstack is private VNDK-SP"" am: 7a72d07e40
am: bde587f715

Change-Id: If7634b1db99f068e77f73d8274f1f54efabde5d0
2018-03-15 01:59:22 +00:00
Jiyong Park
130fea3478 Revert "libutilscallstack is private VNDK-SP"
CallStack.cpp was part of libutils, but has been separated into a new
library libutilscallstack [1] and then made invisible to vendors [2].
However, this is causing problem to the vendors who have been using
the CallStack class from libutils, because the class is no longer
available to them.

In order to support them, marking libutilscallstack as
'vendor_available: true'.

This reverts commit a32678df55.

[1] https://android-review.googlesource.com/c/platform/system/core/+/591954
[2] https://android-review.googlesource.com/c/platform/system/core/+/599754
Bug: 74600214
Test: m -j
Test: 2016/2017 pixel devices boots to the UI and Photo Editing works

Change-Id: Iaa232ed978378b566a4710e2320ee6ed04572e14
2018-03-14 16:21:00 +09:00
Steven Moreland
d6c3476582 Merge "libutils: Remove Static.cpp and darwin hacks." am: 929112bcd1
am: 41a294981b

Change-Id: Iebe132eaca4f9034a8e011881f1514f864529fc5
2018-03-08 21:44:42 +00:00
Steven Moreland
241b93cfd3 libutils: Remove Static.cpp and darwin hacks.
Bug: N/A
Test: in internal master, the only libraries that reference this
  symbol are:
./prebuilts/sdk/tools/linux/bin/split-select android::gDarwinIsReallyAnnoying
./prebuilts/sdk/tools/linux/bin/aapt android::gDarwinIsReallyAnnoying
./prebuilts/sdk/tools/linux/bin/aapt2 android::gDarwinIsReallyAnnoying
./prebuilts/sdk/tools/linux/lib64/libaapt2_jni.so android::gDarwinIsReallyAnnoying
./prebuilts/sdk/tools/linux/lib64/libaapt2_jni.so android::gDarwinIsReallyAnnoying
+ VNDK libraries
Test: libutils_test

Change-Id: Id39e5ef6438e48fa225ba06dbb59902ca5b60f70
2018-03-06 17:44:08 +00:00
Steven Moreland
977f72f9bc String16: remove integer overflows
Bug: 73826242
Test: manual
Change-Id: I32e13d61b944c1a527cf2d95473552d246e322be
2018-03-01 11:04:08 -08:00
Steven Moreland
9571234e22 libutils: remove subdirs
no longer used in Android

Test/Bug: none

Change-Id: I155d5ade02527bf47893a8bf8bcbb07b0aae53d8
2018-02-23 14:44:22 -08:00
Elliott Hughes
dc699a269f bpfmt.
Bug: N/A
Test: builds
Change-Id: I89ad00e1c4c7e0767bc80a7ac7935a4d55e090ac
2018-02-16 17:58:14 -08:00
Jiyong Park
a32678df55 libutilscallstack is private VNDK-SP
The library isn't intented to be exposed to vendors. It is a platform
private library.

Bug: 72471487
Test: Pixel 2016/2017 boots to the UI. Photo editing works.
Change-Id: Ib0479a43d66d988c2f882688240746bed3213dad
2018-01-25 14:02:08 +09:00
David Sehr
abfb9f3b99 Remove libziparchive dependency on libutils
Prevent future cyclic dependency from libunwind changes.

Bug: 66919073
Test: make -j 50
Change-Id: I2a4fa5b7c2c3a82db2073d0fa51940da6603be1f
2018-01-18 09:23:53 -08:00
Treehugger Robot
51c2088f3b Merge "Usage suggestions." 2017-12-19 20:32:29 +00:00
Steven Moreland
b8f152d3e2 Usage suggestions.
Providing alternative suggestions for using C++ stdlib types
instead of libutils types:
- higher interoperability
- fewer "legacy" quirks
- ability to use stl algorithms
- high optimization levels

Test: none
Change-Id: If81aa9982ca0ad229fa13c8142387906981b054d
2017-12-19 01:16:00 +00:00
Steven Moreland
8edb49060a Remove CompileTimeIfElse.
- not used anywhere
- equivalent to std::conditional

Test: none
Bug: none
Change-Id: Iffc00acb899d5159359d60c09443c7d2d7fdf2a0
2017-12-18 15:52:50 -08:00
Elliott Hughes
3289b9c928 Merge "Add OWNERS." 2017-12-07 23:21:26 +00:00
Elliott Hughes
693d63f9cf Add OWNERS.
Bug: N/A
Test: N/A
Change-Id: Ie785058c0f5eb9b4086c98ccba6e63e3ed411b65
2017-12-07 13:30:03 -08:00
Dan Willemsen
829ecaa808 Merge "Fix / suppress new unused warnings for mingw+clang"
am: f106bb6bb8

Change-Id: I4e4ac1ff248bd437dd721cac8d55b4925e7af5a8
2017-11-30 22:43:14 +00:00
Dan Willemsen
f106bb6bb8 Merge "Fix / suppress new unused warnings for mingw+clang" 2017-11-30 22:31:54 +00:00
Dan Willemsen
528f144e77 Fix / suppress new unused warnings for mingw+clang
Bug: 69933068
Test: mmma system/core
Change-Id: I089166a979d3d8c5ada38a7745d507b555048499
2017-11-29 21:37:28 -08:00
Logan Chien
d38831e107 Merge "libutils: Cleanup unused class declaration"
am: 23cc38d440

Change-Id: I93c1e2f9fc1d2c5ee6b1a6310952a4f7824b88a4
2017-11-28 02:22:03 +00:00
Logan Chien
20f7dc7041 libutils: Cleanup unused class declaration
This commit removes unused class declaration for SharedBuffer and
TextOutput.  SharedBuffer has become internal implementation details
since 282efae9c.  TextOutput usages have been removed since 9eb2a3b1.

Test: AOSP and master build w/o problems
Change-Id: I1871c4919a46f1ea8f41fb7eb79b4dc800b6f6f4
2017-11-22 18:31:10 +08:00
Xin Li
23e27db576 Merge commit 'a63ccea6abc7ea02e2d98e41c80793ca97237bd3' from
oc-mr1-dev-plus-aosp into stage-aosp-master

Change-Id: Ia33311cd1fd26dfaea59a69317b306fb91203c40
Merged-In: I03d06b10807e8a313c9654c2e1db36bfb59e3f99
2017-11-14 13:19:45 -08:00
Chih-Hung Hsieh
122352d983 Use -Werror in system/core
* Move -Wall -Werror from cppflags to cflags.
* Fix/suppress warning on unused variables.

Bug: 66996870
Test: build with WITH_TIDY=1
Change-Id: I1e05e96a1d0bcb2ccef1ce456504b3af57167cc5
2017-11-01 11:32:55 -07:00
Treehugger Robot
b128c78aef Merge "libutils: Fix bug in strstr16." 2017-10-24 20:20:00 +00:00
Branislav Rankov
bf3fff1a9e libutils: Fix bug in strstr16.
In the original code when target is an empty string
strlen16() would start reading the memory until a
"terminating null" (that is, zero) character is found.
This may happen because "*target++", at line 300,
would increment the pointer beyond the actual string.

Signed-off-by: Branislav Rankov <branislav.rankov@arm.com>
Signed-off-by: Tamas Petz <tamas.petz@arm.com>
Test: libutils_tests --gtest_filter=UnicodeTest.strstr16*
Change-Id: I213ffe061057c7fa8f34b68881e106a709557dcd
2017-10-24 10:36:00 -07:00
Dan Willemsen
abb3521abe Merge "Use target.linux for all linux kernel based targets" am: ab62265fa1
am: f973417005

Change-Id: I6bba9b0849075fe0703032d2c8f258b5ea86547f
2017-10-18 22:56:19 +00:00
Dan Willemsen
f973417005 Merge "Use target.linux for all linux kernel based targets"
am: ab62265fa1

Change-Id: I11e4bd0dae56c350a9839f95b1e85bf30490701d
2017-10-18 22:50:48 +00:00
Steven Moreland
0567c0e386 Add vendor_available to liblog_headers.
Renamed NDK headers to "liblog_ndk_headers"
(these names aren't used anywhere).

libutils_headers now properly export liblog_headers.

Test: with BOARD_VNDK_VERSION=current
Merged-In: I3a85385f588b84393c57fd6d1bcac620f708f0f1
Change-Id: I3a85385f588b84393c57fd6d1bcac620f708f0f1
(cherry picked from commit 42b485cc53)
2017-10-17 08:02:20 +00:00
Steven Moreland
c956b182e5 libutils: liblog export headers
- make liblog dependency for all library builds (this is required
    for files like String8.cpp)
- export liblog headers (because they are used in many header files).

Test: less libraries fail with BOARD_VNDK_VERSION := current
Merged-In: Iecb9cd00deb3a9056ea63c4a087afdb80a51a2b8
Change-Id: Iecb9cd00deb3a9056ea63c4a087afdb80a51a2b8
(cherry picked from commit 43e20cac7b)
2017-10-17 08:01:48 +00:00
Dan Willemsen
bdddcab3bd Use target.linux for all linux kernel based targets
Now in Android.bp files, target.linux applies to all targets running a
linux kernel (android, linux_glibc, linux_bionic). So common
flags/sources/etc can be combined instead of copying them to each
target.

Test: m
Change-Id: If7ad138ea1c540c160731f86b6ccc0daa5c69b83
2017-10-16 20:55:39 -07:00
Steven Moreland
95d7cbb77a Add vendor_available to liblog_headers.
Renamed NDK headers to "liblog_ndk_headers"
(these names aren't used anywhere).

libutils_headers now properly export liblog_headers.

Test: with BOARD_VNDK_VERSION=current
Merged-In: I3a85385f588b84393c57fd6d1bcac620f708f0f1
Change-Id: I3a85385f588b84393c57fd6d1bcac620f708f0f1
(cherry picked from commit 42b485cc53)
2017-10-17 12:09:50 +09:00
Steven Moreland
1f64241e2d libutils: liblog export headers
- make liblog dependency for all library builds (this is required
    for files like String8.cpp)
- export liblog headers (because they are used in many header files).

Test: less libraries fail with BOARD_VNDK_VERSION := current
Merged-In: Iecb9cd00deb3a9056ea63c4a087afdb80a51a2b8
Change-Id: Iecb9cd00deb3a9056ea63c4a087afdb80a51a2b8
(cherry picked from commit 43e20cac7b)
2017-10-17 12:08:33 +09:00
Dan Willemsen
60a410d606 Merge changes from topic "linux_glibc" am: 7b3d4da91a
am: 348a082469

Change-Id: Ia203b8b7bf807385b90232fedf91cef80f040279
2017-10-03 03:19:45 +00:00
Dan Willemsen
348a082469 Merge changes from topic "linux_glibc"
am: 7b3d4da91a

Change-Id: I1cb69992882db5a265234ac808d408f1f136f0e5
2017-10-03 03:03:52 +00:00
Dan Willemsen
7b3d4da91a Merge changes from topic "linux_glibc"
* changes:
  Rename target.linux[_x86[_64]] to target.linux_glibc[_x86[_64]]
  Move host flags from linux -> host
2017-10-03 02:30:06 +00:00
George Burgess IV
84b998f437 Merge "Silence a use-after-free warning from the analyzer" am: 8c853c43cc
am: 584853bdb0

Change-Id: I355b80ad7e59daeba569e6f9bb8eea853121acf9
2017-10-02 22:42:19 +00:00