diff options
| author | 2024-12-17 13:34:18 +1100 | |
|---|---|---|
| committer | 2025-01-10 10:50:54 +1100 | |
| commit | af03d58a713306a4a51a1c5b2f9a4a8acb401c79 (patch) | |
| tree | 16f59d574a5f20fb45f47121adbd4c1b1ee3aa8f /libs/androidfw/AssetsProvider.cpp | |
| parent | 4fff241a78a4120c4eee6da675e82fa13c38c422 (diff) | |
Refactor SelinuxAuditLogsCollector to avoid OOM
SelinuxAuditLogsCollector relies on EventLog.readEvents to access the
log messages. This method expects a Collection<Event> to store the
events read. Previously, this was stored in a temporary ArrayList and
Queue. This led to OOM errors if the log contained a large amount of
denials.
Define a new nested class EventLogCollection which implements
Collection<Event>. The event is processed when "added" to the collection
(that is, it is forwarded to FrameworkStatsLog.write directly).
A side effect of this design is that events are processed from the
oldest to the newest (previously, it was the opposite).
QuotaExceededException and InterruptedException are raised internally to
signal to collect() the status of the processing.
Bug: 379252691
Flag: EXEMPT bugfix
Test: atest SelinuxFrameworksTests
Change-Id: Ia3333c9b4e783f19fa266c4ecc9c01c63009569c
Diffstat (limited to 'libs/androidfw/AssetsProvider.cpp')
0 files changed, 0 insertions, 0 deletions