Revision 4837fe37adff1d159904f0c013471b1ecbcb455e authored by Michal Hocko on 14 December 2017, 23:33:15 UTC, committed by Linus Torvalds on 15 December 2017, 00:00:49 UTC
David Rientjes has reported the following memory corruption while the oom reaper tries to unmap the victims address space BUG: Bad page map in process oom_reaper pte:6353826300000000 pmd:00000000 addr:00007f50cab1d000 vm_flags:08100073 anon_vma:ffff9eea335603f0 mapping: (null) index:7f50cab1d file: (null) fault: (null) mmap: (null) readpage: (null) CPU: 2 PID: 1001 Comm: oom_reaper Call Trace: unmap_page_range+0x1068/0x1130 __oom_reap_task_mm+0xd5/0x16b oom_reaper+0xff/0x14c kthread+0xc1/0xe0 Tetsuo Handa has noticed that the synchronization inside exit_mmap is insufficient. We only synchronize with the oom reaper if tsk_is_oom_victim which is not true if the final __mmput is called from a different context than the oom victim exit path. This can trivially happen from context of any task which has grabbed mm reference (e.g. to read /proc/<pid>/ file which requires mm etc.). The race would look like this oom_reaper oom_victim task mmget_not_zero do_exit mmput __oom_reap_task_mm mmput __mmput exit_mmap remove_vma unmap_page_range Fix this issue by providing a new mm_is_oom_victim() helper which operates on the mm struct rather than a task. Any context which operates on a remote mm struct should use this helper in place of tsk_is_oom_victim. The flag is set in mark_oom_victim and never cleared so it is stable in the exit_mmap path. Debugged by Tetsuo Handa. Link: http://lkml.kernel.org/r/20171210095130.17110-1-mhocko@kernel.org Fixes: 212925802454 ("mm: oom: let oom_reap_task and exit_mmap run concurrently") Signed-off-by: Michal Hocko <mhocko@suse.com> Reported-by: David Rientjes <rientjes@google.com> Acked-by: David Rientjes <rientjes@google.com> Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Cc: Andrea Argangeli <andrea@kernel.org> Cc: <stable@vger.kernel.org> [4.14] Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent bdcf0a4
File | Mode | Size |
---|---|---|
asymmetric_keys | ||
async_tx | ||
.gitignore | -rw-r--r-- | 12 bytes |
842.c | -rw-r--r-- | 4.2 KB |
Kconfig | -rw-r--r-- | 51.2 KB |
Makefile | -rw-r--r-- | 5.6 KB |
ablk_helper.c | -rw-r--r-- | 4.4 KB |
ablkcipher.c | -rw-r--r-- | 13.0 KB |
acompress.c | -rw-r--r-- | 4.8 KB |
aead.c | -rw-r--r-- | 10.1 KB |
aes_generic.c | -rw-r--r-- | 62.1 KB |
aes_ti.c | -rw-r--r-- | 12.3 KB |
af_alg.c | -rw-r--r-- | 26.0 KB |
ahash.c | -rw-r--r-- | 15.4 KB |
akcipher.c | -rw-r--r-- | 3.9 KB |
algapi.c | -rw-r--r-- | 22.1 KB |
algboss.c | -rw-r--r-- | 6.0 KB |
algif_aead.c | -rw-r--r-- | 15.9 KB |
algif_hash.c | -rw-r--r-- | 10.3 KB |
algif_rng.c | -rw-r--r-- | 5.2 KB |
algif_skcipher.c | -rw-r--r-- | 10.6 KB |
ansi_cprng.c | -rw-r--r-- | 10.9 KB |
anubis.c | -rw-r--r-- | 27.8 KB |
api.c | -rw-r--r-- | 13.9 KB |
arc4.c | -rw-r--r-- | 3.4 KB |
authenc.c | -rw-r--r-- | 13.9 KB |
authencesn.c | -rw-r--r-- | 15.3 KB |
blkcipher.c | -rw-r--r-- | 15.0 KB |
blowfish_common.c | -rw-r--r-- | 15.7 KB |
blowfish_generic.c | -rw-r--r-- | 3.4 KB |
camellia_generic.c | -rw-r--r-- | 34.9 KB |
cast5_generic.c | -rw-r--r-- | 20.9 KB |
cast6_generic.c | -rw-r--r-- | 9.5 KB |
cast_common.c | -rw-r--r-- | 13.1 KB |
cbc.c | -rw-r--r-- | 5.1 KB |
ccm.c | -rw-r--r-- | 25.5 KB |
chacha20_generic.c | -rw-r--r-- | 3.6 KB |
chacha20poly1305.c | -rw-r--r-- | 19.3 KB |
cipher.c | -rw-r--r-- | 3.3 KB |
cmac.c | -rw-r--r-- | 7.7 KB |
compress.c | -rw-r--r-- | 1.3 KB |
crc32_generic.c | -rw-r--r-- | 3.8 KB |
crc32c_generic.c | -rw-r--r-- | 4.3 KB |
crct10dif_common.c | -rw-r--r-- | 3.6 KB |
crct10dif_generic.c | -rw-r--r-- | 3.2 KB |
cryptd.c | -rw-r--r-- | 36.2 KB |
crypto_engine.c | -rw-r--r-- | 12.2 KB |
crypto_null.c | -rw-r--r-- | 5.3 KB |
crypto_user.c | -rw-r--r-- | 13.1 KB |
crypto_wq.c | -rw-r--r-- | 972 bytes |
ctr.c | -rw-r--r-- | 12.6 KB |
cts.c | -rw-r--r-- | 12.0 KB |
deflate.c | -rw-r--r-- | 7.9 KB |
des_generic.c | -rw-r--r-- | 35.7 KB |
dh.c | -rw-r--r-- | 3.6 KB |
dh_helper.c | -rw-r--r-- | 3.1 KB |
drbg.c | -rw-r--r-- | 57.2 KB |
ecb.c | -rw-r--r-- | 4.9 KB |
ecc.c | -rw-r--r-- | 25.7 KB |
ecc.h | -rw-r--r-- | 3.6 KB |
ecc_curve_defs.h | -rw-r--r-- | 1.5 KB |
ecdh.c | -rw-r--r-- | 3.7 KB |
ecdh_helper.c | -rw-r--r-- | 2.3 KB |
echainiv.c | -rw-r--r-- | 4.6 KB |
fcrypt.c | -rw-r--r-- | 18.0 KB |
fips.c | -rw-r--r-- | 1.6 KB |
gcm.c | -rw-r--r-- | 32.9 KB |
gf128mul.c | -rw-r--r-- | 12.5 KB |
ghash-generic.c | -rw-r--r-- | 3.6 KB |
hash_info.c | -rw-r--r-- | 1.9 KB |
hmac.c | -rw-r--r-- | 6.9 KB |
internal.h | -rw-r--r-- | 4.1 KB |
jitterentropy-kcapi.c | -rw-r--r-- | 6.0 KB |
jitterentropy.c | -rw-r--r-- | 23.9 KB |
keywrap.c | -rw-r--r-- | 11.4 KB |
khazad.c | -rw-r--r-- | 51.8 KB |
kpp.c | -rw-r--r-- | 3.0 KB |
lrw.c | -rw-r--r-- | 14.7 KB |
lz4.c | -rw-r--r-- | 3.9 KB |
lz4hc.c | -rw-r--r-- | 4.0 KB |
lzo.c | -rw-r--r-- | 3.9 KB |
mcryptd.c | -rw-r--r-- | 17.5 KB |
md4.c | -rw-r--r-- | 6.2 KB |
md5.c | -rw-r--r-- | 7.7 KB |
memneq.c | -rw-r--r-- | 6.1 KB |
michael_mic.c | -rw-r--r-- | 3.6 KB |
pcbc.c | -rw-r--r-- | 7.7 KB |
pcrypt.c | -rw-r--r-- | 13.2 KB |
poly1305_generic.c | -rw-r--r-- | 8.0 KB |
proc.c | -rw-r--r-- | 3.0 KB |
ripemd.h | -rw-r--r-- | 1013 bytes |
rmd128.c | -rw-r--r-- | 10.2 KB |
rmd160.c | -rw-r--r-- | 12.6 KB |
rmd256.c | -rw-r--r-- | 10.6 KB |
rmd320.c | -rw-r--r-- | 13.1 KB |
rng.c | -rw-r--r-- | 4.9 KB |
rsa-pkcs1pad.c | -rw-r--r-- | 17.3 KB |
rsa.c | -rw-r--r-- | 7.5 KB |
rsa_helper.c | -rw-r--r-- | 4.2 KB |
rsaprivkey.asn1 | -rw-r--r-- | 316 bytes |
rsapubkey.asn1 | -rw-r--r-- | 82 bytes |
salsa20_generic.c | -rw-r--r-- | 6.5 KB |
scatterwalk.c | -rw-r--r-- | 2.2 KB |
scompress.c | -rw-r--r-- | 8.2 KB |
seed.c | -rw-r--r-- | 17.4 KB |
seqiv.c | -rw-r--r-- | 5.4 KB |
serpent_generic.c | -rw-r--r-- | 21.4 KB |
sha1_generic.c | -rw-r--r-- | 2.6 KB |
sha256_generic.c | -rw-r--r-- | 11.0 KB |
sha3_generic.c | -rw-r--r-- | 7.0 KB |
sha512_generic.c | -rw-r--r-- | 7.1 KB |
shash.c | -rw-r--r-- | 14.2 KB |
simd.c | -rw-r--r-- | 6.1 KB |
skcipher.c | -rw-r--r-- | 26.0 KB |
sm3_generic.c | -rw-r--r-- | 4.6 KB |
tcrypt.c | -rw-r--r-- | 51.4 KB |
tcrypt.h | -rw-r--r-- | 4.3 KB |
tea.c | -rw-r--r-- | 6.6 KB |
testmgr.c | -rw-r--r-- | 82.1 KB |
testmgr.h | -rw-r--r-- | 1.2 MB |
tgr192.c | -rw-r--r-- | 30.5 KB |
twofish_common.c | -rw-r--r-- | 37.8 KB |
twofish_generic.c | -rw-r--r-- | 6.3 KB |
vmac.c | -rw-r--r-- | 18.9 KB |
wp512.c | -rw-r--r-- | 59.8 KB |
xcbc.c | -rw-r--r-- | 7.2 KB |
xor.c | -rw-r--r-- | 3.8 KB |
xts.c | -rw-r--r-- | 13.6 KB |
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...