Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp293200rdb; Mon, 22 Jan 2024 22:36:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IG3IpKkHXWw1B/39eczFTrxc03kFr6P2DmQpsTd5YQChbV70NHhonFn7BwQdMCFmBOeMbC8 X-Received: by 2002:aa7:ccd2:0:b0:55a:4895:b0ec with SMTP id y18-20020aa7ccd2000000b0055a4895b0ecmr545093edt.48.1705991818728; Mon, 22 Jan 2024 22:36:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705991818; cv=pass; d=google.com; s=arc-20160816; b=h8zh7GkaoTuPs68HB7WU6ceO7P1twoXKw79WsDk2fkUw47BkTwLUyGRJZ2D6G7GUzA MzT01YaEWT0pUiS3nVYPjR5W9+ogHeg1UToaL3E5A+lUzE9nm+y0e5piHg2s+iJ+AFTO lFJQ4ZHEbVIO0LOI/qTidFV+WRNrFCwo80BE6TyDiZpmBLNTEw1YxMTULTXCdSlZ5Hsh QaynVSkKyGskOfqKILgZzvoMNfAKM1fc9gwZ9VQEQ9z3hf7hvp6IiNZr+dTEQEczkByC kZ4m1dIja98ZCaUv/2We4Y8h0CqGVDvBoz2BbD8x8MTuDZo5uG6uRaKjGtOqX8Ddk+95 mXqA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=EtVefLr08glO6kdAFup+tFALJCvCo1ukXn4TXPmMgmM=; fh=wt4w+YVCq1BfYh9M+bNXBMQHnqzOV+Dg3hN1rGPkRn0=; b=z/V+8tKTs2qVWcNbYscU8eVe/dK89XGXkU6AusA0+kYYN62sk5RJ/6S3DeIWB/v4b3 tVu1nPPn8WtcFu3VzvNkplvGxGnHs0mOUNmnTt4qHThkb4fw4K+u+a5zfiGm9r8cvfvu gRmpRuyXO+syyViXODMMDRrGO07fsTFOGgEpcFg/0IVD31N6Q7HWh1X1VgJwMgdwhlEN ObvygRP41SUSbC39XwgTv/HRrwWc4tESgbpri6I2DfF0byUd1NbVsdAGDDWpkvgKWPPP Z14X76/dKPZBrpTLOHLWo+/6YavhNmdVglRQ6W3vDcZCiLH01DH961ZJzVqIVxcKmnik bVLg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Djj/RH3b"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-34796-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34796-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 x7-20020a056402414700b00559678c9a0csi8565218eda.603.2024.01.22.22.36.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 22:36:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-34796-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=@kernel.org header.s=k20201202 header.b="Djj/RH3b"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-34796-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34796-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 7A5F61F21057 for ; Tue, 23 Jan 2024 06:36:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 65C7651010; Tue, 23 Jan 2024 06:36:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Djj/RH3b" 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 8553E51C2A; Tue, 23 Jan 2024 06:36:45 +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=1705991805; cv=none; b=ki6aUgMs80k6179pmYmNJGIsuzM8E3X4A+Y74FDZvD9/+UG0AGFLscQMBbHVZfEHWF0zjgknay4Jkr0N/8T0Jt1EGOXalYSCfiROgGT0bJAUhQnN0kuZWQUkiJs/MFQC9eXE014zrAXneSl9e3Y0WfS7gDTa+T7nMn98+Hj/njo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705991805; c=relaxed/simple; bh=3zQmCmznrHx2SqlPuePLfPAeGr3HxXLwdcMosqQt1Jc=; h=From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID: MIME-Version:Content-Type; b=MAN5ZmOmBarI/+FDt+qtnoX/Yc0Qy6LgEpUXEYOeolGp3/w4x8EpJpGlvodQS7AHP7+kUT+iVwIamdBP2pPOSd6nF0CNtL6t0FGsBCNsweiAunNrOZUoTcf6QIjjyR7l4+K2QaWp60ImfkcxxRhcns6Zr8NFlsH/TEW+n5bqU+A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Djj/RH3b; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7498C433C7; Tue, 23 Jan 2024 06:36:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705991805; bh=3zQmCmznrHx2SqlPuePLfPAeGr3HxXLwdcMosqQt1Jc=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=Djj/RH3bDVaHN3WtezrR+0gh1hIFdsf+LuUmh8LCNkNPz/9vKujzP2WWInL9JENvy ha9US7Nl4ZKBzrjRuIcF0FM2pL2Wy7Jgo7tesiBZH6T0Q7ZnltGyHhWE4AI2UoQeHs zS5NuWZ4H1QS3BbuxJ8J55s5nf/1f+lMw6vLqLP2bi803pWAfu5S+dFGvs4jAAYRXL 47ocinELJvcIXu2MXjbLB/ZzqxkuOhzX+jVScJQQKgVRzWUa/v/Q3WXsDjUwvgoY99 w+ndnEkwk8GwyDi30VwTOfT9SPe+0PyvOBmT+YwVcgkoRsOfdBXMyB2NqujMdQ0MXs v4srBtPyOBBBQ== From: Kalle Valo To: Kees Cook Cc: linux-hardening@vger.kernel.org, Brian Norris , Jonas =?utf-8?Q?Dre=C3=9Fler?= , Dmitry Antipov , Tsuchiya Yuto , linux-wireless@vger.kernel.org, "Gustavo A. R. Silva" , Bill Wendling , Justin Stitt , linux-kernel@vger.kernel.org Subject: Re: [PATCH 62/82] mwifiex: pcie: Refactor intentional wrap-around test References: <20240122235208.work.748-kees@kernel.org> <20240123002814.1396804-62-keescook@chromium.org> Date: Tue, 23 Jan 2024 08:36:38 +0200 In-Reply-To: <20240123002814.1396804-62-keescook@chromium.org> (Kees Cook's message of "Mon, 22 Jan 2024 16:27:37 -0800") Message-ID: <87bk9ceetl.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) 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=utf-8 Content-Transfer-Encoding: quoted-printable Kees Cook writes: > In an effort to separate intentional arithmetic wrap-around from > unexpected wrap-around, we need to refactor places that depend on this > kind of math. One of the most common code patterns of this is: > > VAR + value < VAR > > Notably, this is considered "undefined behavior" for signed and pointer > types, which the kernel works around by using the -fno-strict-overflow > option in the build[1] (which used to just be -fwrapv). Regardless, we > want to get the kernel source to the position where we can meaningfully > instrument arithmetic wrap-around conditions and catch them when they > are unexpected, regardless of whether they are signed[2], unsigned[3], > or pointer[4] types. > > Refactor open-coded wrap-around addition test to use add_would_overflow(). > This paves the way to enabling the wrap-around sanitizers in the future. > > Link: https://git.kernel.org/linus/68df3755e383e6fecf2354a67b08f92f185365= 94 [1] > Link: https://github.com/KSPP/linux/issues/26 [2] > Link: https://github.com/KSPP/linux/issues/27 [3] > Link: https://github.com/KSPP/linux/issues/344 [4] > Cc: Brian Norris > Cc: Kalle Valo > Cc: "Jonas Dre=C3=9Fler" > Cc: Dmitry Antipov > Cc: Tsuchiya Yuto > Cc: linux-wireless@vger.kernel.org > Signed-off-by: Kees Cook I assume this goes via some other tree than wireless-next so: Acked-by: Kalle Valo --=20 https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatc= hes