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 A0C061E86C; Mon, 1 Apr 2024 16:39:24 +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=1711989564; cv=none; b=aoCGVoW8XKgxk1B68J7Z+leo0oQI0hleIZWLMu7BLiOnpGFo0UCkDEWdbDIHZznF9+t9ozeqf6itfpZK7+whvahZ44+wI6QaL8fzDou35l35pEokpkFZy4CjlqdTNGW5N2LDxlT20VB+39BFeeQEoSen8shSRuoyW+6FGaWNOEQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711989564; c=relaxed/simple; bh=/x3rfz5yfp7Aq+GkWOSrUqnrq4gGp6O+6FqeLP3LZAM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YBHwxhC0DEv9r4RKFu9HF0YFAi13r++5qNGZO0XyZIRWR4AKVzce/ReyqvHKuXdjcOUCYN+DOZM2EkEe/rtpn4Uf2Mf9uflBVFcRZlvst4XYvpoStiDuILrTtigi+oBKJfL2UV6HTBmuJ4iR/wjFFmEGUckPT5b1AQ87tlikUFc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=BX7y+aeY; 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="BX7y+aeY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27E7AC433F1; Mon, 1 Apr 2024 16:39:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1711989564; bh=/x3rfz5yfp7Aq+GkWOSrUqnrq4gGp6O+6FqeLP3LZAM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BX7y+aeYJNzELoURZLHqRxSEqYIAQCd+ylYVsqdOJfS+FkrdgbF0/NaGd3flmP8er 3/5dOf2qC9J8UzIMSiHZc+ljjT3IvkCHPf0owQ6Ol5HBpLe9t+z1P4ykxuyKMTEtFY X4zd6094swqeS4HePJhTY0RvoEhWSDFPWcmG6/oM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Helge Deller , Guenter Roeck , Sasha Levin Subject: [PATCH 6.6 058/396] parisc: Strip upper 32 bit of sum in csum_ipv6_magic for 64-bit builds Date: Mon, 1 Apr 2024 17:41:47 +0200 Message-ID: <20240401152549.654770725@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240401152547.867452742@linuxfoundation.org> References: <20240401152547.867452742@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Guenter Roeck [ Upstream commit 0568b6f0d863643db2edcc7be31165740c89fa82 ] IPv6 checksum tests with unaligned addresses on 64-bit builds result in unexpected failures. Expected expected == csum_result, but expected == 46591 (0xb5ff) csum_result == 46381 (0xb52d) with alignment offset 1 Oddly enough, the problem disappeared after adding test code into the beginning of csum_ipv6_magic(). As it turns out, the 'sum' parameter of csum_ipv6_magic() is declared as __wsum, which is a 32-bit variable. However, it is treated as 64-bit variable in the 64-bit assembler code. Tests showed that the upper 32 bit of the register used to pass the variable are _not_ cleared when entering the function. This can result in checksum calculation errors. Clearing the upper 32 bit of 'sum' as first operation in the assembler code fixes the problem. Acked-by: Helge Deller Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck Signed-off-by: Helge Deller Signed-off-by: Sasha Levin --- arch/parisc/include/asm/checksum.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/parisc/include/asm/checksum.h b/arch/parisc/include/asm/checksum.h index c949aa20fa162..2aceebcd695c8 100644 --- a/arch/parisc/include/asm/checksum.h +++ b/arch/parisc/include/asm/checksum.h @@ -126,6 +126,7 @@ static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr, ** Try to keep 4 registers with "live" values ahead of the ALU. */ +" depdi 0, 31, 32, %0\n"/* clear upper half of incoming checksum */ " ldd,ma 8(%1), %4\n" /* get 1st saddr word */ " ldd,ma 8(%2), %5\n" /* get 1st daddr word */ " add %4, %0, %0\n" -- 2.43.0