Add overflow protection for network stats maps

Since we moved both uid stats and uid tag stats to the same map now. It
is possible for apps to create as many tags as possible to overflow the
uid tag stats map. To prevent that, add a check when tagging a socket,
and start to block request when a uid created to many entries in the
stats map.

Bug: 111441138
Test: android.app.usage.cts.NetworkUsageStatsTest
      android.net.cts.TrafficStatsTest

Change-Id: I11f42ffc83efc917ac0871a0326375031ae0a6e0
Merged-In: I11f42ffc83efc917ac0871a0326375031ae0a6e0
(cherry picked from commit 873ae1491d9ea8a6084ffe6816658cc4c27e22b1)
2 files changed