From: Magnus Lindholm <linmag7@gmail.com>
To: richard.henderson@linaro.org, mattst88@gmail.com,
linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org
Cc: glaubitz@physik.fu-berlin.de, mcree@orcon.net.nz,
ink@unseen.parts, macro@orcam.me.uk,
Magnus Lindholm <linmag7@gmail.com>,
stable@vger.kernel.org
Subject: [PATCH v2 7/7] alpha: invalidate the local context in flush_icache_user_page()
Date: Mon, 10 Aug 2026 21:34:58 +0200 [thread overview]
Message-ID: <20260810193902.3286353-8-linmag7@gmail.com> (raw)
In-Reply-To: <20260810193902.3286353-1-linmag7@gmail.com>
flush_icache_user_page() has the same caller-CPU omission that the
previous patch fixed in flush_tlb_mm(): when the target mm is not the
calling CPU's active_mm nothing happens locally, and smp_call_function()
handles only the other CPUs, so this CPU may later reuse the old ASN
together with the translations it still holds.
This matters here in particular because the function exists for
operating on another process's mappings: the comment above it describes
setting breakpoints through ptrace, and access_remote_vm() reaches it
through copy_to_user_page(). The calling CPU is therefore often running
something other than the target mm.
As in flush_tlb_mm(), the uniprocessor implementation in
asm/cacheflush.h already has the missing case.
No imb() is needed, here or in ipi_flush_icache_page(). Alpha's
user-space I-cache flush works by allocating a new ASN rather than by
invalidating the I-cache: the entries stay, but they are tagged with the
old ASN and can no longer match. An imb() is only required when the ASN
space wraps and numbers are reused, and __get_new_mm_context() already
does one in that case.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
---
arch/alpha/kernel/smp.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c
index 988e397b0b8a..e21bc3920bec 100644
--- a/arch/alpha/kernel/smp.c
+++ b/arch/alpha/kernel/smp.c
@@ -758,6 +758,9 @@ flush_icache_user_page(struct vm_area_struct *vma, struct page *page,
preempt_enable();
return;
}
+ } else {
+ /* smp_call_function() does not call back into this CPU. */
+ flush_tlb_other(mm);
}
smp_call_function(ipi_flush_icache_page, mm, 1);
--
2.53.0
prev parent reply other threads:[~2026-08-10 19:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-10 19:34 [PATCH v2 0/7] alpha: fix stale TLB translations breaking copy-on-write and writeback Magnus Lindholm
2026-08-10 19:34 ` [PATCH v2 1/7] alpha: run check_mmu_context() from finish_arch_post_lock_switch() Magnus Lindholm
2026-08-10 19:34 ` [PATCH v2 2/7] alpha: only use a targeted tbi() when the target mm is really current Magnus Lindholm
2026-08-10 19:34 ` [PATCH v2 3/7] alpha: fix the local TLB invalidate in flush_tlb_page() Magnus Lindholm
2026-08-10 19:34 ` [PATCH v2 4/7] alpha: invalidate the local context " Magnus Lindholm
2026-08-10 19:34 ` [PATCH v2 5/7] alpha: fix the local TLB invalidate in the UP flush_tlb_page() Magnus Lindholm
2026-08-10 19:34 ` [PATCH v2 6/7] alpha: invalidate the local context in flush_tlb_mm() Magnus Lindholm
2026-08-10 19:34 ` Magnus Lindholm [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260810193902.3286353-8-linmag7@gmail.com \
--to=linmag7@gmail.com \
--cc=glaubitz@physik.fu-berlin.de \
--cc=ink@unseen.parts \
--cc=linux-alpha@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=macro@orcam.me.uk \
--cc=mattst88@gmail.com \
--cc=mcree@orcon.net.nz \
--cc=richard.henderson@linaro.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox