Sean Christopherson
79f9bc5843
mm/secretmem: fix NULL page->mapping dereference in page_is_secretmem()
Check for a NULL page->mapping before dereferencing the mapping in
page_is_secretmem(), as the page's mapping can be nullified while gup()
is running, e.g. by reclaim or truncation.
BUG: kernel NULL pointer dereference, address: 0000000000000068
#PF: supervisor read access in kernel mode
#PF: error_code(0x0000) - not-present page
PGD 0 P4D 0
Oops: 0000 [#1] PREEMPT SMP NOPTI
CPU: 6 PID: 4173897 Comm: CPU 3/KVM Tainted: G W
RIP: 0010:internal_get_user_pages_fast+0x621/0x9d0
Code: <48> 81 7a 68 80 08 04 bc 0f 85 21 ff ff 8 89 c7 be
RSP: 0018:ffffaa90087679b0 EFLAGS: 00010046
RAX: ffffe3f37905b900 RBX: 00007f2dd561e000 RCX: ffffe3f37905b934
RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffe3f37905b900
...
CR2: 0000000000000068 CR3: 00000004c5898003 CR4: 00000000001726e0
Call Trace:
get_user_pages_fast_only+0x13/0x20
hva_to_pfn+0xa9/0x3e0
try_async_pf+0xa1/0x270
direct_page_fault+0x113/0xad0
kvm_mmu_page_fault+0x69/0x680
vmx_handle_exit+0xe1/0x5d0
kvm_arch_vcpu_ioctl_run+0xd81/0x1c70
kvm_vcpu_ioctl+0x267/0x670
__x64_sys_ioctl+0x83/0xa0
do_syscall_64+0x56/0x80
entry_SYSCALL_64_after_hwframe+0x44/0xae
Link: https://lkml.kernel.org/r/20211007231502.3552715-1-seanjc@google.com
Fixes: 1507f51255 ("mm: introduce memfd_secret system call to create "secret" memory areas")
Signed-off-by: Sean Christopherson <seanjc@google.com>
Reported-by: Darrick J. Wong <djwong@kernel.org>
Reported-by: Stephen <stephenackerman16@gmail.com>
Tested-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Mike Rapoport <rppt@linux.ibm.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-10-18 20:22:03 -10:00
..
2021-07-16 18:46:45 +02:00
2021-08-19 15:07:03 +02:00
2021-09-02 22:49:16 +02:00
2021-07-19 14:28:56 +02:00
2021-07-21 11:53:42 +02:00
2021-10-12 17:35:18 -07:00
2021-07-21 13:14:08 +02:00
2021-07-21 19:54:21 -07:00
2021-08-04 09:53:34 +01:00
2021-08-13 09:38:04 +02:00
2021-08-23 18:05:31 -04:00
2021-09-07 12:38:59 -07:00
2021-10-12 13:51:59 -07:00
2021-08-31 16:43:06 -07:00
2021-09-03 16:20:37 -07:00
2021-08-02 11:40:45 +02:00
2021-09-20 12:43:34 +01:00
2021-10-05 15:39:50 +02:00
2021-09-01 15:25:28 -07:00
2021-08-23 11:06:28 +01:00
2021-09-08 12:55:35 -07:00
2021-09-07 14:02:58 -07:00
2021-09-01 10:29:29 -07:00
2021-10-14 12:47:29 +01:00
2021-08-29 14:47:42 +03:00
2021-09-04 10:25:26 -07:00
2021-09-14 10:41:30 +02:00
2021-08-30 19:30:37 +02:00
2021-10-07 16:51:57 +02:00
2021-07-16 18:46:45 +02:00
2021-09-03 09:58:10 -07:00
2021-09-03 10:08:28 -07:00
2021-08-31 09:41:22 -07:00
2021-08-13 10:27:49 +02:00
2021-08-31 09:41:22 -07:00
2021-08-16 10:53:01 -06:00
2021-08-23 12:54:30 -06:00
2021-09-02 15:09:46 -07:00
2021-09-09 19:14:33 -04:00
2021-08-17 00:45:07 +02:00
2021-07-31 09:14:46 -07:00
2021-08-23 17:50:24 -07:00
2021-09-14 11:09:50 -07:00
2021-08-20 00:09:49 +02:00
2021-07-30 22:22:36 -04:00
2021-07-30 22:22:36 -04:00
2021-08-25 19:41:39 -07:00
2021-07-15 22:31:10 +02:00
2021-09-24 16:13:35 -07:00
2021-08-16 10:50:32 -06:00
2021-09-01 10:29:10 +02:00
2021-07-30 22:13:09 -04:00
2021-09-13 16:35:58 -07:00
2021-09-13 16:35:58 -07:00
2021-09-01 15:26:45 -07:00
2021-09-03 09:58:17 -07:00
2021-09-08 15:32:35 -07:00
2021-09-13 10:43:04 -07:00
2021-09-12 16:09:26 -07:00
2021-09-13 10:18:28 -07:00
2021-09-13 10:43:04 -07:00
2021-09-15 12:04:28 -07:00
2021-08-18 22:33:28 +02:00
2021-08-09 20:17:36 +01:00
2021-09-11 00:41:21 +02:00
2021-09-07 15:42:10 +02:00
2021-10-18 20:22:03 -10:00
2021-09-21 17:34:53 +02:00
2021-08-20 12:32:59 +02:00
2021-08-24 17:09:01 -05:00
2021-09-08 11:50:24 -07:00
2021-08-26 16:52:03 -07:00
2021-08-17 17:29:10 +02:00
2021-07-19 12:13:06 +02:00
2021-08-31 14:55:09 -07:00
2021-09-03 10:34:44 -07:00
2021-07-29 12:54:10 -07:00
2021-08-10 12:23:46 +02:00
2021-08-18 13:27:49 +02:00
2021-08-19 09:02:39 +02:00
2021-08-14 09:18:36 +02:00
2021-08-29 19:14:19 +05:30
2021-07-20 09:20:49 -07:00
2021-10-18 20:22:03 -10:00
2021-09-07 21:17:28 +02:00
2021-08-19 11:19:41 +01:00
2021-08-26 15:32:28 -04:00
2021-10-05 12:38:39 +01:00
2021-08-24 07:38:29 -07:00
2021-08-28 01:33:02 +02:00
2021-08-20 11:39:26 +01:00
2021-08-26 15:32:10 -04:00
2021-08-10 13:08:49 +02:00
2021-07-23 11:32:43 +10:00
2021-07-27 11:00:36 +02:00
2021-09-06 07:20:56 -04:00
2021-09-03 15:33:47 -07:00
2021-07-21 06:39:20 -10:00
2021-09-09 12:45:26 -07:00
2021-08-27 13:34:02 +01:00
2021-08-27 13:34:03 +01:00
2021-07-28 21:40:36 -07:00
2021-08-11 13:50:53 +02:00
2021-08-03 14:31:40 +02:00
2021-09-23 19:26:54 +02:00
2021-07-30 18:35:47 +02:00
2021-10-15 21:02:50 -06:00
2021-07-26 15:09:44 +02:00
2021-07-27 20:11:45 +01:00
2021-07-27 20:11:44 +01:00
2021-09-08 11:50:24 -07:00
2021-09-03 09:58:13 -07:00
2021-08-10 14:42:49 +02:00
2021-08-10 17:57:23 +02:00
2021-09-03 09:58:16 -07:00
2021-09-08 18:45:53 -07:00
2021-07-22 10:14:25 +00:00
2021-08-12 17:26:24 +02:00
2021-08-26 10:18:56 +02:00
2021-08-04 12:35:07 +01:00
2021-08-05 11:46:42 +01:00
2021-07-23 09:27:02 -04:00
2021-08-13 06:41:22 -07:00
2021-08-19 10:41:08 +02:00
2021-07-15 20:49:09 +02:00
2021-08-19 10:41:08 +02:00
2021-08-10 22:50:07 +02:00
2021-08-23 13:10:37 -06:00
2021-08-20 17:14:35 +02:00
2021-07-21 08:14:33 -07:00
2021-07-21 08:14:33 -07:00
2021-07-21 08:14:33 -07:00
2021-08-16 21:26:33 -07:00
2021-09-03 10:44:35 -07:00
2021-08-18 07:23:15 -06:00
2021-07-21 08:14:33 -07:00
2021-08-10 10:59:20 +02:00
2021-09-22 14:29:32 +01:00
2021-07-31 22:20:24 -04:00
2021-08-02 18:14:21 +01:00
2021-07-15 10:13:49 -07:00
2021-07-27 17:05:06 +01:00
2021-08-19 09:02:55 +09:00
2021-07-27 09:29:15 +02:00
2021-08-20 11:31:42 -07:00
2021-09-23 11:01:12 -04:00
2021-09-06 06:30:45 -04:00
2021-08-18 08:27:30 +02:00
2021-09-03 08:06:02 -06:00
2021-08-13 18:37:38 +02:00
2021-08-17 19:08:49 +02:00
2021-08-05 12:08:15 +02:00
2021-08-11 09:50:11 -06:00
2021-09-19 12:08:37 +01:00
2021-07-29 17:08:04 +02:00
2021-09-14 13:23:22 -07:00
2021-09-03 10:08:28 -07:00
2021-09-08 11:50:23 -07:00
2021-10-18 20:22:02 -10:00
2021-09-03 09:58:17 -07:00
2021-09-01 08:35:06 -07:00
2021-09-24 16:13:35 -07:00
2021-08-19 13:06:53 +01:00
2021-08-19 09:02:55 +09:00
2021-08-09 15:49:00 -07:00
2021-09-07 11:03:45 -07:00
2021-09-03 18:42:01 +02:00
2021-09-16 13:05:42 -07:00
2021-08-20 12:32:58 +02:00
2021-09-08 12:55:35 -07:00
2021-08-26 10:36:51 -06:00
2021-07-19 11:57:48 +02:00
2021-08-16 14:42:22 +02:00
2021-08-24 09:16:20 +02:00
2021-08-17 19:05:29 +02:00
2021-08-23 13:19:12 +02:00
2021-09-05 20:58:50 +01:00
2021-08-25 15:20:25 +01:00
2021-08-27 16:37:17 -04:00
2021-08-27 16:37:17 -04:00
2021-08-16 18:55:32 +02:00
2021-07-28 15:33:59 +02:00
2021-09-14 09:02:50 +02:00
2021-08-15 09:56:03 -05:00
2021-08-05 21:21:58 +02:00
2021-09-07 12:27:27 -07:00
2021-08-25 15:43:26 -05:00
2021-07-29 09:02:27 +02:00
2021-09-08 11:50:25 -07:00
2021-09-13 10:18:28 -07:00
2021-09-17 13:52:17 +01:00
2021-07-30 10:58:36 +08:00
2021-09-08 11:50:24 -07:00
2021-09-08 11:50:24 -07:00
2021-09-08 12:55:35 -07:00
2021-09-08 12:55:35 -07:00
2021-08-18 17:32:42 -05:00
2021-09-07 19:13:42 -07:00
2021-09-02 17:59:58 +02:00
2021-08-19 14:13:28 +01:00
2021-09-07 19:13:42 -07:00
2021-09-07 19:13:42 -07:00
2021-10-01 13:57:54 +02:00
2021-07-21 11:28:09 +01:00
2021-07-20 06:55:20 -07:00
2021-09-07 14:04:59 +01:00
2021-08-10 12:53:04 +02:00
2021-08-18 11:39:46 -07:00
2021-09-20 22:28:47 +02:00
2021-08-18 16:08:11 +02:00
2021-08-26 11:28:07 -07:00
2021-08-16 18:45:29 +02:00
2021-08-26 11:27:51 -07:00
2021-08-18 22:08:24 +02:00
2021-08-10 17:09:59 +02:00
2021-08-14 12:48:07 +02:00
2021-08-17 19:06:04 +02:00
2021-09-03 15:33:47 -07:00
2021-07-16 19:17:05 +02:00
2021-08-13 17:49:05 -07:00
2021-09-02 21:38:56 +02:00
2021-10-07 16:51:57 +02:00
2021-08-04 14:23:31 -05:00
2021-08-17 17:36:48 +02:00
2021-08-17 17:36:48 +02:00
2021-08-06 13:41:48 -07:00
2021-08-10 11:00:53 -07:00
2021-08-06 13:41:48 -07:00
2021-08-26 13:40:35 +01:00
2021-07-28 14:57:31 -05:00
2021-08-11 18:42:53 +02:00
2021-07-15 10:13:49 -07:00
2021-08-17 17:37:26 +02:00
2021-08-17 17:12:22 +02:00
2021-08-17 17:50:51 +02:00
2021-08-17 17:50:51 +02:00
2021-09-02 22:07:17 +02:00
2021-08-24 19:52:40 -03:00
2021-10-01 13:57:57 +02:00
2021-07-13 11:39:42 +01:00
2021-07-13 11:39:48 +01:00
2021-10-18 20:22:03 -10:00
2021-08-10 10:10:10 +02:00
2021-08-13 09:12:53 +02:00
2021-07-21 12:53:26 +02:00
2021-08-13 09:14:36 +02:00
2021-09-03 09:58:12 -07:00
2021-07-23 13:16:43 -05:00
2021-09-09 10:57:52 +01:00
2021-07-27 14:55:30 -07:00
2021-09-04 10:22:01 +02:00
2021-08-31 16:43:06 -07:00
2021-08-17 17:43:24 +02:00
2021-08-17 19:06:13 +02:00
2021-08-17 19:06:13 +02:00
2021-08-17 19:06:13 +02:00
2021-08-17 17:43:24 +02:00
2021-08-06 13:41:48 -07:00
2021-08-17 11:47:43 +02:00
2021-08-17 19:09:27 +02:00
2021-08-19 09:02:55 +09:00
2021-08-19 09:02:55 +09:00
2021-09-03 09:58:17 -07:00
2021-07-23 20:14:43 -04:00
2021-09-09 13:25:49 -07:00
2021-08-17 11:47:53 -04:00
2021-07-21 12:04:56 +02:00
2021-08-05 14:47:31 +02:00
2021-07-21 07:55:50 +02:00
2021-08-14 15:43:28 +02:00
2021-09-08 11:50:28 -07:00
2021-08-09 14:58:29 +03:00
2021-09-08 17:44:26 +02:00
2021-09-05 11:50:41 -07:00
2021-09-22 10:24:01 -04:00
2021-08-16 11:37:21 -04:00
2021-07-27 12:12:07 +02:00
2021-07-27 12:17:21 +02:00
2021-07-27 12:12:08 +02:00
2021-07-27 12:12:07 +02:00
2021-07-27 12:12:08 +02:00
2021-07-27 12:12:08 +02:00
2021-09-08 15:32:35 -07:00
2021-09-15 09:22:35 -06:00
2021-09-08 12:55:35 -07:00
2021-09-03 09:58:16 -07:00
2021-09-06 07:20:57 -04:00
2021-08-26 10:36:51 -06:00
2021-08-11 09:50:11 -06:00
2021-07-21 10:29:10 +02:00
2021-09-06 07:20:57 -04:00
2021-08-10 11:50:55 -04:00
2021-09-03 09:58:16 -07:00
2021-09-08 11:50:24 -07:00
2021-09-03 09:58:17 -07:00
2021-08-11 06:44:24 -04:00
2021-07-27 12:23:20 +02:00
2021-08-30 13:42:10 -07:00
2021-08-22 10:28:08 +02:00
2021-09-13 07:53:27 -10:00
2021-09-03 10:08:28 -07:00
2021-08-17 19:05:11 +02:00
2021-08-05 14:37:04 +02:00