Fix the bug and add tls cleanup in that netlink
Summary
1.Fix the bug that netlink receive wait does not hang up 2.add tls cleanup protection to protect waitsem in netlink_get_response
Impact
netlink
Testing
Manual verification
@wangchen61698 please fix the issue:
netlink/netlink_conn.c: In function 'netlink_get_response':
Error: netlink/netlink_conn.c:535:11: error: implicit declaration of function 'tls_cleanup_push' [-Werror=implicit-function-declaration]
535 | tls_cleanup_push(tls_get_info(), netlink_notifier_teardown, conn);
| ^~~~~~~~~~~~~~~~
Error: netlink/netlink_conn.c:537:11: error: implicit declaration of function 'tls_cleanup_pop' [-Werror=implicit-function-declaration]
537 | tls_cleanup_pop(tls_get_info(), 0);
| ^~~~~~~~~~~~~~~
@xiaoxiang781216 The life cycle of the socket should be managed with file descriptor. If an abnormal exit causes an exception, then the VFS needs to be further enhanced. If all subsystems depends on TLS when exiting, then the entire kernel will be surrounded by TLS. The implementation of the protocol stack should further learn from the Linux kernel instead of applying these ugly patches!
@xiaoxiang781216 The life cycle of the socket should be managed with file descriptor. If an abnormal exit causes an exception, then the VFS needs to be further enhanced. If all subsystems depends on TLS when exiting, then the entire kernel will be surrounded by TLS. The implementation of the protocol stack should further learn from the Linux kernel instead of applying these ugly patches!
@anchao but this is the resource allocated in the current stack frame, not the resource bind to the file descriptor. The different life cycle resource need clear up by different approach. tls_cleanup_push/tls_cleanup_pop is a standard method to clear up the stack resource: https://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_cleanup_push.html Do you have better suggestion?