Commit f620d66
arm64: mte: Do not flag the zero page as PG_mte_tagged
Commit 68d54ce ("arm64: mte: Allow PTRACE_PEEKMTETAGS access to the
zero page") attempted to fix ptrace() reading of tags from the zero page
by marking it as PG_mte_tagged during cpu_enable_mte(). The same commit
also changed the ptrace() tag access permission check to the VM_MTE vma
flag while turning the page flag test into a WARN_ON_ONCE().
Attempting to set the PG_mte_tagged flag early with
CONFIG_DEFERRED_STRUCT_PAGE_INIT enabled may either hang (after commit
d77e59a "arm64: mte: Lock a page for MTE tag initialisation") or
have the flags cleared later during page_alloc_init_late(). In addition,
pages_identical() -> memcmp_pages() will reject any comparison with the
zero page as it is marked as tagged.
Partially revert the above commit to avoid setting PG_mte_tagged on the
zero page. Update the __access_remote_tags() warning on untagged pages
to ignore the zero page since it is known to have the tags initialised.
Note that all user mapping of the zero page are marked as pte_special().
The arm64 set_pte_at() will not call mte_sync_tags() on such pages, so
PG_mte_tagged will remain cleared.
Signed-off-by: Catalin Marinas <[email protected]>
Fixes: 68d54ce ("arm64: mte: Allow PTRACE_PEEKMTETAGS access to the zero page")
Reported-by: Gergely Kovacs <[email protected]>
Cc: [email protected] # 5.10.x
Cc: Will Deacon <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Lance Yang <[email protected]>
Acked-by: Lance Yang <[email protected]>
Reviewed-by: David Hildenbrand <[email protected]>
Tested-by: Lance Yang <[email protected]>
Signed-off-by: Will Deacon <[email protected]>1 parent cb0c5a6 commit f620d66
2 files changed
+8
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2303 | 2303 | | |
2304 | 2304 | | |
2305 | 2305 | | |
| 2306 | + | |
| 2307 | + | |
2306 | 2308 | | |
2307 | 2309 | | |
2308 | 2310 | | |
2309 | 2311 | | |
2310 | 2312 | | |
2311 | 2313 | | |
2312 | | - | |
| 2314 | + | |
| 2315 | + | |
| 2316 | + | |
2313 | 2317 | | |
2314 | | - | |
| 2318 | + | |
| 2319 | + | |
2315 | 2320 | | |
2316 | | - | |
2317 | 2321 | | |
2318 | 2322 | | |
2319 | 2323 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
460 | 460 | | |
461 | 461 | | |
462 | 462 | | |
463 | | - | |
| 463 | + | |
464 | 464 | | |
465 | 465 | | |
466 | 466 | | |
| |||
0 commit comments