forked fromtorvalds/linux
- Notifications
You must be signed in to change notification settings - Fork0
Commit196f878
James Morse
Marc Zyngier
KVM: arm/arm64: Signal SIGBUS when stage2 discovers hwpoison memory
Once we enable ARCH_SUPPORTS_MEMORY_FAILURE on arm64, notifications forbroken memory can call memory_failure() in mm/memory-failure.c to offlinepages of memory, possibly signalling user space processes and notifying allthe in-kernel users.memory_failure() has two modes, early and late. Early is used bymachine-managers like Qemu to receive a notification when a memory error isnotified to the host. These can then be relayed to the guest before theaffected page is accessed. To enable this, the process must setPR_MCE_KILL_EARLY in PR_MCE_KILL_SET using the prctl() syscall.Once the early notification has been handled, nothing stops themachine-manager or guest from accessing the affected page. If themachine-manager does this the page will fail to be mapped and SIGBUS willbe sent. This patch adds the equivalent path for when the guest accessesthe page, sending SIGBUS to the machine-manager.These two signals can be distinguished by the machine-manager using theirsi_code: BUS_MCEERR_AO for 'action optional' early notifications, andBUS_MCEERR_AR for 'action required' synchronous/late notifications.Do as x86 does, and deliver the SIGBUS when we discover pfn ==KVM_PFN_ERR_HWPOISON. Use the hugepage size as si_addr_lsb if this vma wasallocated as a hugepage. Transparent hugepages will be split bymemory_failure() before we see them here.Cc: Punit Agrawal <punit.agrawal@arm.com>Signed-off-by: James Morse <james.morse@arm.com>Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>1 parent02d50cd commit196f878
1 file changed
+23
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
1261 | 1262 | | |
1262 | 1263 | | |
1263 | 1264 | | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
1264 | 1283 | | |
1265 | 1284 | | |
1266 | 1285 | | |
| |||
1330 | 1349 | | |
1331 | 1350 | | |
1332 | 1351 | | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
1333 | 1356 | | |
1334 | 1357 | | |
1335 | 1358 | | |
| |||
0 commit comments
Comments
(0)