fchown DNS lookup sockets to UID of the app that sent the DNS lookup.

Currently DNS lookups are all sent as AID_DNS. A seperate UID of the
app that sent the DNS lookup allows us to account for and route DNS
traffic differently from AID_DNS.
Also, currently DNS over TLS lookups are all sent as UID 0.
A seperate UID(AID_DNS) allows us to account for and route DNS over
TLS traffic differently from other UID 0 traffic.

Bug: 132125333
Test: system/netd && atest resolv_integration_test

Change-Id: I47a8d41d2a9bfd9af44efe291b56b46c7da9c346
Signed-off-by: Sehee Park <sehee32.park@samsung.com>
diff --git a/res_init.cpp b/res_init.cpp
index bb86723..04ac3aa 100644
--- a/res_init.cpp
+++ b/res_init.cpp
@@ -313,6 +313,7 @@
                        android::net::NetworkDnsEventReported* _Nonnull event) {
     if (statp != NULL) {
         statp->netid = netcontext->dns_netid;
+        statp->uid = netcontext->uid;
         statp->_mark = netcontext->dns_mark;
         if (netcontext->flags & NET_CONTEXT_FLAG_USE_EDNS) {
             statp->options |= RES_USE_EDNS0 | RES_USE_DNSSEC;