Untag and stop watch on network sockets before closing them.

This patch untags the network sockets tagged with qtaguid_tagSocket()
before closing them, releasing the socket from the qtaguid kernel
module. Without this patch, the socket won't be actually closed.

This patch also removes the socket watch right before closing it, which
forces the epoll to stop watching. Closing the file descriptor would
also stop the watch if no other copy of the socket is kept open.
Explicitly stoping the watch is safer.

Bug: 36264049
Test: Ran update_engine under strace; the /proc/net/xt_qtaguid/ctrl
is called and the socket object destroyed and removed from the epoll.

Change-Id: I75c8befe8929e8e60c9534e0e4072f63b2fab1f4
2 files changed
tree: c64964d8a24b9598909868d50de8b9228487a1a5
  1. .gitignore
  2. Android.mk
  3. MODULE_LICENSE_APACHE2
  4. NOTICE
  5. OWNERS
  6. PRESUBMIT.cfg
  7. PREUPLOAD.cfg
  8. UpdateEngine.conf
  9. WATCHLISTS
  10. binder_bindings/
  11. binder_service_android.cc
  12. binder_service_android.h
  13. binder_service_brillo.cc
  14. binder_service_brillo.h
  15. boot_control_android.cc
  16. boot_control_android.h
  17. boot_control_chromeos.cc
  18. boot_control_chromeos.h
  19. boot_control_chromeos_unittest.cc
  20. boot_control_recovery.cc
  21. boot_control_recovery.h
  22. boot_control_recovery_stub.cc
  23. certificate_checker.cc
  24. certificate_checker.h
  25. certificate_checker_unittest.cc
  26. chrome_browser_proxy_resolver.cc
  27. chrome_browser_proxy_resolver.h
  28. chrome_browser_proxy_resolver_unittest.cc
  29. client_library/
  30. common/
  31. common_service.cc
  32. common_service.h
  33. common_service_unittest.cc
  34. connection_manager.cc
  35. connection_manager.h
  36. connection_manager_android.cc
  37. connection_manager_android.h
  38. connection_manager_interface.h
  39. connection_manager_unittest.cc
  40. connection_utils.cc
  41. connection_utils.h
  42. daemon.cc
  43. daemon.h
  44. daemon_state_android.cc
  45. daemon_state_android.h
  46. daemon_state_interface.h
  47. dbus_bindings/
  48. dbus_connection.cc
  49. dbus_connection.h
  50. dbus_service.cc
  51. dbus_service.h
  52. dbus_test_utils.h
  53. fake_file_writer.h
  54. fake_p2p_manager.h
  55. fake_p2p_manager_configuration.h
  56. fake_shill_proxy.cc
  57. fake_shill_proxy.h
  58. fake_system_state.cc
  59. fake_system_state.h
  60. generate_pc_file.sh
  61. hardware_android.cc
  62. hardware_android.h
  63. hardware_chromeos.cc
  64. hardware_chromeos.h
  65. hardware_chromeos_unittest.cc
  66. image_properties.h
  67. image_properties_android.cc
  68. image_properties_chromeos.cc
  69. image_properties_chromeos_unittest.cc
  70. init/
  71. libcros_proxy.cc
  72. libcros_proxy.h
  73. libcurl_http_fetcher.cc
  74. libcurl_http_fetcher.h
  75. libupdate_engine-client-test.pc.in
  76. libupdate_engine-client.pc.in
  77. local_coverage_rate
  78. main.cc
  79. metrics.cc
  80. metrics.h
  81. metrics_utils.cc
  82. metrics_utils.h
  83. metrics_utils_unittest.cc
  84. mock_certificate_checker.h
  85. mock_connection_manager.h
  86. mock_file_writer.h
  87. mock_omaha_request_params.h
  88. mock_p2p_manager.h
  89. mock_payload_state.h
  90. mock_power_manager.h
  91. mock_proxy_resolver.h
  92. mock_update_attempter.h
  93. network_selector.h
  94. network_selector_android.cc
  95. network_selector_android.h
  96. network_selector_interface.h
  97. network_selector_stub.cc
  98. network_selector_stub.h
  99. omaha_request_action.cc
  100. omaha_request_action.h
  101. omaha_request_action_unittest.cc
  102. omaha_request_params.cc
  103. omaha_request_params.h
  104. omaha_request_params_unittest.cc
  105. omaha_response.h
  106. omaha_response_handler_action.cc
  107. omaha_response_handler_action.h
  108. omaha_response_handler_action_unittest.cc
  109. omaha_utils.cc
  110. omaha_utils.h
  111. omaha_utils_unittest.cc
  112. p2p_manager.cc
  113. p2p_manager.h
  114. p2p_manager_unittest.cc
  115. parcelable_update_engine_status.cc
  116. parcelable_update_engine_status.h
  117. payload_consumer/
  118. payload_generator/
  119. payload_state.cc
  120. payload_state.h
  121. payload_state_interface.h
  122. payload_state_unittest.cc
  123. power_manager_android.cc
  124. power_manager_android.h
  125. power_manager_chromeos.cc
  126. power_manager_chromeos.h
  127. power_manager_interface.h
  128. proxy_resolver.cc
  129. proxy_resolver.h
  130. proxy_resolver_unittest.cc
  131. real_system_state.cc
  132. real_system_state.h
  133. run_unittests
  134. sample_images/
  135. sample_omaha_v3_response.xml
  136. scripts/
  137. service_delegate_android_interface.h
  138. service_observer_interface.h
  139. shill_proxy.cc
  140. shill_proxy.h
  141. shill_proxy_interface.h
  142. sideload_main.cc
  143. system_state.h
  144. tar_bunzip2.gypi
  145. test_http_server.cc
  146. test_subprocess.cc
  147. testrunner.cc
  148. unittest_key.pem
  149. unittest_key2.pem
  150. update_attempter.cc
  151. update_attempter.h
  152. update_attempter_android.cc
  153. update_attempter_android.h
  154. update_attempter_unittest.cc
  155. update_engine-client.gyp
  156. update_engine.conf
  157. update_engine.gyp
  158. update_engine.rc
  159. update_engine_client.cc
  160. update_engine_client_android.cc
  161. update_manager/
  162. update_metadata.proto
  163. update_payload_key/
  164. update_status_utils.cc
  165. update_status_utils.h
  166. utils_android.cc
  167. utils_android.h
  168. weave_service.cc
  169. weave_service.h
  170. weave_service_factory.cc
  171. weave_service_factory.h
  172. weave_service_interface.h
  173. weaved/