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
* 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.
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
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
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
* 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
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
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
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
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
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
am skip reason: Change-Id I5889dd718536f5f2c693b4c2e7331c9cc2eb2ac9 with SHA-1 29512fbf70 is in history
Change-Id: I19b778df1b3d9bea7ac61a5ebf3d357e88f0f930