Page MenuHomeFeedback Tracker

Linux dedicated server doesn't initialize some malloc()'ed memory
Closed, ResolvedPublic

Description

Hi everybody,

unfortunately, 1.18 brought in another obstacle on my way of using the Intel TBB allocators for the Linux dedicated server.

As already reported in http://feedback.arma3.com/view.php?id=18556 I managed to get LD_PRELOADing the Intel TBB allocators working with superb performance by inecting some machine code into the 1.16 arma3server binary.

Repeating the same with the memory addresses adjusted to the new 1.18 binary still resolves the segmentation fault, but another issue arises now.

After a while, arma3server with the Intel TBB allocators LD_PRELOADed prints
"Error context" + some garbage
on my console and "hangs".

After hours of debugging with gdb, I recognized that this happens due to the usage of some uninitialized memory obtained from malloc().
arma3server works "by luck" with glibc's malloc() implementation, but ceases to work with Intel TBB's implementation of malloc().

You can verify this by a simple method:
Before starting arma3server with nothing LD_PRELOADed (i.e. using plain glibc's malloc()), export the environment variable MALLOC_PERTURB_ to 192 (which is the binary complement of 0x3f, the ASCII code of a question mark).
This will fill every memory chunk returned by malloc() with question marks (c.f. man mallopt).
I attached the output of arma3server with $MALLOC_PERTURB_ set this way to this issue.
Note the line
error context + a bunch of question marks,
i.e. the "some garbage" mentioned above really turned into question marks.

This obviously is a different bug than the one in http://feedback.arma3.com/view.php?id=18556
However, they are closely related in that they both arise if one tries to LD_PRELOAD the Intel TBB allocators. It would be nice, if someone with the appropriate privileges could link them here. {F23892}

Details

Legacy ID
2856713259
Severity
None
Resolution
Open
Reproducibility
Always
Category
Dedicated Server
Steps To Reproduce

MALLOC_PERTURB_=192 ./arma3server

Event Timeline

nics edited Steps To Reproduce. (Show Details)May 3 2014, 12:41 PM
nics edited Additional Information. (Show Details)
nics set Category to Dedicated Server.
nics set Reproducibility to Always.
nics set Severity to None.
nics set Resolution to Open.
nics set Legacy ID to 2856713259.May 7 2016, 6:33 PM
nics edited a custom field.
Bohemia added a subscriber: nics.May 3 2014, 12:41 PM
k0rd added a subscriber: k0rd.May 7 2016, 6:33 PM
k0rd added a comment.May 5 2014, 2:30 PM

TIL about MALLOC_PERTURB_ - gotta say the last 12 hours have been life-changing :)

dedmen closed this task as Resolved.May 18 2020, 11:33 AM
dedmen claimed this task.