Fix segfault due to bad munmap()
authorJens Axboe <axboe@fb.com>
Thu, 26 Feb 2015 22:38:42 +0000 (15:38 -0700)
committerJens Axboe <axboe@fb.com>
Thu, 26 Feb 2015 22:38:42 +0000 (15:38 -0700)
commit3d0e3417997d9caa27cf97462e15ba437d285d29
treea4c8fb1aae1b1db4b7ce938a22fbc87820072aab
parentde71b95eb99e07102b5059cac46c0d34bbfda907
Fix segfault due to bad munmap()

Bruce reports:

The latest code from git (built using clang) causes a segfault after printing the usage text when "./fio" is run:

[New LWP 100111]
No jobs(s) defined

fio-2.2.5-28-g93eeb
[usage text]
[New Thread 801c06400 (LWP 100111/fio)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 801c06400 (LWP 100111/fio)]
flist_empty (head=0x802000040) at flist.h:119
119             return head->next == head;
Current language:  auto; currently minimal
(gdb) p head
$1 = (const struct flist_head *) 0x802000040

which is due to a bug in the filelock code, that uses
fio_mutex_remove() to remove the mutex. But that mutex is embedded
inside another mmap'ed region, hence we then segfault on later
deferencing pointers.

Signed-off-by: Jens Axboe <axboe@fb.com>
filelock.c