Description

I am creating a module that uses a 3rd party library(wolfSSL), that depending on build flags,
requires alignment of memory blocks to be the same as malloc, i.e., 16 bytes on gcc/AMD64.

It seems that shm_malloc returns memory aligned to 8 bytes.

Since system malloc always returns 16-byte aligned memory, it might be good to match that
behaviour in shm_malloc in case future kamailio modules use libraries that expect this.

Expected behavior

shm_malloc returns memory aligned on __alignof__(_max_align_t) == 16

Actual observed behavior

shm_malloc returns blocks aligned on 8-bytes

Debugging Data

When allocating *SSL_CTX and *SSL structs by tls module they occassionally will
have 8 byte (and not necessarily 16-byte) alignments. OpenSSL does not require 16-byte alignments
but wolfSSL requires 16-byte alignments.

Possible Solutions

Additional Information

The default ./configure build of wolfSSL has structs that require 16-byte alignment.
wolfSSL library has a configure flag --enable-aligndata=no that relaxes this requirement.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <kamailio/kamailio/issues/3157@github.com>