mmap: Invalid argument
AnaMazda opened this issue · comments
after installing blacksmith successfully and setting up the hugepage to 1 GB I tested the following :
sudo ./blacksmith --dimm-id 1 --runtime-limit 120 --ranks 1
and i get this error message: mmap: Invalid argument
how can I check if my --dimm-id is valid or not? I think its the argument that creates this issue!
my OS : Linux ubuntu 5.11.0-27-generic 64-bit
Hi @AnaMazda
See the README regarding the dimm-id
parameter:
[...] we can run Blacksmith in fuzzing mode by passing a random DIMM ID (e.g., --dimm-id 1; only used internally for logging into stdout.log)
That said, dimm-id
does not affect anything except for the logged output ing stdout.log
.
I would suggest playing with the parameters we pass to mmap
(see Memory.cpp):
- Try replacing
MAP_SHARED
byMAP_PRIVATE
- Try removing
MAP_ANONYMOUS
Does anything of that make the program work? Do you get by chance any compilation errors/warnings?
its compiled without any errors/warnings but the same issue still.
Are you running Blacksmith on a native host (i.e., no VM or similar)? Are you compiling Blacksmith with gcc-8/g++-8?
I'm sorry but it's hard to tell what's the issue as I cannot reproduce it on any of our systems. Please consult Google or StackOverflow for general advice on mmap
. A few more things you could try:
- You could post the synopsis section of
man mmap
so I can compare if anything of the interface changed (what I wouldn't expect though). - Try to change the other call parameters of our call to
mmap
too:- What happens if you change the
start_address
in Memory.hpp? You could also try with just passingNULL
to this parameter. - Does a smaller allocation (changing
MEM_SIZE
) succeed?
- What happens if you change the
- You could try to add
-ggdb3
to the targetsbs
andblacksmith
inCMakeLists.txt
and then run blacksmith via gdb, e.g.:sudo gdb --args ./blacksmith --dimm-id 0 --runtime-limit 120 --ranks 1
Please note that besides this issue you will also need to update the DRAM address function if you are not using an i7-8700K (probably, others of the same u-arch "Coffee Lake" would also work). Otherwise Blacksmith won't know how to address rows in order to hammer them.
yes I'm using VMware !!
mmap synopsis
SYNOPSIS
#include <sys/mman.h>
void *mmap(void *addr, size_t length, int prot, int flags,
int fd, off_t offset);
int munmap(void *addr, size_t length);
We haven't tested Blacksmith in a VM yet. But you probably have the issue described in this SO post: invalid argument in mmap.
Feel free to make the required changes and submit a PR. We would be happy to incorporate the required changes. Thanks!