From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) (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 977AC442379 for ; Mon, 10 Aug 2026 19:40:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786390834; cv=none; b=coE22s5h7l8wVuCy0/X4xnqlkgNpQ2uh8mQHdZSk7msNixpUebBs/u2ZRm+9KOUAYVfqzDOUydIDBx0BhbFh5B7bUeXQnqoLFeRiOeeEUd460RAUIAYhgNh+qXh6hylJwKD2Rkqf0vDESsSIYmMLdvQA2QgLOShielIWWMLH47g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786390834; c=relaxed/simple; bh=hYk+xarhTPEsRWdAy2yebQ28Z4YDVkB5v5kYWMkVqds=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F8KUgRek3+V19DhXd3rkzp2EAjsda2oLo2d31yZH9M5DM3LWEPyD5ODxNpa+MyU9CvO58auq7RnF21rqyHNwD7qvGBvmQblyoByKNs8BCvyPwoBZYuZRqgy5/OgjJjkhlFraA7aKatShin6mT05gI6y4yWc7KAifLmw64FZFheQ= 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=ZEGtQhsM; arc=none smtp.client-ip=209.85.208.52 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="ZEGtQhsM" Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-69c108fee7fso3032435a12.3 for ; Mon, 10 Aug 2026 12:40:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786390820; x=1786995620; 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=UZlUEzCrTPRBX1FvFK7zfpZyojdDsTGC8+EAFkSxizE=; b=ZEGtQhsMx080qLIVx228RzAeqAhZwwhwkciWUOCi8Eds45zxKHdNFM3vpAgnhcXvzX ZxNLa80y3wPFij9MAX7Vo96OI35FN3+cAXTinp6ZzUsvZQFAGRLGGq/GmFoxdSwvbb5y 5qUrdJNZVEbsp3FzRmG/p3zee4+QDtMMn3bByZcQkkPKPgvjXvxSO8uou/rbcE++oAwx 5f/5JBItDXRmPYTpTnGNVjq+FxCnlbNtkRmRJFDT+jN7Os53P6L6TSd23dqF6RgB2lwW yH44JlI52b2Rw3XLULM6izxR7nllD1t+CCiDlAn1F1OR5vYZyB3SHvVfl2DY7NSvW+kw WBEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786390820; x=1786995620; 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=UZlUEzCrTPRBX1FvFK7zfpZyojdDsTGC8+EAFkSxizE=; b=ZRsMAhed5+17tUXxtZt7gWNfj7DtEjmIOP5445KtAF4ECO3IXGh5TbgAPvYCjtg8Wb 8eoK5N16YMCqWYchgF+iHJLPxL8W0lf9r586IjbgS0mCpWNZ/N42fKaOhq9WbfMQ8MBB joZ+ZByVob2uJBYsmPYXXF05MwA7gvJGv/JjiDnAKVp3iGg8yb0e/0bZGLO8tJv3IiXQ ji1kfd+TA4FSp+8axx6EgMvcw4SRaVfX9WoCqFMYpLgW7MTAfIUyIOJlWfz5BLSp5bxo dwrT9LaHtW3k7sXlOcyXjQhJB8e5bZBwXwNRLRevcw8ZD8MpRgfBTygBhq7KpZ7tRI7v TYVA== X-Forwarded-Encrypted: i=1; AHgh+RrDQLPamNT6EQz5j1gXjJxGgl2MF0Y1HvrimnbDpFpjZHfshBj45zePN49Zy6/jk2rqtTxKOQYRC1P69kU=@vger.kernel.org X-Gm-Message-State: AOJu0YxORgOqHHjLRecBw4zmxnMlfoToejIi4zByaUJoFk4c/oWA11k/ 7hDNhVOdCTr8pP5TzSolksGAJIG5zwZfgjSlo5MkWkmnPy+oZzGRzZcG X-Gm-Gg: AR+sD11iDwyKeubQT/4BCyEQBlk/NumFCy3j/126u+GGZp4fHVp0SusPcS0DaVXJzPC 1fcEcAXvGJZAQ9I7/Qqh4gwJZm//t3FsV/wnIZwYi2e5td7WLt1HhdHrCX5XWoKbg7wuMulDUVS KhBYf3B92TUjHVgwpwhSQb9Cype6KNKJEtz7/HZHHzcGSNAOF07Ha2gSf/8Ffln4xLmWn1tyT7W 38F4fioVCZukq0fpAd6uLjMjMdMCDq9rQRPFXIk996W81mRevslPhvxM9iUk7e/jtGdhd501X6v muQmGudMuwhouD0w8JfTr6i/80tHxrcZfBKVyXi3487bWee/U6ViFYEsx7I9ixZSfY1xOaQt45z 8BFyb7o6gUeG9w22wh+Zb+7fnMD6Z5L3OanD2gNd4UPtJOI06tLgkhkK+UcvDMmorMiCrO1l0Sf UYHD1b2SRzg2klM358QniFgPY//2HebIILDuzPKKUb/ITo3FoVwKAv1AtdubQ4JHVB7kAxIC5dw 9BOpsh8W0VzcHws3C9KBSIT7yKyrOY= X-Received: by 2002:a17:907:c5c3:b0:c1f:1520:4de5 with SMTP id a640c23a62f3a-c20c67fab2dmr191394366b.1.1786390820261; Mon, 10 Aug 2026 12:40:20 -0700 (PDT) Received: from buildhost.darklands.se ([2001:9b1:ff:d701:51eb:176f:63d9:53f8]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c2080a29a84sm449928966b.3.2026.08.10.12.40.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Aug 2026 12:40:19 -0700 (PDT) From: Magnus Lindholm 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 , 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 Message-ID: <20260810193902.3286353-8-linmag7@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260810193902.3286353-1-linmag7@gmail.com> References: <20260810193902.3286353-1-linmag7@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@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.53.0