On 2024-03-05 1:13 am, matthew green wrote:
ah.  the problem is that struct isc_nmhandle grew a pointer member,
adding 4 bytes to the struct size, and it uses C99 [] variable array
for the final member, which is later assigned to other pointers, and
this memory was now only 4-byte aligned.  this hack patch works to
stop named crashing for me, but i'll let christos figure out what the
right general solution here is.


.mrg.


Index: lib/isc/netmgr/netmgr-int.h
===================================================================
RCS file: /cvsroot/src/external/mpl/bind/dist/lib/isc/netmgr/netmgr-int.h,v
retrieving revision 1.8.2.1
diff -p -u -r1.8.2.1 netmgr-int.h
--- lib/isc/netmgr/netmgr-int.h 25 Feb 2024 15:47:24 -0000      1.8.2.1
+++ lib/isc/netmgr/netmgr-int.h 5 Mar 2024 06:12:50 -0000
@@ -276,7 +276,7 @@ struct isc_nmhandle {
        LINK(isc_nmhandle_t) active_link;
 #endif
        void *opaque;
-       char extra[];
+       char extra[] __attribute__((__aligned__(8)));
 };

 typedef enum isc__netievent_type {

Perhaps:
        union {
                void *p;
                long double d;
                long long lld;
                intmax_t im;
        } extra[];

Or simpler:
        struct {
                void *p;
        } extra[];

Does the second form work?

christos

Reply via email to