linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jan Stancek <jstancek@redhat.com>
To: linux-mm@kvack.org
Cc: ltp@lists.linux.it
Subject: Is MADV_HWPOISON supposed to work only on faulted-in pages?
Date: Tue, 14 Feb 2017 16:41:29 +0100	[thread overview]
Message-ID: <6a445beb-119c-9a9a-0277-07866afe4924@redhat.com> (raw)

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>

             reply	other threads:[~2017-02-14 15:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-14 15:41 Jan Stancek [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6a445beb-119c-9a9a-0277-07866afe4924@redhat.com \
    --to=jstancek@redhat.com \
    --cc=linux-mm@kvack.org \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox