Received: by 2002:a05:6a10:8a4d:0:0:0:0 with SMTP id dn13csp557425pxb; Fri, 13 Aug 2021 00:46:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQvevPASHCcgsZTiX9493nPiLKI6wOeMmtYgsoDdZqHdUiwykfVLG2+EoImMO9NISfZWcM X-Received: by 2002:a05:6402:2217:: with SMTP id cq23mr1481876edb.56.1628840804088; Fri, 13 Aug 2021 00:46:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628840804; cv=none; d=google.com; s=arc-20160816; b=gmom+Avxc9mzEG5kJvZByU6ld5cQF9H3M8ECrFZatxjzAXs3j6wA9m4FwF+lKch7lC J/4cSxElIpCOoWXX46UyyQw6o5aUGNbG0rSeUn01wNX8YaO/hQDy039tfPw6ETjbqyXT EYxqFD9WcBn7iF1WfntxMeDkHV1DbiWiKSctdM2KeToSSCvmm9cJZNFZ9Jl6DOpWYekn GMY8Pk3u9qkWCcZfxROGW2EX5jeStawAL65HR9lhI9IiQl51lYiTWevATK3LhXWq7KAt foeWKESBhaZjhcgx/WxMbCAq8MMH25hP8pPDOl0C4LGlsJgVKU8kaJdF0rePtzYanTZQ B3AA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=sJrRyJAk0s7nMFwbcLX8dMSTh66Xp6VqgCIIZV7nbU4=; b=oYQs4y3vNzKwBtGE9AVpZnuu7TWlcVtLInMgdV/PVc1DH1JYyu/RjykkMpMrkV2lQq AHQA20dGZe+qROKH+lewdQ+vT2mhSgMQOx4trzRQN80US0FFw4WyDmZce9k0dFmYo4sS XES2s1s3HuOhzP4bCz7zIABW6WZXFjzGaIs+mtppMTWQf5Ft8MUL3ElnYcTH/nlUbwzt 2Lrk8Cir043+yeBbkayKQJQPqXAwKlymlY/d+lSM3gCdkS8K6jgLejgic1p1E1w26J1T +QRQtpnoSBGGdptqVKv1sSGGehLmvoAZ2BGcbMwviUgNiV4ufMWWALvAYqrVNPDqkOVY RiiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=Kdt+VYOu; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hh2si982863ejb.191.2021.08.13.00.46.18; Fri, 13 Aug 2021 00:46:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=Kdt+VYOu; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239371AbhHMHkv (ORCPT + 99 others); Fri, 13 Aug 2021 03:40:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238787AbhHMHku (ORCPT ); Fri, 13 Aug 2021 03:40:50 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AB43C061756; Fri, 13 Aug 2021 00:40:23 -0700 (PDT) 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=1628840423; x=1630050023; b=Kdt+VYOuseLyRh98tKIyHWM0dDqNuy9A1CLDJZZBvyBMhRp MaRTVKSHX6U8PutiB796fn/6fdQtu6q4Zj8yL6pw35jdHVV1JhOcUcHFAPyN+kvCeOo/R5y62vdI+ ppF7+qvJr4CWRzMaVGKxyapI/npTavpqjhPUFXu7eXYC9ZlbkVVKtNI3r9DNlQc0cmd0JOte/9r5z Z0arFTGU6S374xTr+wCs/trETSWIqQar3VoNH2wfMcVRVIxeR8bq8M7q0n3+lwLDeR2Sm1jHh0FfN RP/hfK0EG0fGP6eKsoe7XyhwN1YNNwa6sP4ulj8D/etp5Mld1jHk72oegvQAWNqg==; 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 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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