Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4699706pxv; Tue, 27 Jul 2021 14:08:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqD9eNcR8Mp22oRPogmQbvrrZNMRLnBS3q3oa89xwVic7CA0IpThPgwSlV7MIDSpEOsO+t X-Received: by 2002:a17:906:170e:: with SMTP id c14mr8532034eje.40.1627420097216; Tue, 27 Jul 2021 14:08:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627420097; cv=none; d=google.com; s=arc-20160816; b=bqPJ0pmUVWdEmBc0d3Z4ladBPmKauPl0IMBT8VXQ4fL8WcB94EVodfJL+z6nqbuTKP +/C8+mfSwGpU5YMQ4qoDTxsECylEztq4ocam7cme3teB00x7tfZYI5qVWMJdNin3tVyh o5lwD6QnluB+dUoGs26UsIUjSMsXujeduGS5G/PAm+T+K0J2s3RyIcLb608BqwZf0ZY3 UJpQaVybrhZBeFC0yFneOCkeNMW6OUMf8ez6MhdO2fcg6UQh2/Q8uOFNoiO8hmKV3zC1 X8p1T3CjjA5Lyc1nEoWJbLVCUWhpFUH8vwgZL+RD/KVtgPGweKuf6TzkzbDA7TsgT6Vo aPkg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=p/9n5XlKkS6wfkCIPw1DbbDsmNaE09gzmWAUlzSJHk0=; b=LXSusYmQZf4DstBKVkN4mQ4kpo5Gij+8Gu4XGyZxaagT3tsngMmQNGi/TDAedQHz/H m4b8Pv0DXtbhKfFGQlC2JxHBPYfsfspt6d878NbO20VbqK5SYLSccSRtjLPIdKr7m+bj jo/DGfM4TN6xrR4W1nv+AxEPhiJdMQkGJAigss1Vy+o9jbbcH06I9A2CbCRT08Zw+1Ti doUdYN23+7JZDCmifMBfzP/2WG8tHIgGaFQVGHDjXWBjzXoE3iJ5pQFUs984sV40FMUi Mp8pz5xduhAbobn3SuBP33VF2A4fehcrzmMAcBXA1vpF7REcIRvfWbKrrQYHx1XSxFI1 SrzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=SW72vFpy; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cb16si3745205ejb.396.2021.07.27.14.07.50; Tue, 27 Jul 2021 14:08:17 -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=@chromium.org header.s=google header.b=SW72vFpy; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233957AbhG0VHR (ORCPT + 99 others); Tue, 27 Jul 2021 17:07:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233240AbhG0VHA (ORCPT ); Tue, 27 Jul 2021 17:07:00 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 435F4C061383 for ; Tue, 27 Jul 2021 14:06:58 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id k1so17570393plt.12 for ; Tue, 27 Jul 2021 14:06:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=p/9n5XlKkS6wfkCIPw1DbbDsmNaE09gzmWAUlzSJHk0=; b=SW72vFpyRvi/mMVr/UQMOgHPlxYF/P0e1ZiidnPntTAcbmVZzEGGh8mQvyc6/PMYan 7VRaIK2m566aD8CTsIKSvbx/ZXJ+9IYZ/X/O7tqEYF1n1rL4di55gpn/tChdbhLwc+Wz CXtVDDX34F4hVt3hvgvuSFi8Unf3XeFPwkISI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=p/9n5XlKkS6wfkCIPw1DbbDsmNaE09gzmWAUlzSJHk0=; b=Q5bK9aInUmKkIiCDOPOcqt2VdauoVb0DFvB7rDt8edXC3FA/e+l6zUZvmSBwYyZ1Kl tChwTnTgwX2LTs0ifi7kb3nwWLo/QL0XKrZOfaMSuco/+aSnXVU/GUFUsvaAeNN/utTa CcQXSD5mgZHoh4i7j0BPrkTdX7VdyjChuX3TyvYpt4N9blrFfzlNftLb62DlfAIuntJk CM8EjgZzAgFR+zqo8LiJiDYC8HFKsrGjqusFj1hub5Tcq6dqMMnjYTaAmniJ0F46yZjX +uryr8q207H1mOUtNlFStH2KoMb3VY3QyqEVc5itnN2Cw+Ko6IKliNnjaBYi0LEOiqhp yJeA== X-Gm-Message-State: AOAM530Heeh6m4y6c1rPVt5Hct81XP4cfKw6gO25vCIKv32EpYa7jNrc 5KKsIY8t2DURm+kpkJ7lyxwtHg== X-Received: by 2002:a17:90a:12c7:: with SMTP id b7mr6026153pjg.205.1627420017868; Tue, 27 Jul 2021 14:06:57 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id r18sm5038817pgk.54.2021.07.27.14.06.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jul 2021 14:06:54 -0700 (PDT) From: Kees Cook To: linux-hardening@vger.kernel.org Cc: Kees Cook , "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 Subject: [PATCH 41/64] net: dccp: Use memset_after() for TP zeroing Date: Tue, 27 Jul 2021 13:58:32 -0700 Message-Id: <20210727205855.411487-42-keescook@chromium.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210727205855.411487-1-keescook@chromium.org> References: <20210727205855.411487-1-keescook@chromium.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=950; h=from:subject; bh=setFCuudESAmPvU7TENmlV2MS4FRl7JRml2jjTFJDIg=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBhAHOJKZ5loXhOKkjkBoj4absMkEGlM+ZkGAgDZtTY /isiJOGJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCYQBziQAKCRCJcvTf3G3AJl2GEA CkmbILRtScVKazMb1tWpR5Wl/pQ4wUktuV62qIpYEEpFPkHrnESIQz1ChkzSepdcASTNc4T6oa0NP9 WsXo723hzRQElBcUpAdaEQZWe/aRzQgxz6NuJ0ucec44ap26fdlOUq5jkNdSul5xj992thaeMiUWHl M4YJzdgCpzk8OEKhzLzvrViKkK+IaPDmTMBwHh7u5gjX9tk2OqSPx/ZXot6tYvhFg6/Oy0vv+xHrlp iovAgyyLvDPGPpUEgGj2aKBFXc/d/xxdCSuI3b1elrnHoEBod1sM3BVLd8BTraljZmNAi7wrINJzHM eu2aKaVwpvUJwWQr2BuBBRGeV74y1K8w+/Tvp0fufvz6558D1uGi5jCrDj5V4/Nj5+HrvI6IbWlYbY NSCPJB6kzUX1DRdtcu/6/wMtBFe02I7zLytHfwOcQVNqWqm6EA+YewjYVECp7lCvhT+po+Tp2LcZA6 YKyyOzP6+CTDLOyriNbgoebelLFhlWWOSb9rZGEBhs9FxI4qFJJAxmatGkCcUH0MYAz6v5PPfjvR86 yjrrxYWYwC6cjmhctqIhpAdMEd0GZec2ed3KYFABa9OyGSC8Ezex48JITcr9RBnKCdqux3UCJodziE nhi84Hw40jD0Ho9czi4juaFwDxA2xtuq+zKB1K159GTFsJfOh3CFAYS1xoow== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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. Signed-off-by: Kees Cook --- net/dccp/trace.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/net/dccp/trace.h b/net/dccp/trace.h index 5062421beee9..3c2594da49fc 100644 --- a/net/dccp/trace.h +++ b/net/dccp/trace.h @@ -60,9 +60,7 @@ TRACE_EVENT(dccp_probe, __entry->tx_t_ipi = hc->tx_t_ipi; } else { __entry->tx_s = 0; - memset(&__entry->tx_rtt, 0, (void *)&__entry->tx_t_ipi - - (void *)&__entry->tx_rtt + - sizeof(__entry->tx_t_ipi)); + memset_after(__entry, 0, tx_s); } ), -- 2.30.2