Update qtaguid tag/untag documentation.

The qtaguid_tagSocket() function tags a network socket by passing a
reference to the given socket to the qtaguid kernel module. The module
will keep the socket alive even if the process calls close() on said
socket. In this scenario, the socket object would not be destroyed
even if all the file descriptor.

While this is at least a memory leak, it plays bad with epoll(7)
if you also didn't remove the socket from the epoll fd before closing
since epoll will not notice that the socket was closed and there is no
way to remove the socket from epoll after it was closed.

This patch updates the documentation to explicitly mention that the
socket must be untag before closing or bad things happen.

Bug: 36264049
Test: None.
Change-Id: I564a9b6d11d22b43a6c12312524386c0338b42ed
This commit is contained in:
Alex Deymo 2017-03-16 19:15:27 -07:00
parent e323976e74
commit 4822b01b12
1 changed files with 5 additions and 3 deletions

View File

@ -26,13 +26,15 @@ extern "C" {
#endif
/*
* Set tags (and owning UIDs) for network sockets.
*/
* Set tags (and owning UIDs) for network sockets. The socket must be untagged
* by calling qtaguid_untagSocket() before closing it, otherwise the qtaguid
* module will keep a reference to it even after close.
*/
extern int qtaguid_tagSocket(int sockfd, int tag, uid_t uid);
/*
* Untag a network socket before closing.
*/
*/
extern int qtaguid_untagSocket(int sockfd);
/*