Home GnuPG

Fix memory allocation when GCRYCTL_ENABLE_M_GUARD.

Description

Fix memory allocation when GCRYCTL_ENABLE_M_GUARD.

* configure.ac: Add check for ALIGNOF_LONG_DOUBLE.
* src/stdmem.c: Adjust EXTRA_ALIGN.
  • GnuPG-bug-id: T5822
  • Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>

Event Timeline

jukivili added inline comments.
/src/stdmem.c
65

Not sure if this get malloc alignment correct on all architectures. For example, align of long double on i386 is 4, but glibc documentation says that "The address of a block returned by malloc or realloc in GNU systems is always a multiple of eight (or sixteen on 64-bit systems)" (https://www.gnu.org/software/libc/manual/html_node/Aligned-Memory-Blocks.html).

/src/stdmem.c
65

Thank you for your comment.

I tried to improve the use_m_guard feature... but Werner suggested it is better to remove it, as we now have better tooling, like valgrind.