comsec-group/blacksmith

Blacksmith not running: mmap: Cannot allocate memory

T-TROUCHKINE opened this issue · 5 comments

Hello,

I wanted to try your fuzzer on various computers but I always end up with the mmap: Cannot allocate memory error.
I thought this would come from my configuration so I tried to increase the number of available huge pages.

I currently have the following memory configuration regarding huge pages:

▶ cat /proc/meminfo|grep Huge                         
AnonHugePages:         0 kB
ShmemHugePages:        0 kB
FileHugePages:         0 kB
HugePages_Total:     535
HugePages_Free:      535
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
Hugetlb:         1095680 kB

On other devices I could even reach more than 1000 free huge pages, which I believe is enough for allocating 1GB of memory with huge pages. However the issue seems to come from somewhere else.
I tried the execution on two different devices with ArchLinux, Debian 11 and Ubuntu 18.04 LTS with no success.

Am I missing something ?

Similar issue here.

Update: on my Ubuntu 18 system the default hugepage directory was /dev/hugepages. (mount |grep huge). I edited the hard coded directory in code to point here. Also configured the system with 1000 huge pages. This seemed to get me past the this mmap error.

I did notice that the mmap command is specifying 1gb huge page size, while it was set to 2mb on my machine. I am going to assume 1gb huge page size is required but would appreciate guidance.

Update 2:
Set huge page size to 1gb by editing etc/default/grub and reboot. Now hammering with no errors 🔨🚀

HxJi commented

The huge page size adjustment works for me. Thanks @joe-desimone . Btw, do you meet the illegal instruction issue after solving this problem?

mmap: Invalid argument
anyone has the same issue

I confirm that the page size adjustment worked for me aswell.

Add GRUB_CMDLINE_LINUX="hugepagesz=1G hugepages=1 default_hugepagesz=1G" in /etc/default/grub
Then you can run update-grub and reboot.

@AnaMazda Please open a new issue for the mmap problem. Also state details about your system (for example, you will encounter your described issue on macOS).