comsec-group/blacksmith

blacksmith doesnt work : /mnt/huge/buff not found

AnaMazda opened this issue · 3 comments

after running blacksmith with default param as mentioned in the description, it stopped immediately with the following erreur in the logfile :

`
[+] General information about this fuzzing run:
Start timestamp:: 1637072011
Hostname: 1cc27a1cdb50
Commit SHA: c8e65b7
Run time limit: 120 (0 hours 2 minutes 0 seconds)
[+] Printing run configuration (GlobalDefines.hpp):
DRAMA_ROUNDS: 1000
CACHELINE_SIZE: 64
HAMMER_ROUNDS: 1000000
THRESH: 495
NUM_TARGETS: 10
MAX_ROWS: 30
NUM_BANKS: 16
DIMM: 1
CHANNEL: 1
MEM_SIZE: 1073741824
PAGE_SIZE: 4096

[-] Instruction setpriority failed.
[+] Could not mount superpage from /mnt/huge/buff. Error:
`

I fixed this issue by creating the /mnt/huge (mkdir /mnt/huge) directory by myself. Not sure if it is the correct workaround.

Hi @AnaMazda,
Additionally to what @T-TROUCHKINE suggested, you also need to enable 1GB super pages in your system.

METHOD 1: The proper way of doing this would be to enable super pages in the GRUB configuration (recommended) by adding following params to GRUB_CMDLINE_LINUX in /etc/default/grub:

GRUB_CMDLINE_LINUX="default_hugepagesz=1G hugepagesz=1G hugepages=1"

After that, you need to run sudo update-grub and reboot the system.

METHOD 2: Alternatively, you could try to just temporarily enable 1GB super pages (i.e., settings will be reverted after a reboot). However, if your system memory is very full and there is no 1GB of contiguous memory available, this might not work. You can try it immediately after a reboot to increase your chances.

Here a ready-to-run Bash script that should do the job:

#!/bin/bash

gbFile="/sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages"
mkdir -p /mnt/huge
mount -t hugetlbfs  -o pagesize=1G,size=1G none /mnt/huge
echo 1 | sudo tee $gbFile 
cat $gbFile

We would appreciate your brief feedback or 👍🏼 . Thanks!

Regards,
Patrick

thanks @pjattke and @T-TROUCHKINE for your help