Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp293083rdb; Mon, 22 Jan 2024 22:36:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IGt6BEqFxgC7OxWy0AIZ+hZj17bBCKgD5Y92dxE2P/s0KZb3/uFVhUPHml2/TzhDnZ/b03Y X-Received: by 2002:a50:870c:0:b0:55a:aec:5558 with SMTP id i12-20020a50870c000000b0055a0aec5558mr665793edb.67.1705991791954; Mon, 22 Jan 2024 22:36:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705991791; cv=pass; d=google.com; s=arc-20160816; b=eu+c1cwmv+KgWB7miUvS/aOyo3J+HehPg5e+nArBMN/Unw4OE2NPSj11KEyiTgBbX3 B1S2KbIGvcNW1JbyUEtC48Rfy/2J5t+faYHIyLSnLBWfBSztP1+W8otVCbetJkfn34nM U61qB3Inv3A4nC9Y1VvGER0Nh5ZspXK2jycbGP32INk7dch1noEcwpJtwryxuAZV54Um OnddkyHtBjkPeLK7OgInQYfjX7WdNFNN8aW1aZ38zbJa+1XWZTf4ZR0oQTP6Ob2pTp6N QAM2O5lrnkuI38eaVlxEg6RBBuw1KbUR/jbKAW8UF8j3IC3Tl6OcNafpVEwWrJlsfrIx GXSw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=inMhQrUsnjfb2MLxamI34PUSCpp/Ls8lXO5cYer3uFI=; fh=sFno8koWkalHo2dfcJC0Fk8u1lOvrg9xRbKWcxWY2xc=; b=LbKTDrTL4nr4QNzDGinNIl4StZv/E05vPUamsrK9AbUtVwcZZJFVZ4N2TzEFd1Jg6i 2wV5bdIo0qu88dyN4Hx2Fkf7gR5kDw0ttmJ1P5HFu2imsE3CTayx2XBb7xvQmJQQx0Lp eUwrrnapB8rtI4vkwxoRq/rCZ/CsQFO7VcYKRyyPAy80+Mr75f9DV/C7PAOvYFphrPop Yp8s3J/NVmjDnSLL7VYgsYxhHeegtDjDl3K+bPX3BLwQFf8pZ0fHrdjqa5L9NNppGwk3 0p47xfxJeBKuTrB4z44/5THukSgh1bl38rXFc/JspPFFTMs+43cAFl9BjerSrfr4JDzB wKow== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="AcTUt/F4"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-34795-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34795-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. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id q12-20020a5085cc000000b00557748eacecsi11512755edh.545.2024.01.22.22.36.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 22:36:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-34795-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="AcTUt/F4"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-34795-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34795-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 B11F91F20F43 for ; Tue, 23 Jan 2024 06:36:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9B896524C1; Tue, 23 Jan 2024 06:36:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AcTUt/F4" 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 C0365524A5; Tue, 23 Jan 2024 06:36:08 +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=1705991768; cv=none; b=jH1kyNum8kTS1hDi3gP14+cKE2Sgu+qDq1jZlUZkNKhl1Uwa4SRe1+Lrx4HIcw8XAgM9YWSMNhbcaBzaTWv8va2od8c3tDAfhDSJrRogMuIOp9fjclJAvHXDq1mhJX7M7wEXIkmsWmXw/6nKB3GsC6K5O/JLLBt2e9mrYyaEnGA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705991768; c=relaxed/simple; bh=ukafp/8jphsufSCnQJqqiNhF57sNngiILnTZ9/2MUCM=; h=From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID: MIME-Version:Content-Type; b=fITbyQB/G3V1h2mjy4KsPlkg/nlymJ/c+JKNbDHtpp/5uzikaVK0GOhexDQWwvh0DfH9chGFpv+a8jJN2++APDgIuXdGGxFPWzVPP3JAHi2m+PZ4IAVRDWYHPQ9/Anr0jcTHJlhBiT9NaKK5EGhZMeYzkmeu5dUaD570sy1wACw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AcTUt/F4; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45237C433C7; Tue, 23 Jan 2024 06:36:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705991768; bh=ukafp/8jphsufSCnQJqqiNhF57sNngiILnTZ9/2MUCM=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=AcTUt/F4qkfV/qIWDhzXc2BDbdBiqbN+lyQH/Zv5qtRgRgn686G+wSEgXFB5Y5ZJl 4tcOIbAL8yf3kSXNfybhtuHMzjj9bjNmm7u+OuRY7V/aDmhnanpyH26JS4bFYC3GgG yBLGwax0grx8SrooHE+SceDWq0goqKv2RDKXlljKSh8R6rwR/xACsKG7tmBZHA344e kY1IZPt5z7FsuwKtcdSP3MqRTo2AnH+516c4GCwnJma7v5L6NTw0yTBJSW6GuPjVNg VMogN/UCHUOZMAJtPkeraMKwwC6ZbkIvVUj2YUeclRChYg6MOws/oU70foVwnzUrPr Wlmc0G/k2Oidg== From: Kalle Valo To: Kees Cook Cc: linux-hardening@vger.kernel.org, Johannes Berg , Max Chen , Yang Shen , linux-wireless@vger.kernel.org, "Gustavo A. R. Silva" , Bill Wendling , Justin Stitt , linux-kernel@vger.kernel.org Subject: Re: [PATCH 41/82] wil6210: Refactor intentional wrap-around test References: <20240122235208.work.748-kees@kernel.org> <20240123002814.1396804-41-keescook@chromium.org> Date: Tue, 23 Jan 2024 08:36:04 +0200 In-Reply-To: <20240123002814.1396804-41-keescook@chromium.org> (Kees Cook's message of "Mon, 22 Jan 2024 16:27:16 -0800") Message-ID: <87fryoeeuj.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 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/68df3755e383e6fecf2354a67b08f92f18536594 [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: Kalle Valo > Cc: Johannes Berg > Cc: Max Chen > Cc: Yang Shen > 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 -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches