Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp1181356rdb; Fri, 16 Feb 2024 07:39:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUGopG9vDgGFd6t795ABxFpKQjcL5e7awFpCDEZ5g+0pUbnvpKOhwpz8uSmXPFqNk8cMDhRzHXizAF5v9Pzd8hyT+KhELsMl5+iNdxiQw== X-Google-Smtp-Source: AGHT+IFb4vnLK5hItU+Sohieob48qoh2E0Z8Frm064O5UI3+0j4l1EuivyeD6EJCKabjvjAlBaTi X-Received: by 2002:a05:6402:b4d:b0:563:fc3f:991d with SMTP id bx13-20020a0564020b4d00b00563fc3f991dmr1098698edb.37.1708097957706; Fri, 16 Feb 2024 07:39:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708097957; cv=pass; d=google.com; s=arc-20160816; b=TBT8jj4D2nN80Ihb9TtpnJQgvtYtHIcEc3zvktyX4k1EN3pX1vVg85rHCEsbiJdNHH BS/5fW8xFE4X3T6soXrroVtIiZNdzHfwcGVrkE75rL8oFNbUNt+/KNW0dPhdshPWIpYo i3ZyrKjA0z477VV9jL93gTa5kKRL5+gokQEhIai3XFZc3iOhPUIUWpJEsRRXM9Eo7xTL e+qGkCFRq4oXMsvsY6mZhNFMQLflapPLi4HYiRoQ0JA2ssVbMDoFpeALNKq+zxb7+XTy 9/HxI0Tgsz+BBiei6WW4nEtHNtKlSwosmNfnZbsNQnqjUHqjCuEGgLkPEwyZjCyY/6hj EfTQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :sender:dkim-signature; bh=NRwKtIc0y4D6uspDgYCDd40JBvF9+g5Ek0KwR8dpm74=; fh=oh/dB7SHCxXPk212bmDGqw40eWSzo1OQ7ABa6n8d0dA=; b=mPtfDZFoG/ZM7f18UJLRVH67Ub3DhHqErQ7G3KESn6JUaz50Vk9MHixYfwh8hEsXnG c+aiKmaMLT2jRQcg685wZUboDInoSHyEyu95FiGktBf4cS7lJNXBAUZMJr+9K6EuWalq lGvN+L4Q8nDAB7BSHXFFM6UMPLvcIZsfo1S7WY/jPQ0OQikuCFnJJA3Kwto4zVQ4Mxas QN4oVEFjxs+jyS9dvfH10OPMY/la3pn6p9M4hEGQnjMxwoelQ0VT8j94Gto+h6H/BKc8 WdQd47U4c4WkxpcAjpSg2KX4qdaSoPVYlcewPdc+VLpjMCBdVS8TosVgag3HLKfWw406 3d9w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=lncGKNKy; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-68885-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68885-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id ee34-20020a056402292200b00561f7581713si69259edb.28.2024.02.16.07.39.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 07:39:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68885-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=lncGKNKy; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-68885-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68885-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 4F2C61F21367 for ; Fri, 16 Feb 2024 15:39:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 018DC1487C5; Fri, 16 Feb 2024 15:31:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lncGKNKy" Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (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 2812412FF9D; Fri, 16 Feb 2024 15:31:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708097481; cv=none; b=fZAxdLbvlWCTYXdUl5qbn9KUabpTZziZJ1ry/9WYpMQPEPyPMHRVKFrUuehsSOBiNeMQeWtxVJE55B0Dz7bzv810itmKd1wq+K5Ycj8wRIrj1EdXEe0b6KrZDozbiJGgWoUCuCo2SBDO2EHPuBlbCDk5EO3jAJ6S/QSLdv12FxI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708097481; c=relaxed/simple; bh=mif72V8l/dSsiv6I0YfNK2dgtGn+e1Zy7iPOPLaS4YY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=gxV6mHalXBmH+9ODB2NIV4LSyePbRV0rFa6lfOsR1xG7lhy0r3km7O9Hqna3p9PVxs7jhO6Lc+L/64zYz9+RcQhJjhFbw98XW/LEdUoxmLCOhsatrJRqOLB7wGxiFS2AcxyBJgvqidf0NwpiUGzonj1SH4unyDWesZr2GkXqYho= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lncGKNKy; arc=none smtp.client-ip=209.85.214.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1d94b222a3aso21128915ad.2; Fri, 16 Feb 2024 07:31:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708097479; x=1708702279; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=NRwKtIc0y4D6uspDgYCDd40JBvF9+g5Ek0KwR8dpm74=; b=lncGKNKy2e7HA8pJFZB0Nmw3ZYmf8EXhCuOSShMEw1ArIAifFghK7eydMCZaBlNJXn 1FSgh3W62+o04Mz23pYXWg8gR4jumX40YsC6vbOY+Ywpzw+NQ7/59WZp8QWMxZ2O0znS svvLSjspoRIX7COTD0XF51+L9zp3yeiDZs+QdNrYmwv+RJBXnIdTuwCMy7UiWs2Wjx3s Pzb67rZJimjpwvDMBiERdE3Zim+GIzGU1cv4L/IOEBiTeia7FDFigUcm1Z1Of+uyAYwz 78V4RNwondQiv1gVqvb4kf3H7b3b1IduVIr68tP+NsxUMKQjPewci65ur6f031+0Q6p4 CHow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708097479; x=1708702279; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=NRwKtIc0y4D6uspDgYCDd40JBvF9+g5Ek0KwR8dpm74=; b=pnJCi7wjS+yl/HKDvRXq2kHaB6yDoV8JlUZ053gw23IGJ1CP2Uh2ZtAHrK+VZjvELd OHJZzuLg8GDEk+r5zWIy86tulNriYF/AugO34RHsFSK9Iabmsr5W+fm5XO1/ldfz7GFg yG6nUXtiNwc2dxyjfwjw4U/0vKVMC8EEgjfbEhzzNiMG54L0rruZShTgj2WtM1TnvtCO I70cdPs3pRkShvQdHOBzaA60Lt039dlG6bGolZp7qHzEYlPC85igNZ3bqD1JSgk2gxxK N5OA0kRjs646LuoBwj/sUysy1IiVzbIIo63ZMsAm5sLQib2Aj0uSAS/JH0uYOABEByDb Kcxg== X-Forwarded-Encrypted: i=1; AJvYcCWnAeo7CsvksPMn+DLMItFSYtr/KbgzXsSSxD1gyHVB7Mwaoo5LH0LLoJocDLfIDd4H9tpnDr8Ph0E8owHRCAHzRBJuxw0zRn3X0tmy16qFIM44Fi1XKvh1VRr796dxC0CiQ7K7GQAHgHZT X-Gm-Message-State: AOJu0YzRkdQ1/kLgVounlstw77ZdusJ8J4SLVqaO57gQg/bVQiBms7O+ CrQfJsmluF5Ln7TDdl5Y7U1qsnGm6uvS9VkXUEtszmX0ta22ShAFx2jSg7OF X-Received: by 2002:a17:902:da92:b0:1db:80d3:1af8 with SMTP id j18-20020a170902da9200b001db80d31af8mr7320104plx.19.1708097479228; Fri, 16 Feb 2024 07:31:19 -0800 (PST) Received: from ?IPV6:2600:1700:e321:62f0:329c:23ff:fee3:9d7c? ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id u6-20020a170902b28600b001d88f8f574esm4373plr.303.2024.02.16.07.31.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 16 Feb 2024 07:31:18 -0800 (PST) Sender: Guenter Roeck Message-ID: <2b09c136-20d8-4fef-bad3-6dbc88362318@roeck-us.net> Date: Fri, 16 Feb 2024 07:31:17 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] parisc: Fix csum_ipv6_magic on 64-bit systems Content-Language: en-US To: Helge Deller Cc: Helge Deller , "James E . J . Bottomley" , linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org, Charlie Jenkins , Palmer Dabbelt References: <20240213234631.940055-1-linux@roeck-us.net> From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jIcw5kZ5dGeJ7E7B2uweQR/4FGxH10/H1O1+ApmcQ9i87XdZQiB9cpN RYHA7RCEK2dh6dDccykQk3bC90xXMPg+O3R+C/SkwcnUak1UZaeK/SwQbq/t0tkMzYDRxfJ7 nyFiKxUehbNF3r9qlJgPqONwX5vJy4/GvDHdddSCxV41P/ejsZ8PykxyJs98UWhF54tGRWFl 7i1xvaDB9lN5WTLRKSO7wICuLiSz5WZHXMkyF4d+/O5ll7yz/o/JxK5vO/sduYDIlFTvBZDh gzaEtNf5tQjsjG4io8E0Yq0ViobLkS2RTNZT8ICq/Jmvl0SpbHRvYwa2DhNsK0YjHFQBB0FX IdhdUEzNefcNcYvqigJpdICoP2e4yJSyflHFO4dr0OrdnGLe1Zi/8Xo/2+M1dSSEt196rXaC kwu2KgIgmkRBb3cp2vIBBIIowU8W3qC1+w+RdMUrZxKGWJ3juwcgveJlzMpMZNyM1jobSXZ0 VHGMNJ3MwXlrEFPXaYJgibcg6brM6wGfX/LBvc/haWw4yO24lT5eitm4UBdIy9pKkKmHHh7s jfZJkB5fWKVdoCv/omy6UyH6ykLOPFugl+hVL2Prf8xrXuZe1CMS7ID9Lc8FaL1ROIN/W8Vk BIsJMaWOhks//7d92Uf3EArDlDShwR2+D+AMon8NULuLBHiEUQARAQABzTJHdWVudGVyIFJv ZWNrIChMaW51eCBhY2NvdW50KSA8bGludXh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aVnm6NC8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Helge, On 2/16/24 04:38, Helge Deller wrote: > * Guenter Roeck : >> hppa 64-bit systems calculates the IPv6 checksum using 64-bit add >> operations. The last add folds protocol and length fields into the 64-bit >> result. While unlikely, this operation can overflow. The overflow can be >> triggered with a code sequence such as the following. >> >> /* try to trigger massive overflows */ >> memset(tmp_buf, 0xff, sizeof(struct in6_addr)); >> csum_result = csum_ipv6_magic((struct in6_addr *)tmp_buf, >> (struct in6_addr *)tmp_buf, >> 0xffff, 0xff, 0xffffffff); >> >> Fix the problem by adding any overflows from the final add operation into >> the calculated checksum. Fortunately, we can do this without additional >> cost by replacing the add operation used to fold the checksum into 32 bit >> with "add,dc" to add in the missing carry. > > > Gunter, > > Thanks for your patch for 32- and 64-bit systems. > But I think it's time to sunset the parisc inline assembly for ipv4/ipv6 > checksumming. > The patch below converts the code to use standard C-coding (taken from the > s390 header file) and it survives the v8 lib/checksum patch. > > Opinions? > Works for me. > Helge > > Subject: [PATCH] parisc: Fix csum_ipv6_magic on 32- and 64-bit machines > > Guenter noticed that the 32- and 64-bit checksum functions may calculate > wrong values under certain circumstances. He fixed it by usining using > corrected carry-flags added, but overall I think it's better to convert > away from inline assembly to generic C-coding. That way the code is > much cleaner and the compiler can do much better optimizations based on > the target architecture (32- vs. 64-bit). Furthermore, the compiler > generates nowadays much better code, so inline assembly usually won't > give any benefit any longer. > > Signed-off-by: Helge Deller > Noticed-by: Guenter Roeck That would be a new tag. Maybe use "Reported-by:", or just drop it. Maybe also consider adding Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Other than that, Tested-by: Guenter Roeck Thanks, Guenter