https://github.com/torvalds/linux
Revision df17277b2a85c00f5710e33ce238ba4114687a28 authored by Mike Rapoport on 01 June 2019, 05:30:33 UTC, committed by Linus Torvalds on 01 June 2019, 22:51:31 UTC
When get_user_pages*() is called with pages = NULL, the processing of VM_FAULT_RETRY terminates early without actually retrying to fault-in all the pages. If the pages in the requested range belong to a VMA that has userfaultfd registered, handle_userfault() returns VM_FAULT_RETRY *after* user space has populated the page, but for the gup pre-fault case there's no actual retry and the caller will get no pages although they are present. This issue was uncovered when running post-copy memory restore in CRIU after d9c9ce34ed5c ("x86/fpu: Fault-in user stack if copy_fpstate_to_sigframe() fails"). After this change, the copying of FPU state to the sigframe switched from copy_to_user() variants which caused a real page fault to get_user_pages() with pages parameter set to NULL. In post-copy mode of CRIU, the destination memory is managed with userfaultfd and lack of the retry for pre-fault case in get_user_pages() causes a crash of the restored process. Making the pre-fault behavior of get_user_pages() the same as the "normal" one fixes the issue. Link: http://lkml.kernel.org/r/1557844195-18882-1-git-send-email-rppt@linux.ibm.com Fixes: d9c9ce34ed5c ("x86/fpu: Fault-in user stack if copy_fpstate_to_sigframe() fails") Signed-off-by: Mike Rapoport <rppt@linux.ibm.com> Tested-by: Andrei Vagin <avagin@gmail.com> [https://travis-ci.org/avagin/linux/builds/533184940] Tested-by: Hugh Dickins <hughd@google.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: Borislav Petkov <bp@suse.de> Cc: Pavel Machek <pavel@ucw.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent b9fba67
Tip revision: df17277b2a85c00f5710e33ce238ba4114687a28 authored by Mike Rapoport on 01 June 2019, 05:30:33 UTC
mm/gup: continue VM_FAULT_RETRY processing even for pre-faults
mm/gup: continue VM_FAULT_RETRY processing even for pre-faults
Tip revision: df17277
File | Mode | Size |
---|---|---|
asymmetric_keys | ||
async_tx | ||
842.c | -rw-r--r-- | 3.7 KB |
Kconfig | -rw-r--r-- | 55.2 KB |
Makefile | -rw-r--r-- | 6.5 KB |
ablkcipher.c | -rw-r--r-- | 10.4 KB |
acompress.c | -rw-r--r-- | 4.5 KB |
adiantum.c | -rw-r--r-- | 20.8 KB |
aead.c | -rw-r--r-- | 10.0 KB |
aegis.h | -rw-r--r-- | 2.0 KB |
aegis128.c | -rw-r--r-- | 11.5 KB |
aegis128l.c | -rw-r--r-- | 14.1 KB |
aegis256.c | -rw-r--r-- | 12.2 KB |
aes_generic.c | -rw-r--r-- | 62.2 KB |
aes_ti.c | -rw-r--r-- | 12.7 KB |
af_alg.c | -rw-r--r-- | 25.5 KB |
ahash.c | -rw-r--r-- | 16.3 KB |
akcipher.c | -rw-r--r-- | 4.0 KB |
algapi.c | -rw-r--r-- | 29.2 KB |
algboss.c | -rw-r--r-- | 6.1 KB |
algif_aead.c | -rw-r--r-- | 15.8 KB |
algif_hash.c | -rw-r--r-- | 9.6 KB |
algif_rng.c | -rw-r--r-- | 5.2 KB |
algif_skcipher.c | -rw-r--r-- | 9.9 KB |
ansi_cprng.c | -rw-r--r-- | 10.7 KB |
anubis.c | -rw-r--r-- | 27.8 KB |
api.c | -rw-r--r-- | 13.7 KB |
arc4.c | -rw-r--r-- | 3.3 KB |
authenc.c | -rw-r--r-- | 14.0 KB |
authencesn.c | -rw-r--r-- | 15.1 KB |
blkcipher.c | -rw-r--r-- | 14.7 KB |
blowfish_common.c | -rw-r--r-- | 15.5 KB |
blowfish_generic.c | -rw-r--r-- | 3.2 KB |
camellia_generic.c | -rw-r--r-- | 34.3 KB |
cast5_generic.c | -rw-r--r-- | 20.5 KB |
cast6_generic.c | -rw-r--r-- | 9.1 KB |
cast_common.c | -rw-r--r-- | 12.9 KB |
cbc.c | -rw-r--r-- | 2.3 KB |
ccm.c | -rw-r--r-- | 24.6 KB |
cfb.c | -rw-r--r-- | 6.1 KB |
chacha20poly1305.c | -rw-r--r-- | 19.0 KB |
chacha_generic.c | -rw-r--r-- | 5.8 KB |
cipher.c | -rw-r--r-- | 3.1 KB |
cmac.c | -rw-r--r-- | 7.5 KB |
compress.c | -rw-r--r-- | 1.1 KB |
crc32_generic.c | -rw-r--r-- | 3.7 KB |
crc32c_generic.c | -rw-r--r-- | 4.2 KB |
crct10dif_common.c | -rw-r--r-- | 3.6 KB |
crct10dif_generic.c | -rw-r--r-- | 3.1 KB |
cryptd.c | -rw-r--r-- | 29.2 KB |
crypto_engine.c | -rw-r--r-- | 13.3 KB |
crypto_null.c | -rw-r--r-- | 5.2 KB |
crypto_user_base.c | -rw-r--r-- | 12.1 KB |
crypto_user_stat.c | -rw-r--r-- | 9.7 KB |
crypto_wq.c | -rw-r--r-- | 759 bytes |
ctr.c | -rw-r--r-- | 10.1 KB |
cts.c | -rw-r--r-- | 12.0 KB |
deflate.c | -rw-r--r-- | 7.7 KB |
des_generic.c | -rw-r--r-- | 35.4 KB |
dh.c | -rw-r--r-- | 4.7 KB |
dh_helper.c | -rw-r--r-- | 3.4 KB |
drbg.c | -rw-r--r-- | 57.2 KB |
ecb.c | -rw-r--r-- | 2.4 KB |
ecc.c | -rw-r--r-- | 38.2 KB |
ecc.h | -rw-r--r-- | 7.6 KB |
ecc_curve_defs.h | -rw-r--r-- | 1.9 KB |
ecdh.c | -rw-r--r-- | 3.9 KB |
ecdh_helper.c | -rw-r--r-- | 2.1 KB |
echainiv.c | -rw-r--r-- | 4.3 KB |
ecrdsa.c | -rw-r--r-- | 8.3 KB |
ecrdsa_defs.h | -rw-r--r-- | 7.2 KB |
ecrdsa_params.asn1 | -rw-r--r-- | 142 bytes |
ecrdsa_pub_key.asn1 | -rw-r--r-- | 57 bytes |
fcrypt.c | -rw-r--r-- | 18.0 KB |
fips.c | -rw-r--r-- | 1.4 KB |
gcm.c | -rw-r--r-- | 32.0 KB |
gf128mul.c | -rw-r--r-- | 12.4 KB |
ghash-generic.c | -rw-r--r-- | 3.5 KB |
hash_info.c | -rw-r--r-- | 1.9 KB |
hmac.c | -rw-r--r-- | 6.5 KB |
internal.h | -rw-r--r-- | 3.4 KB |
jitterentropy-kcapi.c | -rw-r--r-- | 6.0 KB |
jitterentropy.c | -rw-r--r-- | 23.9 KB |
keywrap.c | -rw-r--r-- | 9.5 KB |
khazad.c | -rw-r--r-- | 51.8 KB |
kpp.c | -rw-r--r-- | 2.7 KB |
lrw.c | -rw-r--r-- | 10.7 KB |
lz4.c | -rw-r--r-- | 3.9 KB |
lz4hc.c | -rw-r--r-- | 4.0 KB |
lzo-rle.c | -rw-r--r-- | 4.0 KB |
lzo.c | -rw-r--r-- | 3.9 KB |
md4.c | -rw-r--r-- | 5.9 KB |
md5.c | -rw-r--r-- | 7.4 KB |
memneq.c | -rw-r--r-- | 6.1 KB |
michael_mic.c | -rw-r--r-- | 3.7 KB |
morus1280.c | -rw-r--r-- | 14.0 KB |
morus640.c | -rw-r--r-- | 13.6 KB |
nhpoly1305.c | -rw-r--r-- | 7.7 KB |
ofb.c | -rw-r--r-- | 2.4 KB |
pcbc.c | -rw-r--r-- | 4.7 KB |
pcrypt.c | -rw-r--r-- | 13.2 KB |
poly1305_generic.c | -rw-r--r-- | 8.5 KB |
proc.c | -rw-r--r-- | 2.5 KB |
ripemd.h | -rw-r--r-- | 1013 bytes |
rmd128.c | -rw-r--r-- | 10.0 KB |
rmd160.c | -rw-r--r-- | 12.4 KB |
rmd256.c | -rw-r--r-- | 10.3 KB |
rmd320.c | -rw-r--r-- | 12.8 KB |
rng.c | -rw-r--r-- | 4.7 KB |
rsa-pkcs1pad.c | -rw-r--r-- | 17.8 KB |
rsa.c | -rw-r--r-- | 5.3 KB |
rsa_helper.c | -rw-r--r-- | 4.0 KB |
rsaprivkey.asn1 | -rw-r--r-- | 316 bytes |
rsapubkey.asn1 | -rw-r--r-- | 82 bytes |
salsa20_generic.c | -rw-r--r-- | 6.0 KB |
scatterwalk.c | -rw-r--r-- | 2.0 KB |
scompress.c | -rw-r--r-- | 6.8 KB |
seed.c | -rw-r--r-- | 17.2 KB |
seqiv.c | -rw-r--r-- | 5.0 KB |
serpent_generic.c | -rw-r--r-- | 21.2 KB |
sha1_generic.c | -rw-r--r-- | 2.4 KB |
sha256_generic.c | -rw-r--r-- | 10.7 KB |
sha3_generic.c | -rw-r--r-- | 8.0 KB |
sha512_generic.c | -rw-r--r-- | 7.8 KB |
shash.c | -rw-r--r-- | 14.5 KB |
simd.c | -rw-r--r-- | 13.6 KB |
skcipher.c | -rw-r--r-- | 31.1 KB |
sm3_generic.c | -rw-r--r-- | 4.6 KB |
sm4_generic.c | -rw-r--r-- | 6.3 KB |
streebog_generic.c | -rw-r--r-- | 59.3 KB |
tcrypt.c | -rw-r--r-- | 78.3 KB |
tcrypt.h | -rw-r--r-- | 4.2 KB |
tea.c | -rw-r--r-- | 6.4 KB |
testmgr.c | -rw-r--r-- | 125.0 KB |
testmgr.h | -rw-r--r-- | 1.2 MB |
tgr192.c | -rw-r--r-- | 30.2 KB |
twofish_common.c | -rw-r--r-- | 37.2 KB |
twofish_generic.c | -rw-r--r-- | 5.6 KB |
vmac.c | -rw-r--r-- | 18.8 KB |
wp512.c | -rw-r--r-- | 59.7 KB |
xcbc.c | -rw-r--r-- | 6.6 KB |
xor.c | -rw-r--r-- | 3.4 KB |
xts.c | -rw-r--r-- | 8.9 KB |
zstd.c | -rw-r--r-- | 4.9 KB |
Computing file changes ...