Commit Graph

58386 Commits

Author SHA1 Message Date
Jooyung Han 63d363baea Merge "Set min_sdk_version to be part of mainline modules" 2020-05-13 01:06:30 +00:00
Treehugger Robot 53053dd1b1 Merge "Add a few more trivial socket_spec.h tests." 2020-05-13 01:00:39 +00:00
Elliott Hughes e65e002102 Add a few more trivial socket_spec.h tests.
Also remove some dead code. The "missing port" case in
parse_tcp_socket_spec hasn't been meaningful since we put the default
port back.

Test: treehugger
Change-Id: I40958f0f1c2dd7f0315142c2c0363a70fe6f80fe
2020-05-12 16:38:11 -07:00
Steve Muckle a9b3443e53 fastbootd: copy AVB footer on boot image to end of block device
If the flashed boot image is smaller than the block device, the AVB
footer will not be at the end of the partition. Although images are
normally created to match the partition size the GKI boot.img must work
on all devices, and the size of the boot partition will vary.

Copy the AVB footer to the end of the partition before flashing, if it
is not there already.

Bug: 156036850
Change-Id: I11f0c7d32d1b6c74edd4f84f815d175605280cb8
2020-05-12 16:21:41 -07:00
Elliott Hughes 631fe1e6df Make some fdevent member functions pure virtual.
...because that makes our coverage numbers look better. But since there
are only two concrete classes anyway, we weren't gaining much from the
default implementation and it's arguably more intention-revealing now.

Test: treehugger
Change-Id: I7a8a3195023048b1a84277358b857222692d96ee
2020-05-12 16:18:52 -07:00
Jooyung Han 7ea0d74bc8 Set min_sdk_version to be part of mainline modules
Modules contributing mainline modules (APK/APEX) should set
min_sdk_version as well as apex_available.

For now setting min_sdk_version doesn't change build outputs.
But build-time checks will be added soon.

Bug: 152655956
Test: m
Change-Id: Ida890adfe6dfac79267fc0e18b63d2330266438c
2020-05-13 08:18:06 +09:00
Tom Cherry d5b3838dbc logd: make LogBuffer an interface
We may use different implementations of LogBuffer in the future, so we
make it interface and create a concrete ChattyLogBuffer class that
implements it.

Test: logging unit tests
Change-Id: I5731d6404640664c9acc26b7c677dff3110c6a11
2020-05-12 15:39:19 -07:00
Tom Cherry 68630a0dbe logd: refactor LastLogTimes a bit
There's still plenty of work that can be done here, particularly
re-doing the locking so each LogReaderThread does not mutually exclude
the others, but that's out of the scope here.

This change primarily removes the public 'mTimes' from LogBuffer and
creates a new LogReaderList class instead.  It would have merged this
into LogReader, but that creates a circular dependency.

This change also removes the need to reference LogReader or
LogReaderList from LogAudit, LogKLog, and LogListener, instead relying
on LogBuffer()::log() to call LogReaderList::NotifyNewLog().

Test: logging unit tests
Change-Id: Ia874b57a9ec1254af1295bfa6f7af2f92a75755b
2020-05-12 15:39:11 -07:00
Treehugger Robot 0de918bdbb Merge "liblog: remove useless #define" am: 18da289fac
Change-Id: I8d7953533e64deb50b26362917944c4ebcf45a0d
2020-05-12 20:09:22 +00:00
Treehugger Robot 18da289fac Merge "liblog: remove useless #define" 2020-05-12 19:49:26 +00:00
Treehugger Robot a55b2e3f68 Merge "logd: remove unnecessary static" am: a597f75045
Change-Id: I255b0a524af3c29f88c6de1891b51feb5fbdba12
2020-05-12 19:44:41 +00:00
Treehugger Robot a597f75045 Merge "logd: remove unnecessary static" 2020-05-12 19:28:52 +00:00
Tom Cherry 6a391e9eda liblog: remove useless #define
Neither android_logger_free nor android_logger_close exist.

Test: build
Change-Id: Ieb4d740c234b54db9278a21f07b0533c28b76baf
2020-05-12 10:44:22 -07:00
Tom Cherry 40addf79d4 logd: remove unnecessary static
ThreadFunction() will only be entered once, so there's no worry that
we'll call prctl() multiple times.

Test: logging unit tests
Change-Id: Id2a02c2ab807f1565e3d625424e040481b3aa1a3
2020-05-12 10:42:25 -07:00
Tom Cherry 0379e27671 Merge changes I9d6dde2c,I38bfcba5 am: a269c7c3d1
Change-Id: I7b1d8555bab125ee5b0d2320917e16764c271537
2020-05-12 16:09:13 +00:00
Tom Cherry a269c7c3d1 Merge changes I9d6dde2c,I38bfcba5
* changes:
  logd: separate LogStatistics from LogBuffer
  logd: remove LogFindWorst
2020-05-12 15:55:50 +00:00
Josh Gao 5954016965 Merge changes Id8d9fa6c,I47d3ad50,I7cebbf75,Id10e320a am: a227c19ef2
Change-Id: I9768dedeb7e2bd4f44c872bbaa6695a9fa8e794d
2020-05-12 05:44:01 +00:00
Josh Gao a227c19ef2 Merge changes Id8d9fa6c,I47d3ad50,I7cebbf75,Id10e320a
* changes:
  adbd: avoid compiling more code in the daemon.
  adb: don't run all of the tests again over TCP in coverage.
  adbd: respect ADB_TRACE on host adbd.
  adb: mark kMaxProcessNameLength as constexpr.
2020-05-12 05:32:48 +00:00
Treehugger Robot e555230b01 Merge changes I24e70952,I652560ad am: 8987016b1e
Change-Id: I8f5b9f40a41c9124dd14ac80178584a475330590
2020-05-12 02:37:27 +00:00
Treehugger Robot 8987016b1e Merge changes I24e70952,I652560ad
* changes:
  adb: use transport-id to make coverage script faster.
  adb: add `adb transport-id` command.
2020-05-12 02:22:27 +00:00
Tom Cherry de2a239467 Merge "logd: don't poll() before recvmsg()" am: bf3b47a031
Change-Id: I35b3a5e581163838d3154100c38719547a4fa7b2
2020-05-12 00:49:25 +00:00
Tom Cherry bf3b47a031 Merge "logd: don't poll() before recvmsg()" 2020-05-12 00:31:37 +00:00
Treehugger Robot 15a669542e Merge "Remove unneeded optimize_for lite" am: 1d77251d76
Change-Id: Ic831678603d567bba7c7b59954f268acb16f07e7
2020-05-11 23:59:43 +00:00
Treehugger Robot 1d77251d76 Merge "Remove unneeded optimize_for lite" 2020-05-11 23:49:29 +00:00
Yifan Hong 1e6ff23b6e Merge "vts_processgroup_validate_test: make deps static" am: d6b307fb15
Change-Id: Ibd82e15de71d3e94ca708e48b0c4fd1bf5f79ecc
2020-05-11 19:39:32 +00:00
Yifan Hong d6b307fb15 Merge "vts_processgroup_validate_test: make deps static" 2020-05-11 19:29:39 +00:00
Lorenzo Colitti 6d152b752c Merge "Simplify code that parses ifa_flags." am: cc39283883
Change-Id: I1b09a1d55de89bc3324c455adb23978be288b12e
2020-05-11 15:43:32 +00:00
Lorenzo Colitti cc39283883 Merge "Simplify code that parses ifa_flags." 2020-05-11 15:34:10 +00:00
Tom Cherry 64e9016351 logd: separate LogStatistics from LogBuffer
LogStatistics is intertwined with LogBuffer, even relying on it for
thread safety.  This needs to change to have a proper
LogBufferInterface, so this CL separates them.  Specifically:

1) Adding a lock to LogStatistics and adding thread annotations to
   ensure that data structures are protected appropriately.
2) Moving prune_rows calculation into LogStatistics so it is done
   while holding this lock.
3) Using LogStatistics instead of LogBuffer where appropriate.

Note that there should not be a significant performance regression
with this lock, as it will almost always been uncontended.  If
anything, it should alleviate pressure from LogBuffer's lock.

Test: logging unit tests
Change-Id: I9d6dde2c96c9f024fa0341711c7bc63379e8e406
2020-05-11 07:55:52 -07:00
Tom Cherry b6b78e9bb4 logd: remove LogFindWorst
LogStatistics relies on LogBuffer's lock for thread safety, but that
will be cleaned up in future CLs.  It won't be possible to return a
'LogFindWorst' object that references internal LogStatistics pointers
in a thread safe way, so we remove this and provide a more simple
interface.

This also removes unnecessary allocations; std::array of 2 or 32
entries is small enough to allocate on the stack.

Test: logging unit tests
Change-Id: I38bfcba5b08c640ffd3af5c078bc716688f6edf8
2020-05-11 07:54:34 -07:00
Lorenzo Colitti 077d1ea61b Simplify code that parses ifa_flags.
When parsing an RTM_NEWADDR or RTM_DELADDR, ifaddr is always
present (unless the message is invalid). So ifaddr->ifa_flags is
always known before any attributes are parsed.

Bug: 155005831
Test: atest NetworkStackNextIntegrationTests:IpClientIntegrationTest continues to apss
Change-Id: Id1998faccca7d81c1b7f3e85e4912aa22919e94a
2020-05-11 22:33:27 +09:00
Treehugger Robot fb2ff0d5a7 Merge changes I57cb2003,I569d2b81,I01a10e36 am: 6153b71aea
Change-Id: Ifbb5f5767f3277d5cc594bde57528b7760b8ae03
2020-05-10 17:58:09 +00:00
Treehugger Robot 6153b71aea Merge changes I57cb2003,I569d2b81,I01a10e36
* changes:
  libnetutils/packet.c - create socket with close-on-exec
  libnetutils/packet.c - fix a raw socket reception race
  libnetutils/packet.c - fix a socket leak on bind error
2020-05-10 17:29:35 +00:00
Lorenzo Colitti 9f9bd9b3a6 Merge "Parse IFA_F_* values above 0x80." am: b7dd29354f
Change-Id: I4d09aba3c71dff620f0f8873bfc5c413bb7e2919
2020-05-10 05:42:15 +00:00
Lorenzo Colitti b7dd29354f Merge "Parse IFA_F_* values above 0x80." 2020-05-10 05:29:59 +00:00
Lorenzo Colitti 096fc5351f Parse IFA_F_* values above 0x80.
In RTM_NEWADDR messages, the first 8 flags are reported in the
ifa_flags field in struct ifaddrmsg, but flags above 0x80 are
reported in the IFA_FLAGS attribute. NetlinkEvent currently only
looks at ifa_flags, so it cannot see higher-value flags such as
IFA_F_STABLE_PRIVACY. Fix this by parsing the IFA_FLAGS
attribute.

Bug: 155005831
Test: makes new test in aosp/1295495 pass
Change-Id: I723f1106cbcea2186fc6452305942a0f8301fd2a
2020-05-10 11:36:59 +09:00
Maciej Żenczykowski 39c26d63cd libnetutils/packet.c - create socket with close-on-exec
This prevents fork/exec leaking sockets to child processes.

Test: builds, atest
Bug: 155297277
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I57cb2003dd75b0bc5528978fd131730273e37a43
2020-05-08 22:34:37 -07:00
Maciej Żenczykowski 0129aaae86 libnetutils/packet.c - fix a raw socket reception race
A socket created bound to a specific protocol can receive packets before
it's bound to a specific interface/mac.

It's best to rely on the bind().

This replicates the way packet sockets are created in external/android-clat.
See: ring.c ring_create() and clatd.c configure_packet_socket()

Test: builds, atest
Bug: 155297277
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I569d2b81a396f352ab5d1b71bd5ad0d96217aab1
2020-05-08 22:34:37 -07:00
Maciej Żenczykowski b7f370c014 libnetutils/packet.c - fix a socket leak on bind error
and clean up the code a little bit while at it.

Test: builds, atest
Bug: 155297277
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I01a10e36f852cde1b93a91f95b51294a434885ab
2020-05-08 22:34:37 -07:00
Christopher Ferris 6cf64c1218 Merge "Fix mac build." am: 5445c73012
Change-Id: I3ba84fb777d5de85970708aa564569296f0ebe20
2020-05-09 05:04:14 +00:00
Christopher Ferris 5445c73012 Merge "Fix mac build." 2020-05-09 04:49:07 +00:00
Woody Lin 30820014a5 Merge "InitFatalReboot: Trigger panic explicitly for init_fatal_panic" am: c5f0640e48
Change-Id: I669fd71b1aa8e948fd35872e10ff5ee35b340653
2020-05-09 02:03:41 +00:00
Woody Lin c5f0640e48 Merge "InitFatalReboot: Trigger panic explicitly for init_fatal_panic" 2020-05-09 01:51:04 +00:00
Greg Kaiser 168940f51a [DO NOT MERGE] Revert "Make libstatssocket a shared_lib"
This reverts commit 29512fbf70.

Specifically, we're reverting
https://googleplex-android-review.git.corp.google.com/c/platform/system/core/+/11419425/-1..1

Test: Local 'm -j71 out/soong/.intermediates/frameworks/base/tools/stats_log_api_gen/libstatslog/android_arm64_armv8-a_shared_com.android.bluetooth.updatable/unstripped/libstatslog.so'
Bug: 156091657
Change-Id: I79b4206beaa162078c76f9323a061923ec6ca0c6
2020-05-08 16:34:28 -07:00
Christopher Ferris 8a6dff22dc Fix mac build.
Add an inline for mmap64 to use on mac.

Bug: 156053599

Test: Builds.
Change-Id: Id02e2c2f40acea2bdef604e9b80b70a85a941927
2020-05-08 15:30:21 -07:00
Peter Collingbourne 3a52bfc30d Merge "Add stack trace coverage to MTE tests." am: 5d97966e8f
Change-Id: If3c9875007636362220295a90aeb4d7ac82b5492
2020-05-08 19:51:38 +00:00
Peter Collingbourne 5d97966e8f Merge "Add stack trace coverage to MTE tests." 2020-05-08 19:37:07 +00:00
Woody Lin be1cf9006a InitFatalReboot: Trigger panic explicitly for init_fatal_panic
The exit of init panics the system *after* process context (mm, stack,
...etc.) are recycled, according to Linux kernel's 'do_exit'
implementation. To preserve most init process context for debugging,
triggers the panic via proc-sysrq explicitly.

Note: after this change, there will be no "Attempt to kill init" panic
when androidboot.init_fatal_panic is set.

Test: Insert data abort fault in init, the full process context is
      preserved in memory dump captured after panic.
Bug: 155940351
Change-Id: I3393bd00f99b8cb432cfa19a105b7d636b411764
2020-05-09 01:30:32 +08:00
Peter Collingbourne bbe6905d7e Add stack trace coverage to MTE tests.
It's impractical to test the contents of the stack trace, but we
should at least test that *a* stack trace is present, which would
have caught the bug fixed by r.android.com/1306754 .

Bug: 135772972
Change-Id: Ic5e0b997caa53c7eeec4e5185df5c043c9d4fe3d
2020-05-08 10:14:47 -07:00
Jiyong Park 8dd4ad9889 [automerger skipped] Merge "Revert "Make libstatssocket a shared_lib"" am: d427b54c53 -s ours
am skip reason: Change-Id I5889dd718536f5f2c693b4c2e7331c9cc2eb2ac9 with SHA-1 29512fbf70 is in history

Change-Id: I19b778df1b3d9bea7ac61a5ebf3d357e88f0f930
2020-05-08 08:22:46 +00:00