memset() writes in bytes, not bits, obviously. So change 1 => 0xff to set all the bits in the I/O permission bitmap to 1.