From nobody Mon May 6 12:53:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=google.com ARC-Seal: i=1; a=rsa-sha256; t=1641494632; cv=none; d=zohomail.com; s=zohoarc; b=gedu1eqJXjUpNHkj9Zdiao2VgcNVMgE1FI/CRVYn0BMg7vy4LAiLjaBKXHQ1dgdwn+BnWlQo9Um6UiADW7touYULXCuX5runC7/nMQz5i207ATTXTdPrGtIC25VWwakiDZutZ9FcMO4ffZQIJDIn8T6DWFidD1s5Znryu/cCc7g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641494632; h=Content-Type:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=/AzMEpoNYNeU2/S2JWMtbuGiTrA3Gy9xclxq8W0oQxI=; b=H+50J+efNvg9wTWP9qp1cBJ/ggE50rtqI+c5F9qbhdLjtNZt6fhBZwfKIFMR1sQu30MhNWEhFKAFV8gpNwDAIMtVPJ4NTeMJ0vvkxvdyQ1X8/SjKsPxRiA+/4NJOP5UQvTkNEH/m08uuaN6+4Q9J35Or/LbkJj6aJhUCeVN0ABU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16414946329061004.767456928747; Thu, 6 Jan 2022 10:43:52 -0800 (PST) Received: from localhost ([::1]:34564 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5Xjr-0004vJ-2s for importer@patchew.org; Thu, 06 Jan 2022 13:43:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35590) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <35zTXYQcKCsI3mv12zmowwotm.kwuymu2-lm3mtvwvov2.wzo@flex--venture.bounces.google.com>) id 1n5XdY-00035E-33 for qemu-devel@nongnu.org; Thu, 06 Jan 2022 13:37:25 -0500 Received: from [2607:f8b0:4864:20::34a] (port=35783 helo=mail-ot1-x34a.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <35zTXYQcKCsI3mv12zmowwotm.kwuymu2-lm3mtvwvov2.wzo@flex--venture.bounces.google.com>) id 1n5XdS-0006pP-Bg for qemu-devel@nongnu.org; Thu, 06 Jan 2022 13:37:15 -0500 Received: by mail-ot1-x34a.google.com with SMTP id 100-20020a9d08ed000000b0058f1b3acf6eso893705otf.2 for ; Thu, 06 Jan 2022 10:37:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:to:cc; bh=/AzMEpoNYNeU2/S2JWMtbuGiTrA3Gy9xclxq8W0oQxI=; b=j08v8kFVCQbaUoIPsTlORQb9USXA3Hd11arpBTh/AoBqlNNXFmT404QmTpiBA38xIX jNKTXd4NvIfM+l9V24rP0bM2DUjcpwsz2DXVcQl+z0iegMZX+STyIydgRwFIRR//9445 dqlEEw0gjq38ljvr2X2p2NDScU7FXXWGOSWKBlbevfYHMxaKG+Afjj8acOgkpbtn0sO/ K2iJetJcfRXuyOn3aGtpOGzI4UV7VKWoCkaWOwWkyR/u6CR8S0mizxk1qI4Pn0CPcTg4 61VBW2jHVGXwcrAiNp3QRfWs/hMKcGrGSUcsWCl9pzHVqga2XkW/Gx1WJcXqeW0OaFui A4mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=/AzMEpoNYNeU2/S2JWMtbuGiTrA3Gy9xclxq8W0oQxI=; b=gQUIkQb50uLGDv5VLESoTe6rIYe/dkKvSQe2irmI5vIKjpyTLBR5CkB6mIHMuubj55 quWGops7WTppi0WTTs9NkAacCnoDHkfBfRhLzFPkveZT8kXKl9kk/iu2FNcYlIkA9PWx xuv/YdNb9919nefJSkbV6Bpn+bAvM8yqkK+ynzeUHbSlu1ekMx4MeTttqnIzKneKnAd1 +9kXLp9NiYAfPJ5KbkqPMXY4PMensOhLvzS6oui12SUa6hYb/+drZakpwUfhT6LqjgZ9 csg9EPQVz1O1SCHstYJlcBNXHGb6Dub1hNNB27aruVFqxOtmlJJPWYG8I7MKjeWNke9d 8mrg== X-Gm-Message-State: AOAM533Y2GiOAdv7TiDOuPp4FDwCJuGJnO0WIydnD+dTcH00lic6VBmQ V2FeTOLFn7J5o3RFw+sX/RQlvZoOsqIF X-Google-Smtp-Source: ABdhPJxTZuLyroftuZnhOrDuwqNumT9dtIvqkB2Ztipj7FIYg5JvoWjiM+eYBtBoC2zumUfaCuLwIWZnwACF X-Received: from venture.svl.corp.google.com ([2620:15c:2a3:200:9986:338a:477f:1df7]) (user=venture job=sendgmr) by 2002:a25:b082:: with SMTP id f2mr72471898ybj.316.1641493735203; Thu, 06 Jan 2022 10:28:55 -0800 (PST) Date: Thu, 6 Jan 2022 10:28:51 -0800 Message-Id: <20220106182851.3583896-1-venture@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog Subject: [PATCH] net: Fix uninitialized data usage From: Patrick Venture To: jasowang@redhat.com Cc: qemu-devel@nongnu.org, Peter Foley , Hao Wu , Patrick Venture X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::34a (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::34a; envelope-from=35zTXYQcKCsI3mv12zmowwotm.kwuymu2-lm3mtvwvov2.wzo@flex--venture.bounces.google.com; helo=mail-ot1-x34a.google.com X-Spam_score_int: -87 X-Spam_score: -8.8 X-Spam_bar: -------- X-Spam_report: (-8.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, USER_IN_DEF_DKIM_WL=-7.5 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @google.com) X-ZM-MESSAGEID: 1641494635266100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Peter Foley e.g. 1109 15:16:20.151506 Uninitialized bytes in ioctl_common_pre at offset 0 in= side [0x7ffc516af9b8, 4) 1109 15:16:20.151659 =3D=3D588974=3D=3DWARNING: MemorySanitizer: use-of-un= initialized-value 1109 15:16:20.312923 #0 0x5639b88acb21 in tap_probe_vnet_hdr_len third= _party/qemu/net/tap-linux.c:183:9 1109 15:16:20.312952 #1 0x5639b88afd66 in net_tap_fd_init third_party/= qemu/net/tap.c:409:9 1109 15:16:20.312954 #2 0x5639b88b2d1b in net_init_tap_one third_party= /qemu/net/tap.c:681:19 1109 15:16:20.312956 #3 0x5639b88b16a8 in net_init_tap third_party/qem= u/net/tap.c:912:13 1109 15:16:20.312957 #4 0x5639b8890175 in net_client_init1 third_party= /qemu/net/net.c:1110:9 1109 15:16:20.312958 #5 0x5639b888f912 in net_client_init third_party/= qemu/net/net.c:1208:15 1109 15:16:20.312960 #6 0x5639b8894aa5 in net_param_nic third_party/qe= mu/net/net.c:1588:11 1109 15:16:20.312961 #7 0x5639b900cd18 in qemu_opts_foreach third_part= y/qemu/util/qemu-option.c:1135:14 1109 15:16:20.312962 #8 0x5639b889393c in net_init_clients third_party= /qemu/net/net.c:1612:9 1109 15:16:20.312964 #9 0x5639b717aaf3 in qemu_create_late_backends th= ird_party/qemu/softmmu/vl.c:1962:5 1109 15:16:20.312965 #10 0x5639b717aaf3 in qemu_init third_party/qemu/= softmmu/vl.c:3694:5 1109 15:16:20.312967 #11 0x5639b71083b8 in main third_party/qemu/softm= mu/main.c:49:5 1109 15:16:20.312968 #12 0x7f464de1d8d2 in __libc_start_main (/usr/grt= e/v5/lib64/libc.so.6+0x628d2) 1109 15:16:20.312969 #13 0x5639b6bbd389 in _start /usr/grte/v5/debug-s= rc/src/csu/../sysdeps/x86_64/start.S:120 1109 15:16:20.312970 1109 15:16:20.312975 Uninitialized value was stored to memory at 1109 15:16:20.313393 #0 0x5639b88acbee in tap_probe_vnet_hdr_len third= _party/qemu/net/tap-linux.c 1109 15:16:20.313396 #1 0x5639b88afd66 in net_tap_fd_init third_party/= qemu/net/tap.c:409:9 1109 15:16:20.313398 #2 0x5639b88b2d1b in net_init_tap_one third_party= /qemu/net/tap.c:681:19 1109 15:16:20.313399 #3 0x5639b88b16a8 in net_init_tap third_party/qem= u/net/tap.c:912:13 1109 15:16:20.313400 #4 0x5639b8890175 in net_client_init1 third_party= /qemu/net/net.c:1110:9 1109 15:16:20.313401 #5 0x5639b888f912 in net_client_init third_party/= qemu/net/net.c:1208:15 1109 15:16:20.313403 #6 0x5639b8894aa5 in net_param_nic third_party/qe= mu/net/net.c:1588:11 1109 15:16:20.313404 #7 0x5639b900cd18 in qemu_opts_foreach third_part= y/qemu/util/qemu-option.c:1135:14 1109 15:16:20.313405 #8 0x5639b889393c in net_init_clients third_party= /qemu/net/net.c:1612:9 1109 15:16:20.313407 #9 0x5639b717aaf3 in qemu_create_late_backends th= ird_party/qemu/softmmu/vl.c:1962:5 1109 15:16:20.313408 #10 0x5639b717aaf3 in qemu_init third_party/qemu/= softmmu/vl.c:3694:5 1109 15:16:20.313409 #11 0x5639b71083b8 in main third_party/qemu/softm= mu/main.c:49:5 1109 15:16:20.313410 #12 0x7f464de1d8d2 in __libc_start_main (/usr/grt= e/v5/lib64/libc.so.6+0x628d2) 1109 15:16:20.313412 #13 0x5639b6bbd389 in _start /usr/grte/v5/debug-s= rc/src/csu/../sysdeps/x86_64/start.S:120 1109 15:16:20.313413 1109 15:16:20.313417 Uninitialized value was stored to memory at 1109 15:16:20.313791 #0 0x5639b88affbd in net_tap_fd_init third_party/= qemu/net/tap.c:400:26 1109 15:16:20.313826 #1 0x5639b88b2d1b in net_init_tap_one third_party= /qemu/net/tap.c:681:19 1109 15:16:20.313829 #2 0x5639b88b16a8 in net_init_tap third_party/qem= u/net/tap.c:912:13 1109 15:16:20.313831 #3 0x5639b8890175 in net_client_init1 third_party= /qemu/net/net.c:1110:9 1109 15:16:20.313836 #4 0x5639b888f912 in net_client_init third_party/= qemu/net/net.c:1208:15 1109 15:16:20.313838 #5 0x5639b8894aa5 in net_param_nic third_party/qe= mu/net/net.c:1588:11 1109 15:16:20.313839 #6 0x5639b900cd18 in qemu_opts_foreach third_part= y/qemu/util/qemu-option.c:1135:14 1109 15:16:20.313841 #7 0x5639b889393c in net_init_clients third_party= /qemu/net/net.c:1612:9 1109 15:16:20.313843 #8 0x5639b717aaf3 in qemu_create_late_backends th= ird_party/qemu/softmmu/vl.c:1962:5 1109 15:16:20.313844 #9 0x5639b717aaf3 in qemu_init third_party/qemu/s= oftmmu/vl.c:3694:5 1109 15:16:20.313845 #10 0x5639b71083b8 in main third_party/qemu/softm= mu/main.c:49:5 1109 15:16:20.313846 #11 0x7f464de1d8d2 in __libc_start_main (/usr/grt= e/v5/lib64/libc.so.6+0x628d2) 1109 15:16:20.313847 #12 0x5639b6bbd389 in _start /usr/grte/v5/debug-s= rc/src/csu/../sysdeps/x86_64/start.S:120 1109 15:16:20.313849 1109 15:16:20.313851 Uninitialized value was created by an allocation of= 'ifr' in the stack frame of function 'tap_probe_vnet_hdr' 1109 15:16:20.313855 #0 0x5639b88ac680 in tap_probe_vnet_hdr third_par= ty/qemu/net/tap-linux.c:151 1109 15:16:20.313856 1109 15:16:20.313878 SUMMARY: MemorySanitizer: use-of-uninitialized-value = third_party/qemu/net/tap-linux.c:183:9 in tap_probe_vnet_hdr_len Fixes: dc69004c7d8 ("net: move tap_probe_vnet_hdr() to tap-linux.c") Reviewed-by: Hao Wu Reviewed-by: Patrick Venture Signed-off-by: Peter Foley Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- net/tap-linux.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/tap-linux.c b/net/tap-linux.c index 9584769740..5e70b93037 100644 --- a/net/tap-linux.c +++ b/net/tap-linux.c @@ -150,6 +150,7 @@ void tap_set_sndbuf(int fd, const NetdevTapOptions *tap= , Error **errp) int tap_probe_vnet_hdr(int fd, Error **errp) { struct ifreq ifr; + memset(&ifr, 0, sizeof(ifr)); =20 if (ioctl(fd, TUNGETIFF, &ifr) !=3D 0) { /* TUNGETIFF is available since kernel v2.6.27 */ --=20 2.34.1.448.ga2b2bfdf31-goog