crash on debian i386 in krb5_plugin_register(hdb_samba4_interface) (Re: waf, PYTHONHASHSEED & -I order on other architectures)

Stefan Metzmacher metze at samba.org
Tue May 10 16:48:46 UTC 2022


Hi Michael,

> As I already wrote in another email, it is not "just" the link order.
> Well, it is, but sometimes it even produces an executable (or a library)
> which starts but crashes later.  We have such a broken build of samba in
> debian i386 stable right now.

Today I found a crash problem on i386 in:

         ret = krb5_plugin_register(kdc->smb_krb5_context->krb5_context,
                                    PLUGIN_TYPE_DATA, "hdb_samba4_interface",
                                    &hdb_samba4_interface);

This is because krb5_plugin_register => heim_plugin_register casts:

struct hdb_method {
     int                 version;
     unsigned int        is_file_based:1;
     unsigned int        can_taste:1;
     krb5_error_code     (*init)(krb5_context, void **);
     void                (*fini)(void *);
     const char *prefix;
     krb5_error_code (*create)(krb5_context, HDB **, const char *filename);
};

into:

struct heim_plugin_common_ftable_desc {
     int                 version;
     int                 (HEIM_LIB_CALL *init)(heim_pcontext, void **);
     void                (HEIM_LIB_CALL *fini)(void *);
};

This seems to work on x86_64 as we have 4 padding bytes after 'int version',
so that the 'init' function pointer is at offset 8.

But on i386 hdb_method has 'init' at offset 8 while
heim_plugin_common_ftable_desc has it at offset 4.

So is_file_based and can_tast need to move behind the 'fini' function
pointer.

Is that the crash you are seeing?

metze



More information about the samba-technical mailing list