2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 13:38:26 +00:00

Align CMSG buffers to a void* boundary, fixes crash on architectures with strict alignment

CHANGES entry
This commit is contained in:
Witold Kręcicki 2018-09-07 09:34:32 +02:00
parent a985badd34
commit 17212cf996
3 changed files with 11 additions and 2 deletions

View File

@ -1,3 +1,6 @@
5030. [bug] Align CMSG buffers to a 64-bit boundary, fixes crash
on architectures with strict alignment. [GL #521]
--- 9.13.3 released --- --- 9.13.3 released ---
5029. [func] Workarounds for servers that misbehave when queried 5029. [func] Workarounds for servers that misbehave when queried

View File

@ -259,6 +259,11 @@ extern void mock_assert(const int result, const char* const expression,
*/ */
#define TIME_NOW(tp) RUNTIME_CHECK(isc_time_now((tp)) == ISC_R_SUCCESS) #define TIME_NOW(tp) RUNTIME_CHECK(isc_time_now((tp)) == ISC_R_SUCCESS)
/*%
* Alignment
*/
#define ALIGN(x, a) (((x) + (a) - 1) & ~((typeof(x))(a)-1))
/*% /*%
* Misc * Misc
*/ */

View File

@ -315,8 +315,9 @@ typedef isc_event_t intev_t;
#define CMSG_SP_INT 24 #define CMSG_SP_INT 24
#define RECVCMSGBUFLEN (2*(CMSG_SP_IN6PKT + CMSG_SP_TIMESTAMP + CMSG_SP_TCTOS)+1) /* Align cmsg buffers to be safe on SPARC etc. */
#define SENDCMSGBUFLEN (2*(CMSG_SP_IN6PKT + CMSG_SP_INT + CMSG_SP_TCTOS)+1) #define RECVCMSGBUFLEN ALIGN(2*(CMSG_SP_IN6PKT + CMSG_SP_TIMESTAMP + CMSG_SP_TCTOS)+1, sizeof(void*))
#define SENDCMSGBUFLEN ALIGN(2*(CMSG_SP_IN6PKT + CMSG_SP_INT + CMSG_SP_TCTOS)+1, sizeof(void*))
/*% /*%
* The number of times a send operation is repeated if the result is EINTR. * The number of times a send operation is repeated if the result is EINTR.