From nobody Fri Jul 24 22:56:48 2026 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8DAD722068D for ; Wed, 22 Jul 2026 12:28:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784723332; cv=none; b=uvCSYhumQzUq/IH/tHgwxnkPxcnMCnkV/AL4UmO7cyi3Z1xQhXNt6dsg0QKQiHMdCimegxTH7uPNKt8BdYXY7W2eOxqgXfLSPDztQa9GHfzKXy8Lb+ag0rPhOObb1D6qDqyUR6B1sEF3kH2HDxYqjTsegfDt/MZj1u5jRymAY6A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784723332; c=relaxed/simple; bh=8JObLPk4bRFGMYDDkHTjoHj58CrxdNYcMjsaNFymvwg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=dtDEGRBrrPM8NGDxU4s/w8yqRM1bZbSV289+ew67dFnWQ52d2Dn+FrB6jE5SLQTVUOaSD/o2VKHzgqRbfqY677PiE1dU3zdISM5OunZcx+h07wP8T4W4Vmf6Z4Xia6v1iITqj7A5xvAluCdL0MyW5n6ei/WmqFm4xhcVJkMRw/w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=isslab.korea.ac.kr; spf=none smtp.mailfrom=isslab.korea.ac.kr; dkim=pass (2048-bit key) header.d=isslab-korea-ac-kr.20251104.gappssmtp.com header.i=@isslab-korea-ac-kr.20251104.gappssmtp.com header.b=hHiCsJks; arc=none smtp.client-ip=209.85.214.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=isslab.korea.ac.kr Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=isslab.korea.ac.kr Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=isslab-korea-ac-kr.20251104.gappssmtp.com header.i=@isslab-korea-ac-kr.20251104.gappssmtp.com header.b="hHiCsJks" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-2ceab75934dso132529155ad.2 for ; Wed, 22 Jul 2026 05:28:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=isslab-korea-ac-kr.20251104.gappssmtp.com; s=20251104; t=1784723328; x=1785328128; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=YtMV7pbyivyJnV1bBaXBXi5l1WS4Cz/tds4j9Pl0ClM=; b=hHiCsJks55cjLA/EPbMEdez0CLEdrNLftU6AyzFpO4OG2jvWia4w7NgE9TeKRfflQf Yzh5q/+pITYuU+ugKDhZjqe+4S0vgdwFei/46iSIoIWlAhPr2YHurMz2kXiuTemClRem TZiBFKJSNMs+gD8/5Zt/r9BNOQZH1Q3eUHG1nk9Jw/34yY3abtGFXjUB8sCQwxLyJifk 56krmuxHZJCedSiKYZm4PQpaD1NWtHuJz4dw9yVzj3hmxgd+wwv2B/GkYyryKj3clD1Y q6TTSNibue/ldJWu9G2B+7hR/KD3rXnymTIyk2vMNMc2+2esm8p4xiHY2uFh8MvKlJmh oWow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784723328; x=1785328128; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=YtMV7pbyivyJnV1bBaXBXi5l1WS4Cz/tds4j9Pl0ClM=; b=mCO9pARpNGq1hceaB96qCqBXjQ/KX0mQVEibzD7W3a4mLlFXDKSYj1/4D/OMM5t7+b rF2mqPNeVXIsbJvVtIihNa44ctFJD4uFQgQT1mxTNdJTuQcl34KHf9E1gNGEodge8jqk FY7ClHWHfAhDgYaKlMSIFv+0uWVqEVhPyvB6lPfjXgdZYLiHSS05zqvQO+xbacJecvIl 0fgbwdxt+bzJjVR0lK9dIrMhGxXxN2/QREiddRTuOP34FowQ0tF7vnl3F+tzFdHTikk2 hRellwIkZ0JPKltvdxEMaA3eru/hHHjPx2jhBc0MJ1NAT65F7oa+pGr7yWqkkGHc5wxD E3QQ== X-Forwarded-Encrypted: i=1; AHgh+Rr++OsKyT4hvdVa898JkZRyn2L2snspC3D/i+Cr3Cr/xtk0gY2Z2OIE3VBAMCbDsO+Mm0pbjPfvJvCNipE=@vger.kernel.org X-Gm-Message-State: AOJu0YzXC4bGanpkC8mY10HYmM9+pr3vXcrlrj4cilI9zKWUVneAIRQr 9YKyghhoHt5gqbp2BPHGYex2U8yU/cKD8weBebSwZwi0zQWxMKOh3Icf0XzipWOgEuuUHQS75Pe 4k6VNkLxrXQ== X-Gm-Gg: AR+sD10vxxBkjxXucTH6maY/5VzBWUJv4ii6hzGW2OLL4FMFgJI0U6zuybHyBrXhnuz c87wQvSTXtlaMFgmCSKShUFj8ERrTn1nS19o7fQWfaxdkvgSmr8EYJx/8hH1hAv5RN0sd6/wa0e Xrz5YGp7/OIRgp5G0kFxnF/PYgEt29z8ydfk6AkqFruGPHlK8BWaoPtwYNhNL9eeaCt23e8toBH l+UDTLxtOKIU0IsoojQeuVsEdRalUSEbEaFVJe9P99lHj6p5rOGJgRLMk6HYMpbrROIFjyvb2E2 8sjWEe2GtpgxD3Ey5YZ9JtDzoAZp9hETQXBi/t9j/xXMEtaHnR/yfguBt9zqUyKr592U4FeeSeS iQ4nmmVnjw7jZQMSFNnUPRsraJzUMhnZ5Y//tMaBRhJxW5r+o9ZZM6CWDDnjS2Nc/mDC/+5SMiS fN5p4qIk1EyCKSBk2JvayabQ== X-Received: by 2002:a17:903:26c6:b0:2ca:5a42:d8c5 with SMTP id d9443c01a7336-2cf34a318damr238202195ad.46.1784723328403; Wed, 22 Jul 2026 05:28:48 -0700 (PDT) Received: from localhost.localdomain ([115.138.38.139]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2cf8efa39e9sm14057355ad.10.2026.07.22.05.28.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jul 2026 05:28:48 -0700 (PDT) From: Yehyeong Lee To: nhorman@tuxdriver.com, netdev@vger.kernel.org Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, idosch@nvidia.com, jiri@resnulli.us, linux-kernel@vger.kernel.org, Yehyeong Lee Subject: [PATCH v2 net] net: drop_monitor: fix info leak in NET_DM_ATTR_PAYLOAD Date: Wed, 22 Jul 2026 21:28:17 +0900 Message-ID: <20260722122817.5548-1-yhlee@isslab.korea.ac.kr> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" net_dm_packet_report_fill() and net_dm_hw_packet_report_fill() open code the NET_DM_ATTR_PAYLOAD attribute to avoid zeroing the packet payload before overwriting it with skb_copy_bits(). skb_put() reserves nla_total_size(payload_len), i.e. the header plus the NLA_ALIGN() padding, but only payload_len bytes are copied in. When payload_len is not a multiple of 4 the 1-3 padding bytes are never initialized and are leaked to user space inside the netlink message. KMSAN confirms the leak for the software path when the packet payload length is not 4-byte aligned: BUG: KMSAN: kernel-infoleak in _copy_to_iter _copy_to_iter __skb_datagram_iter skb_copy_datagram_iter netlink_recvmsg sock_recvmsg __sys_recvfrom Uninit was created at: kmem_cache_alloc_node_noprof __alloc_skb net_dm_packet_work Bytes 173-175 of 176 are uninitialized Use __nla_reserve(), which sets up the attribute header and zeroes the padding, instead of open coding the attribute construction. Fixes: ca30707dee2b ("drop_monitor: Add packet alert mode") Fixes: 5e58109b1ea4 ("drop_monitor: Add support for packet alert mode for h= ardware drops") Suggested-by: Eric Dumazet Signed-off-by: Yehyeong Lee --- v2: use __nla_reserve() instead of open coding the attribute (Eric Dumazet) v1: https://lore.kernel.org/netdev/20260722104419.273358-1-yhlee@isslab.kor= ea.ac.kr/ net/core/drop_monitor.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c index 2bf3cab5e5..b4d1ff2829 100644 --- a/net/core/drop_monitor.c +++ b/net/core/drop_monitor.c @@ -671,9 +671,7 @@ static int net_dm_packet_report_fill(struct sk_buff *ms= g, struct sk_buff *skb, if (nla_put_u16(msg, NET_DM_ATTR_PROTO, be16_to_cpu(skb->protocol))) goto nla_put_failure; =20 - attr =3D skb_put(msg, nla_total_size(payload_len)); - attr->nla_type =3D NET_DM_ATTR_PAYLOAD; - attr->nla_len =3D nla_attr_size(payload_len); + attr =3D __nla_reserve(msg, NET_DM_ATTR_PAYLOAD, payload_len); if (skb_copy_bits(skb, 0, nla_data(attr), payload_len)) goto nla_put_failure; =20 @@ -831,9 +829,7 @@ static int net_dm_hw_packet_report_fill(struct sk_buff = *msg, if (nla_put_u16(msg, NET_DM_ATTR_PROTO, be16_to_cpu(skb->protocol))) goto nla_put_failure; =20 - attr =3D skb_put(msg, nla_total_size(payload_len)); - attr->nla_type =3D NET_DM_ATTR_PAYLOAD; - attr->nla_len =3D nla_attr_size(payload_len); + attr =3D __nla_reserve(msg, NET_DM_ATTR_PAYLOAD, payload_len); if (skb_copy_bits(skb, 0, nla_data(attr), payload_len)) goto nla_put_failure; =20 --=20 2.43.0