Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp285758rwb; Wed, 21 Sep 2022 22:30:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7H5vsVX5o/x920+2f81Lwvw6IUXwOnj5xdpkpKWX+SXpCDR1+s2w2zo9dZD6dVOWjSQiWM X-Received: by 2002:a17:90b:1b06:b0:202:cce0:2148 with SMTP id nu6-20020a17090b1b0600b00202cce02148mr13540390pjb.84.1663824628795; Wed, 21 Sep 2022 22:30:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663824628; cv=none; d=google.com; s=arc-20160816; b=cqc1YzQ6yb/B4uLP/JX20navk/PKN0bzeNEDo+PIUMQ5z4boRkLQm3wVnGvcrGfCf3 /Ak/706j/IM0dCDiMhRHcQqt1pJM+63kZYrwBZIBzOOj9kaIZA7QgAaSlGNhmNY/02iJ q/4k8o/c0SV/Sa1CF7BEPDu1b/ANNnOsN2zTGCINX3ffHL2eSftK3GtR8mqSXxrt+zRM bSU/Bag0y3oqKGQNlonFnxN3ff9gUIeun1sjXRIOxE/4FSW4x2ElcCI8HOzsuL/1ry6Q 94zgxi1axnl84hcjovxiJaRsuqGQywe3Z96H7ouzPYmp6p6nVNwrzwdxT7ilcrYiKRYw 7kiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1AAj0jz/3WOf/ZinmBg4e5WZyKIExnDIP+4ApRXDWXk=; b=ayASs9jVAVmghDj8lTa718n5DIybJcjVW0nIyX08cgx0AOc1jCGpxacqE4jrRTX8CT j4pAHmh4XvYY5b6DInHthVpEt3SM8NdU+3j7RN2LKYdjQhD6IcOMQaxWkRmZp3MLZaAh vtkp205czXtWIQ/CN4uJiCzxP1Ej1B62mSmMIsj9/HtMfJ+FS6cIXBQ9TR0af+vRH8uh KgnINuY4phpi2dnU1ooaowerX1T7+d6hKUzy+nqiu1VHy34yOHNTlyJWJPu3nb8KQd1Z FoHHRHMG9hAKt7J26YYOCKlCxijypPN4RQfSiqIdr4Hjyk0umfKVKThnndCwSLfootra qA0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=E6vw8sjI; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w3-20020a170902d10300b001782ecb617dsi4438545plw.412.2022.09.21.22.30.10; Wed, 21 Sep 2022 22:30:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=E6vw8sjI; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230188AbiIVF0d (ORCPT + 63 others); Thu, 22 Sep 2022 01:26:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229780AbiIVF0b (ORCPT ); Thu, 22 Sep 2022 01:26:31 -0400 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 715D4A1D28 for ; Wed, 21 Sep 2022 22:26:29 -0700 (PDT) Received: by mail-pf1-x434.google.com with SMTP id l65so8175657pfl.8 for ; Wed, 21 Sep 2022 22:26:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=1AAj0jz/3WOf/ZinmBg4e5WZyKIExnDIP+4ApRXDWXk=; b=E6vw8sjIHY/i68R43dGnMLa/5LLUaNZd7XsoFQWcc3w5wUJdtXNsxsEfsPht7kxdNG JJ1tXBTf3XQqnlgOex/RZ+o0XMhSMgfcjsVoIr6koV6H3KyiaZ1lUXPNyODzP4yferwZ bLRSqfuB8yrx2QNr5YGtL8EgG0hPZHJq7V7xk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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; bh=1AAj0jz/3WOf/ZinmBg4e5WZyKIExnDIP+4ApRXDWXk=; b=kjCEeWd7dFNtaeiuxM/AXCADcCHXz/EWKt3KICKyerzQFddOWpTCjEaYlR3jB2JAYk uduHtSEoE01wwR5B9JUTX062NGWnzWtaKlOqp6hJlG+uIMc6Q+SYawf2NgdwGdkp6mPZ ocZBCAhr5dG79SnH3K2pbA2uiW9ntjo3ofzwkhPz0OtxFV2avDO0Fc2kKN+meErxxBrY wLIV+mO7Z+QeEcb1DueCS+/rL8/q/4466nx/QKSDbSg3YNrjDNyOgYaOEh9WT0j+9G6h ufYrUMwkmeosb+baSPHymZkCHGRGedBqjLGU7U6RJZ93AVVDkf6PYBEuwrnO/2kFPgm2 3n8Q== X-Gm-Message-State: ACrzQf15aIbKa/xGwuVfh8IC/I1y1AxVggP1DUckyppIdkAR82oEgq9H ooU3Gq8dkyyiLKhfGTZAbpYWoQ== X-Received: by 2002:a63:cf56:0:b0:439:41ed:78fc with SMTP id b22-20020a63cf56000000b0043941ed78fcmr1597609pgj.419.1663824388949; Wed, 21 Sep 2022 22:26:28 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id l10-20020a170903120a00b0016f196209c9sm3102876plh.123.2022.09.21.22.26.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Sep 2022 22:26:28 -0700 (PDT) Date: Wed, 21 Sep 2022 22:26:27 -0700 From: Kees Cook To: Kalle Valo Cc: Vlastimil Babka , Gregory Greenman , Johannes Berg , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Greg Kroah-Hartman , Nick Desaulniers , Alex Elder , Josef Bacik , David Sterba , Sumit Semwal , Christian =?iso-8859-1?Q?K=F6nig?= , Jesse Brandeburg , Daniel Micay , Yonghong Song , Marco Elver , Miguel Ojeda , Jacob Shin , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-btrfs@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-fsdevel@vger.kernel.org, intel-wired-lan@lists.osuosl.org, dev@openvswitch.org, x86@kernel.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org Subject: Re: [PATCH 10/12] iwlwifi: Track scan_cmd allocation size explicitly Message-ID: <202209212224.A2F1DB798@keescook> References: <20220922031013.2150682-1-keescook@chromium.org> <20220922031013.2150682-11-keescook@chromium.org> <87fsgk6nys.fsf@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87fsgk6nys.fsf@kernel.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Thu, Sep 22, 2022 at 07:18:51AM +0300, Kalle Valo wrote: > Kees Cook writes: > > > In preparation for reducing the use of ksize(), explicitly track the > > size of scan_cmd allocations. This also allows for noticing if the scan > > size changes unexpectedly. Note that using ksize() was already incorrect > > here, in the sense that ksize() would not match the actual allocation > > size, which would trigger future run-time allocation bounds checking. > > (In other words, memset() may know how large scan_cmd was allocated for, > > but ksize() will return the upper bounds of the actually allocated memory, > > causing a run-time warning about an overflow.) > > > > Cc: Gregory Greenman > > Cc: Kalle Valo > > Cc: Johannes Berg > > Cc: linux-wireless@vger.kernel.org > > Cc: netdev@vger.kernel.org > > Signed-off-by: Kees Cook > > Via which tree is this iwlwifi patch going? Normally via wireless-next > or something else? This doesn't depend on the kmalloc_size_roundup() helper at all, so I would be happy for it to go via wireless-next if the patch seems reasonable. -- Kees Cook