From nobody Sat Nov 23 19:25:09 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=quarantine dis=none) header.from=swemel.ru ARC-Seal: i=1; a=rsa-sha256; t=1731316081; cv=none; d=zohomail.com; s=zohoarc; b=anoql5pIC0TFU5MvTK0As17toc1NNpcJdeY7O/iP/jua42EdWcYK0gLJiV/61uVfg3XOXoz1ZQ7Ob0fGIK6me58ZwXRt49Q/2b6Bed5aYUx6+EDS0v2co8cxcYLFDsty+N+Hk0f8ax/UYa0gbDIIrzpIdBuGKzPc5PycsD3NI68= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731316081; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=sm2i/vgTJGaFpYJCWaUbk4eUv57Ol+LvmF111NzlXuU=; b=KtBdIkzJkGy/tFbxj++YFJbZlfXXQqZSF5CKxcdkblsOb0iZ2v/EoSxJTTIsA170X9I+eByEaeRhhskoTK7nssYHD4Fp7EJRV2w4RwusdVvzlRy/2LtJQiXysTrrCWspHJ2jx6BYjT6mIrmnB5wcYcE1rpze9/GfGHm7ZvUgVDU= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731316080778213.89621184684222; Mon, 11 Nov 2024 01:08:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAQO2-0001ld-HJ; Mon, 11 Nov 2024 04:07:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tAQMu-0001iW-GK for qemu-devel@nongnu.org; Mon, 11 Nov 2024 04:05:56 -0500 Received: from mx.swemel.ru ([95.143.211.150]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tAQMs-0006Bg-F4 for qemu-devel@nongnu.org; Mon, 11 Nov 2024 04:05:56 -0500 From: Dmitry Frolov DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=swemel.ru; s=mail; t=1731315946; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=sm2i/vgTJGaFpYJCWaUbk4eUv57Ol+LvmF111NzlXuU=; b=tHvITxI8LqM1o91c5Hz0IkCaI6D5dT2HgOodNfEG549bSM1OBVbzudWNyxHczPYOL0IceG ot8eo+MvydpF8db/HuKqdWA60uvyQfeaJ398S4zwDKlGY+2Xha/0Udnf3btWWFLyJw1jaQ CWG88akS+xFzAsokiNYWVudtt2ybYTY= To: farosas@suse.de, lvivier@redhat.com Cc: sdl.qemu@linuxtesting.org, qemu-devel@nongnu.org, Dmitry Frolov Subject: [PATCH] tests/qtest: fix heap-use-after-free Date: Mon, 11 Nov 2024 12:05:31 +0300 Message-ID: <20241111090534.66439-2-frolov@swemel.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=95.143.211.150; envelope-from=frolov@swemel.ru; helo=mx.swemel.ru X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @swemel.ru) X-ZM-MESSAGEID: 1731316085073116600 Content-Type: text/plain; charset="utf-8" "int main(int argc, char **argv, char** envp)" is non-standart Microsoft`s extention of the C language and it`s not portable. In my particular case (Debian 13, clang-16) this raises wild-pointer dereference with ASAN message "heap-use-after-free". Signed-off-by: Dmitry Frolov --- tests/qtest/qos-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qtest/qos-test.c b/tests/qtest/qos-test.c index 114f6bef27..e8ac00f0f7 100644 --- a/tests/qtest/qos-test.c +++ b/tests/qtest/qos-test.c @@ -326,7 +326,7 @@ static void walk_path(QOSGraphNode *orig_path, int len) * machine/drivers/test objects * - Cleans up everything */ -int main(int argc, char **argv, char** envp) +int main(int argc, char **argv) { g_test_init(&argc, &argv, NULL); =20 @@ -336,7 +336,7 @@ int main(int argc, char **argv, char** envp) =20 if (g_test_verbose()) { qos_printf("ENVIRONMENT VARIABLES: {\n"); - for (char **env =3D envp; *env !=3D 0; env++) { + for (char **env =3D environ; *env !=3D 0; env++) { qos_printf("\t%s\n", *env); } qos_printf("}\n"); --=20 2.43.0