aboutsummaryrefslogtreecommitdiff
path: root/lib/mpi/mpi-internal.h
diff options
context:
space:
mode:
authorPeter Collingbourne <[email protected]>2023-04-20 14:43:27 -0700
committerWill Deacon <[email protected]>2023-05-16 14:59:16 +0100
commitc4c597f1b367433c52c531dccd6859a39b4580fb (patch)
tree2c18bd53a2f985bfea0b9f8695ba6bd0da5c7fb4 /lib/mpi/mpi-internal.h
parent2efbafb91e12ff5a16cbafb0085e4c10c3fca493 (diff)
arm64: mte: Do not set PG_mte_tagged if tags were not initialized
The mte_sync_page_tags() function sets PG_mte_tagged if it initializes page tags. Then we return to mte_sync_tags(), which sets PG_mte_tagged again. At best, this is redundant. However, it is possible for mte_sync_page_tags() to return without having initialized tags for the page, i.e. in the case where check_swap is true (non-compound page), is_swap_pte(old_pte) is false and pte_is_tagged is false. So at worst, we set PG_mte_tagged on a page with uninitialized tags. This can happen if, for example, page migration causes a PTE for an untagged page to be replaced. If the userspace program subsequently uses mprotect() to enable PROT_MTE for that page, the uninitialized tags will be exposed to userspace. Fix it by removing the redundant call to set_page_mte_tagged(). Fixes: e059853d14ca ("arm64: mte: Fix/clarify the PG_mte_tagged semantics") Signed-off-by: Peter Collingbourne <[email protected]> Cc: <[email protected]> # 6.1 Link: https://linux-review.googlesource.com/id/Ib02d004d435b2ed87603b858ef7480f7b1463052 Reviewed-by: Catalin Marinas <[email protected]> Reviewed-by: Alexandru Elisei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
Diffstat (limited to 'lib/mpi/mpi-internal.h')
0 files changed, 0 insertions, 0 deletions