bind9/lib/isccc
Mark Andrews d5103b742b
Defer control channel message invalidation
The conn_shutdown() function is called whenever a control channel
connection is supposed to be closed, e.g. after a response to the client
is sent or when named is being shut down.  That function calls
isccc_ccmsg_invalidate(), which resets the magic number in the structure
holding the messages exchanged over a given control channel connection
(isccc_ccmsg_t).  The expectation here is that all operations related to
the given control channel connection will have been completed by the
time the connection needs to be shut down.

However, if named shutdown is initiated while a control channel message
is still in flight, some netmgr callbacks might still be pending when
conn_shutdown() is called and isccc_ccmsg_t invalidated.  This causes
the REQUIRE assertion checking the magic number in ccmsg_senddone() to
fail when the latter function is eventually called, resulting in a
crash.

Fix by splitting up isccc_ccmsg_invalidate() into two separate
functions:

  - isccc_ccmsg_disconnect(), which initiates TCP connection shutdown,
  - isccc_ccmsg_invalidate(), which cleans up magic number and buffer,

and then:

  - replacing all existing uses of isccc_ccmsg_invalidate() with calls
    to isccc_ccmsg_disconnect(),

  - only calling isccc_ccmsg_invalidate() when all netmgr callbacks are
    guaranteed to have been run.

Adjust function comments accordingly.
2024-01-10 15:48:25 +01:00
..
include Defer control channel message invalidation 2024-01-10 15:48:25 +01:00
alist.c Remove do-nothing header <isc/print.h> 2023-02-15 16:44:47 +00:00
base64.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
cc.c NetBSD has added 'hmac' to libc so rename out uses of hmac 2023-12-13 22:27:38 +00:00
ccmsg.c Defer control channel message invalidation 2024-01-10 15:48:25 +01:00
Makefile.am remove isc_task completely 2023-02-16 18:35:32 +01:00
sexpr.c Remove do-nothing header <isc/print.h> 2023-02-15 16:44:47 +00:00
symtab.c Do extra manual isc_mem_cget() conversions 2023-08-31 22:08:35 +02:00