Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp904773rdb; Fri, 26 Jan 2024 14:57:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IEL7VZB3PK7OuJxDPQ3HpVnp5rfe1Cu++JOf9GmbS20ZThztefk6XARZ3S5c+S7pKnKU10t X-Received: by 2002:aa7:8716:0:b0:6dd:889e:622c with SMTP id b22-20020aa78716000000b006dd889e622cmr550987pfo.35.1706309868656; Fri, 26 Jan 2024 14:57:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706309868; cv=pass; d=google.com; s=arc-20160816; b=GWbmqPWZyGYqVa1SvTTm9WWyjCXk5b3etMMGdQDbTwbdq8kODsp0dFXav87iMv5dvd zsAdT5UHVGu4Xun6d89fKWXv3g2GfiTCxrsZL+eBJM2JQKXVCYhqw50UFVNRcxaZ3r/S mSv32lb1cqUTWQz61KV6w4+5qKa+NKM2UDSKncEP3ubcb/FyAAsKpm3rloLmHfKmlAW+ ZhN268hionDs2G7ple99RHzs02ZGaNQW1FAd+WS0IilvWtyZseLd1IOdgvs9eQ5oeZN6 oWKyCf3B7PqBWMoTu5zjF8NIAUuOHNLM+w6jKXhJHm67CD9vuBRJQ9zT9IvVb8iZntJ6 pIVg== 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=gNeQV+teY78A4CeH6MOUnq15lI/jHlKDDnV2ttEl5UM=; fh=ipd8sD6aBOsntQH9oAGzkaZadm8qJmB0LXYZdSRPxlk=; b=tQZZHYq9AlsjclqFynqsg9/D/2lEUSuvVnKEeI2+SbLfaJrs5Usx9ytfvnImTB+/jJ 7iCdzCyWN1UoMzCDXcbA/MMTX4rqzaFFz5hxZLmXTJyrp+/B75iQI0DnAXeTfV79pzuf AeJd2NmJeiiJSHzzUzWfDOYK/8KfJEF0g/GknAaQSUbOYQu+ygqAeoW8LdflgEKTF+yI PiwbZlzHhC1hI2SX1FijaOr3b4FPAzKzUYYzkhwIHRkrvIq4LD9Mt8PGjd+kid8O/8lq 7YQFzQN7OWKw8hg/HNhgSg2GdGgS0ElbuywdG5BD5nlKRfOAT9bvFRTqfWKKoxXMTbKp a1CA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=EpDBaDip; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-40800-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40800-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id e11-20020aa7980b000000b006dbd5165fadsi1840690pfl.100.2024.01.26.14.57.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 14:57:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40800-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=EpDBaDip; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-40800-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40800-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id B5C41B215A4 for ; Fri, 26 Jan 2024 22:57:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B60AF56756; Fri, 26 Jan 2024 22:57:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="EpDBaDip" Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (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 89B3155C36 for ; Fri, 26 Jan 2024 22:57:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706309853; cv=none; b=azgd1ayeBpuuZMFT1/6O6/Ssu3rEr8hmNuszAc2In3REIMijJ/MTSjiyNjE4JAHGb0Z6eRQfO4Xu04ED/WsTgwMhROr4plVVWjj0BUCjPvGhvVkCRHJowxvt/ZDnw9N2uCFZm5yCf46yBeTG/P/8GqpmV/tVl9ML7iuMLfVMhvA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706309853; c=relaxed/simple; bh=Zm28gy7JneQI86vjRiocJqTdrtybNTFIpBfp44vYclc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=rS+7EN6sgZ/oSDrOySWg5Hi/CvP2L9+3B751oQdOr7dr0dlhc/VRDfzkmqIUzNOZ9h/fvP8Ra3lPLpnne4TcCOI9m3f2biUTzEZZcOwZS3RofjcQYMr02/50jNLaILgUU3MuAA/L4dimDOunemxL+wLAzv4agXk51Vk5cHNsGI4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=EpDBaDip; arc=none smtp.client-ip=209.85.214.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1d7881b1843so8611705ad.3 for ; Fri, 26 Jan 2024 14:57:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1706309852; x=1706914652; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=gNeQV+teY78A4CeH6MOUnq15lI/jHlKDDnV2ttEl5UM=; b=EpDBaDip+p2gkkUEisyEBiC+ZEK4KHlFaZkIisdXF0E/pS53NqYqDwi3o3b3cTvdtb swS5BqrYS9VHX95bAcjWgG1hQ8Jngwv01+rKjeIUMKJGjeUsGmU5R31sU/2bRcWddttT 9V3GyJ2nWV2qSE/4pXXaJCVPNGf164TgQEbaA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706309852; x=1706914652; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=gNeQV+teY78A4CeH6MOUnq15lI/jHlKDDnV2ttEl5UM=; b=HUMiRppYtrKmdireKNnnYGo87DF/UpIWVqOkMPM5zwBdIrHLmqBU4hnDcZdtYi289I pRGrQ163XjKN+Ine1LHLfytxeFOdal7Y/IwYuAqc1BGuxxX/Rqu0HruqkFvOPFCmj3fj BcwKoN26igMIJDqotrnfhPqDzkZ5K9lk4lmXkfpYGdcKOtbrraZFDWIm0K9W05XN1XHC grprA8huweq39bc5g9DtDKqmIJanIzJMwz0ujYDcnfR4oxqvjg606t3h6txEIpN7pJAi TdGGKXmA6hSe5TOXXSnN1c3WpTCudH+getaBMnb6Bj+CSvzrm6ZhWDRaGSaqe9IG/8GZ mwgA== X-Gm-Message-State: AOJu0Yyt6/jSFzi+AC5WCSad+JVbP4+wrXwhIImClrrTLH0sYh2IU0ez GAkCwNZIZXOVdqJ16I/6QZ2Gp/voklxJR5z5/SBbAHxQrK2nLkWD6PubmcY/kA== X-Received: by 2002:a17:902:ea08:b0:1d7:24a3:278 with SMTP id s8-20020a170902ea0800b001d724a30278mr627215plg.91.1706309851913; Fri, 26 Jan 2024 14:57:31 -0800 (PST) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id m9-20020a170902c44900b001d71649bf9asm1413199plm.252.2024.01.26.14.57.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 14:57:31 -0800 (PST) Date: Fri, 26 Jan 2024 14:57:30 -0800 From: Kees Cook To: Justin Stitt Cc: linux-hardening@vger.kernel.org, "Gustavo A. R. Silva" , Andrew Morton , Nathan Chancellor , Nick Desaulniers , Bill Wendling , llvm@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 01/82] overflow: Expand check_add_overflow() for pointer addition Message-ID: <202401261456.3D126A50D7@keescook> References: <20240122235208.work.748-kees@kernel.org> <20240123002814.1396804-1-keescook@chromium.org> <20240126225257.lfgeom4rhjzx2wrf@google.com> 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: <20240126225257.lfgeom4rhjzx2wrf@google.com> On Fri, Jan 26, 2024 at 10:52:57PM +0000, Justin Stitt wrote: > [...] > > /** > > * check_sub_overflow() - Calculate subtraction with overflow checking > > Does check_sub_overflow() deserve some more love in the future? I > imagine "under"-flowing pointers is not at all common, though. Yes, though I hadn't found any cases of it yet in the code, so I didn't want to add a helper that would go unused. :) > Nonetheless, this all looks good to me. > > Reviewed-by: Justin Stitt Thanks! -- Kees Cook