[DRBD-user] DRBD 8.4.1: drbdadm crashes with glibc MALLOC_CHECK_

BRESTAN Rainer Rainer.Brestan at frequentis.com
Thu Jul 12 11:26:30 CEST 2012

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.


Using drbdadm with environment variable MALLOC_CHECK_ set to not zero result in segmentation fault.

Reason is the handling of most free operations in drbdadm_main.c, notably in functions free_config, free_host_info and maybe some other more.

Example: function free_host_info
        for_each_volume(vol, hi->volumes)
                free_volume(vol);

Function free_volume call as last libc function free(vol), which instructs libc in case of MALLOC_CHECK_ not zero to initialize memory with 0xcc. The macro for_each_volume take vol->next (which is now 0xcccccccc) as next vol and calls free_volume again which try to free the memory and this cause the segmentation fault.

Example of correct behaviour is function free_options, which temporary stores the next element before freeing it.

There is currently no race condition in free before next, because this part is not multi threaded.

Questions:
Is there a specific reason for doing that (DRBD 8.3.11 works fine with MALLOC_CHECK_) in DRBD 8.4.1 ?
Is it planned or a bug ?
Patch ?

Rainer




More information about the drbd-user mailing list