linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Is MADV_HWPOISON supposed to work only on faulted-in pages?
@ 2017-02-14 15:41 Jan Stancek
  2017-02-20  5:00 ` Naoya Horiguchi
  0 siblings, 1 reply; 13+ messages in thread
From: Jan Stancek @ 2017-02-14 15:41 UTC (permalink / raw)
  To: linux-mm; +Cc: ltp

Hi,

code below (and LTP madvise07 [1]) doesn't produce SIGBUS,
unless I touch/prefault page before call to madvise().

Is this expected behavior?

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>

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-03-28 20:26 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-14 15:41 Is MADV_HWPOISON supposed to work only on faulted-in pages? Jan Stancek
2017-02-20  5:00 ` Naoya Horiguchi
2017-02-23  3:23   ` Naoya Horiguchi
2017-02-25  2:28     ` Yisheng Xie
2017-02-27  1:20       ` Naoya Horiguchi
2017-02-27  4:27         ` Zi Yan
2017-02-27  6:33           ` Naoya Horiguchi
2017-02-27 16:10             ` Zi Yan
2017-03-14 13:20             ` [LTP] " Cyril Hrubis
2017-03-27 12:08             ` Richard Palethorpe
2017-03-27 23:54     ` Andi Kleen
2017-03-28  8:25       ` [LTP] " Cyril Hrubis
2017-03-28 20:26         ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).