예제 #1
0
        internal override void SetNoDump(IntPtr protectedMemory, ulong length)
        {
            Check.IntPtr(protectedMemory, "SetNoDump");
            if (length == 0)
            {
                throw new Exception("SetNoDump: Invalid length");
            }

            // Calculate the 4KB page aligned pointer for madvise
            long addr = protectedMemory.ToInt64();

            if (addr % pageSize != 0)
            {
                addr -= addr % pageSize;
            }

            IntPtr pagePointer = new IntPtr(addr);

            // Enable selective core dump avoidance
            Check.Zero(libc.madvise(pagePointer, length, (int)Madvice.MADV_DONTDUMP), $"madvise({protectedMemory}, {length}, MADV_DONTDUMP)");
        }
예제 #2
0
 internal override void SetNoDump(IntPtr protectedMemory, ulong length)
 {
     // Enable selective core dump avoidance
     CheckZero(libc.madvise(protectedMemory, length, (int)Madvice.MADV_DONTDUMP), "madvise(MADV_DONTDUMP)");
 }