Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2703662rdb; Mon, 5 Feb 2024 15:17:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IGu+ZjUm38Jde96LqSpj1et8z98YkCuKM/ktgHGTZ2yoF8u+ywFezbx1P5VUJgwJliQXbZM X-Received: by 2002:a05:622a:15d3:b0:42a:84e0:baa8 with SMTP id d19-20020a05622a15d300b0042a84e0baa8mr940869qty.6.1707175042778; Mon, 05 Feb 2024 15:17:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707175042; cv=pass; d=google.com; s=arc-20160816; b=lGHJo7P1b3T5n1HFZIuRvo+sN/XWZ8CB6jAXVshOB/mZtoEGz+WDTtL9EWiBSqX1Jv Gwe1uTsHcS/8V91lz0b0TSGI8gseZzOWN1S8zj/KOxwtcDNR/UFibJChHHcQB20Klpho MLzfjOGSkwqZMdntviF2hjEEx6xPsJSVGzHiPau+2b0BEwskWIo5alhmb55eYQ5b2DeD 4fM3JzZlSmgJRDqQN/6QCR9h/paLWy3BBXtW6+ATE267s099mLXmADSZlfYGrdez7+b/ dVxFtp+ph8P9QGch3mJiC7SWqNKI+/9kC0HwPjJ4PWWCi29gxwPIrE461w+biMIboO12 iEiA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=eCZOWWPrBPL36zG6ruJ91qkgKcscRFyWeF6phN+m1as=; fh=DiH9XHwnEnu4h8fOJOgPznDhZBpWgtFVE5mWZmOOeaU=; b=tzLNk/EwCu/G7aPY3eR7NT/aD0SyjS88/bNNfA+1deGgHt5Ik1GAAPCT21ASJNTOuA PSZGaPVGaSw01LevmMfqQHReGskRRBtZV71qyNrxlCnc91V7d1KDQpRPKSVmTViNqexw iqKTohCxhu54hMYkIgBSXI8H01nqczhVFdSqXggkiLaP4iCT7uNp25BJsjMLBkebZc6y R86OSV2u6dYWpHAYQpACjtR9rzhHuKkaWHBdV1HgWm8a9zw77u4KhRek3RU9kSMTRdBp 7E6OvbnICxqGqTUrIvfAMU2PjzxfPIS0j70HUsnpL6WGrQmgyZe+xURwzBSQ+PHdbAvW JAHw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="iam+Ru/w"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-54077-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54077-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCUhBoJwllmh+IbVa+SmRFIdqvSrYxgPu4AqjpOQiqMRDGR/XKgsc44qQ3NNNd0lwn+VapVQWCh8KQX2yQcxjR3mcKqPwfXMrc6g9O6DQg== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6-20020ac84e86000000b0042c2780c8easi1046114qtp.270.2024.02.05.15.17.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 15:17:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54077-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="iam+Ru/w"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-54077-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54077-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 69B171C27ED9 for ; Mon, 5 Feb 2024 23:17:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 26B11482FC; Mon, 5 Feb 2024 23:17:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iam+Ru/w" 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 50EBC4F888; Mon, 5 Feb 2024 23:17:14 +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=1707175035; cv=none; b=AXSpwPNwUdZPO6luz2r2nodxZYFNrdRRkVlzpM28UHCj2ctseUaVx3ihSbxyByz7V0jU6sr4zsfx3/Nfu+Hz6a3rranylv2Yos1M0mBxtgtlrOZi420mktptOsX5RYkN1UrkNvGy00bp63GvCgc04indXZz9tqihP/lExlelm0Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707175035; c=relaxed/simple; bh=iZ52MV6wk4qEUXCTFm8uFjRsoROdS5KKTIS+DxwKGzQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=brQOpxj5xGT/soPGF8Or6pdb/5rJC4G1B4lnmT0+aQtD3qU1/rAP7KRUZcFIV8qCAYhFyJmpp/fXdNR3hJSVj2WIM1ishLruUW+0MiYJoDuhQzEnhNnPRVu/sTPaC8NL1n89FE8dlc8cJew1YV0kaL313G6rkmYlTKaHlcNBqAc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iam+Ru/w; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77236C433F1; Mon, 5 Feb 2024 23:17:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707175034; bh=iZ52MV6wk4qEUXCTFm8uFjRsoROdS5KKTIS+DxwKGzQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=iam+Ru/woLHD2F6Jid7zi1R1F2IQDBUyNrxNXpy9uZa/CnW1S4Q9HPNy7Vp/anVVi dzRmxhM0N+8Eg9mIU35L5K7eLCRQpvttG/SUfF3sfj3aSX0fkbRQj9NU/t4JGxyHzz elT4eLotyzBl7lb7Q4f/xdosbC1VF6F0D/0Xg7Ih9tsuBlXBFh9YdcXAeureje/X+A rGlIW/JgKTV1r+fFhdT/pMXUCoxDosoMRw5/kNXKm88Hup6t6fSwqzBHq9FVlC+tIq Z0OrFu4bUoL8Uyjidh6ASE2GLwUYY3YsGDZgprQ9juPkV6Q3qvpyjHaG91jLE8FAcC f3aDuvBDXcdCw== Date: Mon, 5 Feb 2024 15:17:12 -0800 From: Eric Biggers To: Kees Cook Cc: linux-hardening@vger.kernel.org, Rasmus Villemoes , Mark Rutland , "Gustavo A. R. Silva" , Marco Elver , linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 2/3] overflow: Introduce add_wrap(), sub_wrap(), and mul_wrap() Message-ID: <20240205231712.GC2220@sol.localdomain> References: <20240205090854.make.507-kees@kernel.org> <20240205091233.1357377-2-keescook@chromium.org> <20240205202145.GB2220@sol.localdomain> <202402051443.A813E4D@keescook> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202402051443.A813E4D@keescook> On Mon, Feb 05, 2024 at 02:44:14PM -0800, Kees Cook wrote: > On Mon, Feb 05, 2024 at 12:21:45PM -0800, Eric Biggers wrote: > > On Mon, Feb 05, 2024 at 01:12:30AM -0800, Kees Cook wrote: > > > Subject: Re: [PATCH v3 2/3] overflow: Introduce add_wrap(), sub_wrap(), and mul_wrap() > > > > Maybe these should be called wrapping_add, wrapping_sub, and wrapping_mul? > > Those names are more grammatically correct, and Rust chose those names too. > > Sure, that works for me. What bout the inc_wrap() and dec_wrap() names? > I assume wrapping_inc() and wrapping_dec() ? > Yes, though I'm not sure those should exist at all. Maybe a += b should just become a = wrapping_add(a, b), instead of wrapping_inc(a, b)? wrapping_inc(a, b) isn't as self-explanatory. Likewise for wrapping_dec. - Eric