Re: Is MADV_HWPOISON supposed to work only on faulted-in pages?
From: Naoya Horiguchi <hidden>
Date: 2017-02-20 05:03:47
Also in:
ltp
On Tue, Feb 14, 2017 at 04:41:29PM +0100, Jan Stancek wrote:
Hi, code below (and LTP madvise07 [1]) doesn't produce SIGBUS, unless I touch/prefault page before call to madvise(). Is this expected behavior?
Thank you for reporting. madvise(MADV_HWPOISON) triggers page fault when called on the address over which no page is faulted-in, so I think that SIGBUS should be called in such case. But it seems that memory error handler considers such a page as "reserved kernel page" and recovery action fails (see below.) [ 383.371372] Injecting memory failure for page 0x1f10 at 0x7efcdc569000 [ 383.375678] Memory failure: 0x1f10: reserved kernel page still referenced by 1 users [ 383.377570] Memory failure: 0x1f10: recovery action for reserved kernel page: Failed I'm not sure how/when this behavior was introduced, so I try to understand. IMO, the test code below looks valid to me, so no need to change. Thanks, Naoya Horiguchi
Thanks, Jan [1] https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/syscalls/madvise/madvise07.c -------------------- 8< -------------------- #include <stdlib.h> #include <sys/mman.h> #include <unistd.h> int main(void) { void *mem = mmap(NULL, getpagesize(), PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE /*| MAP_POPULATE*/, -1, 0); if (mem == MAP_FAILED) exit(1); if (madvise(mem, getpagesize(), MADV_HWPOISON) == -1) exit(1); *((char *)mem) = 'd'; return 0; } -------------------- 8< -------------------- -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
-- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>