Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp437817lqh; Tue, 7 May 2024 04:03:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUcjJSwTp2vfvqjqeXfPCtT1Va1aNsdgzDEwGtUVbQxYi2XNFM4tyvrTz5j6ZgQpASQX/xVSCzDAebMpgNhua5Bfl+mZGh9PIR0j+jcxg== X-Google-Smtp-Source: AGHT+IHjidC3tgDv5vWaIdT9UBAUJYkNKncwQj9olfl1CFTqVoE3jer5j7Ry5W3QdFQWgTPNZbRf X-Received: by 2002:a17:902:e54f:b0:1ea:a87f:bd2c with SMTP id n15-20020a170902e54f00b001eaa87fbd2cmr15737060plf.68.1715079830709; Tue, 07 May 2024 04:03:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715079830; cv=pass; d=google.com; s=arc-20160816; b=a4Q1aiTYPJ65eywKUWpzIA5lt5uKdSNQe2UuSAID0LeZ2qS4DtQW2/GGScuisZPzvO R2S57GoXowNnT1ImLN+hkhaKVLDlVWF7XCbkhoCPGhjE6iSGZPXkD+aAPxYMHZKXpvTc MuKDIez/ewhQm/bDjswfMzZ0xiz8pTDIPFfbgqDh97twd8oFA+nxaiI4aNHUH92r/KFS 56zTwIsJ91DUa87zoy2eQ7j7ImTRjNefKOCJaDiJ8rLwoCMnpP5SbHp26NdQad60olei 6+9Lou+5ORIvThxWdGEnyKEKpd6dnWSjezWAiLkmHZ2uyOvgpDHW0ekWrRqlTEiLhKsC +iAA== 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:content-transfer-encoding:references:in-reply-to:date:cc :to:from:subject:message-id:dkim-signature; bh=E25vMthg3vqCpG+5zSE+AGNII/5x83tzP1t01yygGhw=; fh=N3wy58BgkVD/9OlRltnBkffpa3Dp0tLats0Vl1qqLzA=; b=sdYttaYm1WD3xtLCB2f8FThKjaa3+6HwWwLzjw4TCAFvMDBET1jC0+G+Sd8/Clt51k ZkEZyiAv1eDQ80xTzdWBeHYs3lciC3NfhTSpLRaRFGQyunujfo289AdkyxyFcLfVQ0QB sGmKBNpX9PxArswwmhzKXLqAowmkaLVjlPRHkBB1kCgWjqvVFeSabkRDMRbYFp+ergpg pzF/SdlCf3l0PCXx6SKx6l5GVNXN0ofc6GecENrMvw+anR5ap5PL+xdK8afbGY4Gjwhu z+bu8UDmLA4dvAvfXoVHXhsem8SQHjbNccJBtlSCaAgxG+cSGvudUBhgwzjNoFBIpW2z dRig==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=JOGXTRwM; arc=pass (i=1 spf=pass spfdomain=sipsolutions.net dkim=pass dkdomain=sipsolutions.net dmarc=pass fromdomain=sipsolutions.net); spf=pass (google.com: domain of linux-kernel+bounces-171136-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171136-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id n5-20020a170902d2c500b001e3e09beb25si10357844plc.223.2024.05.07.04.03.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 04:03:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-171136-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=JOGXTRwM; arc=pass (i=1 spf=pass spfdomain=sipsolutions.net dkim=pass dkdomain=sipsolutions.net dmarc=pass fromdomain=sipsolutions.net); spf=pass (google.com: domain of linux-kernel+bounces-171136-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171136-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id A032828DDA9 for ; Tue, 7 May 2024 10:49:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C14CA15216D; Tue, 7 May 2024 10:47:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="JOGXTRwM" Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (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 E9BDF14F100; Tue, 7 May 2024 10:46:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715078821; cv=none; b=SIaAf1U9Wr8Nf+9UVNK9i7G3U+mXWgvSjesIvFUteq54+pDnLcjHVwG8vBIm2hKiRLpUnsUqxHPj+jHMap+KRD6ylx16/5GQpNlm3MFWYzm4WNFG7k8HS2BVFbt2gt3ZsQXbnE09HYl0+JMt7/5oEU3kx2Pu7wzPgmKW5B85/Uc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715078821; c=relaxed/simple; bh=E25vMthg3vqCpG+5zSE+AGNII/5x83tzP1t01yygGhw=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=jJQdez2qLdZpKSlPM5uIaCEfNqzAY5UFYVenHUM5fL0lxPhhlquQevjdGRyyFDg3gD6HDV6pwwcB7r20C8iDQlOZaxn7p+KHvd+rXohd6yvHs7TIlN8AtX7P7dmIcuhuWUJ1sGCw21FgSvdens2uVsQ1P0eXpFF/t7mAAKdgtpI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=JOGXTRwM; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=MIME-Version:Content-Transfer-Encoding: Content-Type:References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=E25vMthg3vqCpG+5zSE+AGNII/5x83tzP1t01yygGhw=; t=1715078817; x=1716288417; b=JOGXTRwMyMWrvYnvWFxB5FrsebDM2UbKoW5UJ1/M+IS5FKx SLAtQ+ggip1Fle+eQsaZGwmw6Ggar32LEIIlQufAIrZFIKZqohzdNs0SUHQgZz1j2QMfXdvLubk2V 4ujasEp/Vpcd8u/W1F8oIT5DzdleY/tjgM5GALv38xw2yU6hWAQZcJpK0X2rP+r3XYehY7eZOfNNZ ufQkVb77+w8ebBBRwJG22HR6LY2GAYOHWvHjlmwOmHAi7czzE/ANT/qjGGqineI3bs+TSoIQvJr8W FhnPvAVCJl7o8OYJkWLSiYkN5SYvOb+gk7E9wMvCK6d5vc6ALOv4jAgglQK5yVmQ==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1s4ILQ-00000009X6J-0VJr; Tue, 07 May 2024 12:46:48 +0200 Message-ID: <10256004963b6e1a1813c6f07c5d21abfc843070.camel@sipsolutions.net> Subject: Re: [PATCH] wifi: nl80211: Avoid address calculations via out of bounds array indexing From: Johannes Berg To: Nathan Chancellor , Kees Cook Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, Jeff Johnson , "Gustavo A. R. Silva" , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Date: Tue, 07 May 2024 12:46:46 +0200 In-Reply-To: <20240425181342.GA657080@dev-arch.thelio-3990X> References: <20240424220057.work.819-kees@kernel.org> <20240425181342.GA657080@dev-arch.thelio-3990X> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.4 (3.50.4-1.fc39) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-malware-bazaar: not-scanned On Thu, 2024-04-25 at 11:13 -0700, Nathan Chancellor wrote: > On Wed, Apr 24, 2024 at 03:01:01PM -0700, Kees Cook wrote: > > Before request->channels[] can be used, request->n_channels must be set= . > > Additionally, address calculations for memory after the "channels" arra= y > > need to be calculated from the allocation base ("request") rather than > > via the first "out of bounds" index of "channels", otherwise run-time > > bounds checking will throw a warning. > >=20 > > Reported-by: Nathan Chancellor > > Fixes: e3eac9f32ec0 ("wifi: cfg80211: Annotate struct cfg80211_scan_req= uest with __counted_by") > > Signed-off-by: Kees Cook >=20 > Tested-by: Nathan Chancellor >=20 How do you get this tested? We have the same, and more, bugs in cfg80211_scan_6ghz() which I'm fixing right now, but no idea how to actually get the checks done? johannes