secmem: fix potential memory visibility issue