From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej2-f12.google.com (mail-ej2-f12.google.com [74.125.228.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EBD4A45D910 for ; Wed, 23 Sep 2026 07:49:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.140 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790149783; cv=none; b=K+5FA1YeT3AJ24KAOeXC7ov4lv/0mjPJroJnssLUE13Qbf/UUEPZ58yd4yiqpQEl0gvu20uwBnnNrfqisMpcrKkKaIkVUpj/maJzy4tdDM5xo8f7TJ6jYNpr764nH6y5lnIXVoBEzlNP+f8iBvs60Is2CmXgCCKIIXoY1iyQvF8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790149783; c=relaxed/simple; bh=x1EO1t+RhKNeTSsJq6ZLnxGbgzYj7ObuT+4PdV8PdPs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YMdo8hKvM5d6+D6ZBNrBT4Q9b0uV2P4fr6+SBXExxvbO9+ljXdBfoU6mf+qgg2q1V+GV+hRUr4Ht9482xEcpUIB2luEvlWAIlte6/WHPP0n+cfh2ZD5chJULuDgJx7020IE1NvIKyHUx7OrDLRTdSSvH1psUMvk0k6waV6Ctxhc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=E1Ao9z2v; arc=none smtp.client-ip=74.125.228.140 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="E1Ao9z2v" Received: by mail-ej2-f12.google.com with SMTP id a640c23a62f3a-c2940ef15d3so77357366b.2 for ; Wed, 23 Sep 2026 00:49:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790149776; x=1790754576; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Jgp+ZrcyR2hZuyp2AvG7ZUXVguQdflnbvJs857sicKc=; b=E1Ao9z2vHp1r7M2uqh+YkOjFPoiVDGg18ym4TRyYXszviGJuWGRj/PFG56sP5OpEmA RjDE2Hha1XGocy69q414mvVmsl+j3E3+fiImx/UjYwDC2KNGn5TyC6w1X8TwstfoeG8T 2YdAV7IdBK2Mzr4D28bnksiMqXLl1gGey8AGpaKBdwqD4FKXQBVQNIEjnlv+geAOmWl8 zqGp/cZcx1EChlOMGEYISVJ3J2StBqZ1V0gPfhFeAhSAOvSQxbTHE7qY6ONOwHOuNWBX Nh0ZNNF/Jf/W+J8hE9UE0ywqJtSdpkfUz70AxryVc/cVHOZAsB2r00PwoGfXqS/VrrYp wtUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790149776; x=1790754576; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=Jgp+ZrcyR2hZuyp2AvG7ZUXVguQdflnbvJs857sicKc=; b=t2eJ8B/g0lqtWrLYc7Jaz/MZz95l4tSleR1x908pWbsu8IlYwlWU+rYOkD5r+DwHZu SrnqDK3eLORhFY90KXJBD6gq3nDL+PlO8A8dibx6U66YBuuM7Luy5/SmVRefsernk2kt bjq8OSL+RMiVFq0X459VSpQLDJFfRBJUvuvxDQJM6cguecbSU0x/lwuERPVduy3iTFX8 G3ndu7xubI2U5+SiO3ext3quogojq54Dd/05SXgRteyfeAYxhLa0FlRbCir79CLLDxFY Efaptt/9/jL7UQJ6j/Q7fxD/1F9xoow3JUFbYPAvuiDS6JOJR74X6ZPtazrXXLDsnm5S lj7g== X-Forwarded-Encrypted: i=1; AKwUvBwG9CG2ICBvFXjRY2C0asHdkiXn6yuA5rqVm/t+SbEGBly8gOb21zliUVEfsoDGj8SKFVfZdfKlLXVKrQ==@vger.kernel.org X-Gm-Message-State: AFuF++n1BxBEXrkfpLGsi8IGX/s+GV3KrZbZjMfRE/nxDrXdEGaxB6I2 97+deANmW28RMBORRG1tGhrcZf8g5JqOK6stu/qfEhScNkLzyOOH0qSe X-Gm-Gg: AYBFou3JbNJib/+dsnUij7/CGOr8rOczVaHxHt7+Nh8JzJY2SN5dCai7fozvKpgrx3I 2QjfNmlrGH+2cFYgghW6dS0qZSQ/JlNX+CGBLVBliQI8NvX4/4tLXeg1JdKEyaH45pryUl+qBRs CN5Y8nrNofacdNhg/IuC15SLFSBf0YKDaT6PnzzLNvoHGdH0p3MRMiO0GmXyDg/CS51tMLEMzfY x7ip5x9IOXElJYGwq6wZFH4VZgWZdgXE4P/TXHUCSHe+AVdG0PA41MFcTP54jD7Lx/+t6cWKEsI t7nCaigylnbTcHECOxprqcllkN0YrsyfNC1EiEuB7/0DmFKMhQ+TRQjorR8jTTrVn6FYHm/gNeX hRQeakeZFgmVZ6W9yNL6SmQT2UnuAkW+fHeSnPsXnxg8Xt1HetCjLjojI9e4w9TqucWW5nG70X5 Nyu3/xpHtWNGR6XlBCrKx0WSZ/VcxhMV5Oj8jPAftEbeAd20fi+rov1dPMBlvmFkOt3ofKC1CY2 r4IQz20JbRf0VkStHhUpOIsnUR7TAb7K+9trbXW X-Received: by 2002:a17:907:3e8c:b0:c29:f5d5:5a96 with SMTP id a640c23a62f3a-c2aae1d27damr126462866b.32.1790149776099; Wed, 23 Sep 2026 00:49:36 -0700 (PDT) Received: from buildhost.darklands.se ([2001:9b1:ff:d701:51eb:176f:63d9:53f8]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c2aae5c6f5asm64951366b.15.2026.09.23.00.49.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Sep 2026 00:49:35 -0700 (PDT) From: Magnus Lindholm To: richard.henderson@linaro.org, mattst88@gmail.com, linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org Cc: linmag7@gmail.com, stable@vger.kernel.org Subject: [PATCH v3 7/7] alpha: invalidate the local context in flush_icache_user_page() Date: Wed, 23 Sep 2026 09:47:50 +0200 Message-ID: <20260923074903.862898-8-linmag7@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260923074903.862898-1-linmag7@gmail.com> References: <20260923074903.862898-1-linmag7@gmail.com> Precedence: bulk X-Mailing-List: linux-alpha@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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.43.0