[Gluster-devel] mem-pool.c magic trailer causes SIGBUS, fix or remove?

Paul Jakma paul at jakma.org
Tue Jul 27 14:14:51 UTC 2021


The magic trailer added at the end of memory allocations in mem-pool.c 
doesn't have its alignment ensured. This can lead to SIGBUS and 
abnormal exits on some platforms (e.g., SPARC64).

I have a patch to round-up the header and allocation size to get the 
right alignment for the trailer (I think).

It does complicate the memory allocation a little further.

Question is whether it would just be simpler to remove the trailer, and 
simplify the code?

There are a number of external tools that exist to debug memory allocs, 
from runtime loadable debug malloc libraries, to compiler features 
(ASAN, etc.), to valgrind.

Glusterfs could just rely on those, and so simplify and (perhaps) 
speed-up its own, general-case memory code.

Remove the trailer? Or fix it?

Paul Jakma | paul at jakma.org | @pjakma | Key ID: 0xD86BF79464A2FF6A
Many people are secretly interested in life.

More information about the Gluster-devel mailing list