-----BEGIN PGP SIGNATURE-----

iQEcBAABAgAGBQJYyMuAAAoJEJykq7OBq3PIEXEIAKzl5BgjKdN0tyLBJDu5GFNF
 u47iRAsmwq3SoW1RuFs56DLa7aNzr+sAPh4IOXyZoY99kPC5n+KtNOkq1oMHKl1J
 ckGCosvbIOnFheUIKhcFSDlQBYjxW0AzLW9gKaPoeha1zHWa8R6pAimkfp6uZl23
 UgjKzvtOJq9eQlUjQTUKjjAQk7ngUszn4pF3obJ8IuNgwv+gqVjWB/NT/B/cHGzU
 PoV+oj17NqxLGK9gsRNUXTgwse4100qq2KvUX8B22Axr02apZUx3Lk/QWiYCnXTJ
 hiAmr30FHUPBbaOsQiTX+eqDvW3icvSyt6EU2gQcHkABwSvaPG/vbgPcjFf8oHY=
 =0bJJ
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

# gpg: Signature made Wed 15 Mar 2017 05:05:04 GMT
# gpg:                using RSA key 0x9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha/tags/block-pull-request:
  os: don't corrupt pre-existing memory-backend data with prealloc

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2017-03-15 14:19:59 +00:00
commit 7584bf5e6f
1 changed files with 13 additions and 1 deletions

View File

@ -361,7 +361,19 @@ static void *do_touch_pages(void *arg)
memset_thread_failed = true;
} else {
for (i = 0; i < numpages; i++) {
memset(addr, 0, 1);
/*
* Read & write back the same value, so we don't
* corrupt existing user/app data that might be
* stored.
*
* 'volatile' to stop compiler optimizing this away
* to a no-op
*
* TODO: get a better solution from kernel so we
* don't need to write at all so we don't cause
* wear on the storage backing the region...
*/
*(volatile char *)addr = *addr;
addr += hpagesize;
}
}