From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0AC278B53; Wed, 21 Feb 2024 13:46:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708523163; cv=none; b=LUt8kdQtaGk8HB/OyKwAQT/NlpEBmNle2QbDa/GIHz/EVGa3u+Zzn1fVv8rKU0uueKNVMcAoknh4NzverlDkSG+dD4rWlUtDllH1SSzkVszWePFKaiTQdxVCeCag8X3P4BHt0US95FEcZ5CEFStgOxd/oJVKBv8ZY8+0xFTlkqE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708523163; c=relaxed/simple; bh=vuktrPgCLNgTq8npsNk9EOKAfWsLeHUkPGDpHRcPnV0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JNfTuMWx7DobJwrgKiPNIDX9KtFgtu0kNvkJWJlxYu1UOXHDnr34ccwqIJn8qxMhhnNAwf1YtQjvwHHOMXxJW5uU/zQRoYK+snJ8lOFhwHvYp1EM0qS2/G3UURj0XeNrjsd4foF7EpaoAazH7BOdcHt1mAOT8cbKyQtKq71eKp0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=f/zuABEn; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="f/zuABEn" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29A9EC433F1; Wed, 21 Feb 2024 13:46:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1708523163; bh=vuktrPgCLNgTq8npsNk9EOKAfWsLeHUkPGDpHRcPnV0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f/zuABEnEJetMFjzqZbvYFC/E6mqh6pUdoDyaJGBRkYAc3GfFuik0qjCHJyLyQ96P Hcd48tyKBdx1lH9j1lmUHyX34ccF+u7JjFjuU+kuzoAWn9/6ZPJ7cLOWr1LPAmJ7Ew /3ABsTKko6I5YXXWeWt5uOY82/42CiNFNMUL7JYM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Charlie Jenkins , Palmer Dabbelt , Guenter Roeck , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.15 354/476] MIPS: Add memory clobber to csum_ipv6_magic() inline assembler Date: Wed, 21 Feb 2024 14:06:45 +0100 Message-ID: <20240221130021.087974454@linuxfoundation.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240221130007.738356493@linuxfoundation.org> References: <20240221130007.738356493@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Guenter Roeck [ Upstream commit d55347bfe4e66dce2e1e7501e5492f4af3e315f8 ] After 'lib: checksum: Use aligned accesses for ip_fast_csum and csum_ipv6_magic tests' was applied, the test_csum_ipv6_magic unit test started failing for all mips platforms, both little and bit endian. Oddly enough, adding debug code into test_csum_ipv6_magic() made the problem disappear. The gcc manual says: "The "memory" clobber tells the compiler that the assembly code performs memory reads or writes to items other than those listed in the input and output operands (for example, accessing the memory pointed to by one of the input parameters) " This is definitely the case for csum_ipv6_magic(). Indeed, adding the 'memory' clobber fixes the problem. Cc: Charlie Jenkins Cc: Palmer Dabbelt Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Guenter Roeck Reviewed-by: Charlie Jenkins Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin --- arch/mips/include/asm/checksum.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/mips/include/asm/checksum.h b/arch/mips/include/asm/checksum.h index 1e6c1354f245..eb15339e58fd 100644 --- a/arch/mips/include/asm/checksum.h +++ b/arch/mips/include/asm/checksum.h @@ -244,7 +244,8 @@ static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr, " .set pop" : "=&r" (sum), "=&r" (tmp) : "r" (saddr), "r" (daddr), - "0" (htonl(len)), "r" (htonl(proto)), "r" (sum)); + "0" (htonl(len)), "r" (htonl(proto)), "r" (sum) + : "memory"); return csum_fold(sum); } -- 2.43.0