From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89387C4338F for ; Fri, 13 Aug 2021 08:06:32 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5BA5C60FC0 for ; Fri, 13 Aug 2021 08:06:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5BA5C60FC0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=sipsolutions.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 972C16E558; Fri, 13 Aug 2021 08:06:31 +0000 (UTC) Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by gabe.freedesktop.org (Postfix) with ESMTPS id 54C3D6E558 for ; Fri, 13 Aug 2021 08:06:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: 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=sJrRyJAk0s7nMFwbcLX8dMSTh66Xp6VqgCIIZV7nbU4=; t=1628841989; x=1630051589; b=ObOwey2lq55eDXQkHDgnxpGfiBoUiQnpXshIlUtIScMbagP etiugZR44VcmwxF3cBP9LrsScxVaWt5VIdXF0bpXnxBlx1v8BB01qBVeFk8ktrUiNhguWLwLyEWuS snEwsxo0HEkE7jHtPApEVvLFpf9JVFe4pfb0GTG7E0UpWnmAOssumcECGsNdqQ3T1lDe/h+LlXQQA jCPd/mAVKaonkSkRA05+Ph7WI7G9ebLLgkKJWRvlmE7qp2J+7m17+Unrz/TNe631goh30pc+mIJ+1 h7ZJRD54D1MEbKcEODZiRxrL6q9LzfNpeF2XyK6A4zXGnJbP8TP59gFexhz73vrA==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94.2) (envelope-from ) id 1mERnV-00A8zH-4r; Fri, 13 Aug 2021 09:40:09 +0200 Message-ID: Subject: Re: [PATCH 39/64] mac80211: Use memset_after() to clear tx status From: Johannes Berg To: Kees Cook , "David S. Miller" , Jakub Kicinski Cc: "Gustavo A. R. Silva" , Keith Packard , Greg Kroah-Hartman , Andrew Morton , linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-staging@lists.linux.dev, linux-block@vger.kernel.org, linux-kbuild@vger.kernel.org, clang-built-linux@googlegroups.com, linux-hardening@vger.kernel.org Date: Fri, 13 Aug 2021 09:40:07 +0200 In-Reply-To: <202107310852.551B66EE32@keescook> References: <20210727205855.411487-1-keescook@chromium.org> <20210727205855.411487-40-keescook@chromium.org> <202107310852.551B66EE32@keescook> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.4 (3.38.4-1.fc33) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-malware-bazaar: not-scanned X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Sat, 2021-07-31 at 08:55 -0700, Kees Cook wrote: > On Tue, Jul 27, 2021 at 01:58:30PM -0700, Kees Cook wrote: > > In preparation for FORTIFY_SOURCE performing compile-time and run-time > > field bounds checking for memset(), avoid intentionally writing across > > neighboring fields. > > > > Use memset_after() so memset() doesn't get confused about writing > > beyond the destination member that is intended to be the starting point > > of zeroing through the end of the struct. > > > > Note that the common helper, ieee80211_tx_info_clear_status(), does NOT > > clear ack_signal, but the open-coded versions do. All three perform > > checks that the ack_signal position hasn't changed, though. > > Quick ping on this question: there is a mismatch between the common > helper and the other places that do this. Is there a bug here? Yes. The common helper should also clear ack_signal, but that was broken by commit e3e1a0bcb3f1 ("mac80211: reduce IEEE80211_TX_MAX_RATES"), because that commit changed the order of the fields and updated carl9170 and p54 properly but not the common helper... It doesn't actually matter much because ack_signal is normally filled in afterwards, and even if it isn't, it's just for statistics. The correct thing to do here would be to memset_after(&info->status, 0, rates); johannes