From patchwork Mon Aug 19 17:07:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 820272 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c8:0:b0:367:895a:4699 with SMTP id m8csp1537508wrb; Mon, 19 Aug 2024 10:07:57 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXrOFOWQ/BZ2XGVG2EcSOW1VrDwHYZk0pNUoWvHHt795Gi2KLATeL6n53TrONv3mcDzl+HVkCUlzLm1yTtNk06x X-Google-Smtp-Source: AGHT+IFmoBjaL6H/tgz/AvUbqLc7q1Jq0PrPgakIbyAdCiv211yiUWgMdT3M3ReEYQCSKb/H3Lke X-Received: by 2002:a05:622a:1f12:b0:44f:ee96:cc80 with SMTP id d75a77b69052e-4537427fcd4mr182467211cf.28.1724087276759; Mon, 19 Aug 2024 10:07:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1724087276; cv=none; d=google.com; s=arc-20160816; b=O1E5aXOfUdQgNp7JjHjM2zEsov16EL8gFZPJT/3gUOEIoLh6GYK0x7gyXfjDAWcfeB VlQHFOc/oYJSR3Drl/W4XqOV/M70SiUF324hKBmOTXsIfwV5iJ2Nyovb1abvK2E/3dTs W7iIWgbJz6b+7nO1PAx9+yIK8nuGO3C1+0njjDrhcvbAOhg1dhh6/HuBJbGH+dXiP0fA 1dHjIjLU01Km/jv/uc5s3MmESRF2h15/KBMHXTjOb6N4cTytQx+6lNUDD+7dMQhybPCT YH75EaA3Iey5f4SufP8c73xWY4lBEvNALmFu6SbNA0yw7X2sVuoTubNcUM8VE/0C44dM m/Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature; bh=4GmzundrD0SbSrTOkmz6GAZvpiktdShaMN8HJog1gps=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=zWb9HZ4LhH2BslP9Rvv9KvfPnt7pzNV1glEo/7X4QkPJ8Gv7mZtJ9X1WF6rwZBJRFh UZuXY4tNi/lpwlCg/h9f1C8TSjIIM6nhnwnfD+RY+GVk+eXuy6g+R4z0msTm9gX92VeG 5G5cVcpKuQhGKquY0ewRbdnc2N3xaDzRs3s0H/BaSBpv5uGSCt43dTT02HXEByT3aBFx S1fjj/bAn/AYV55Rg4cu1huecWTVUbHnF6GObwbss5hOdP5D1S6w7h7V+dnJ54aJT8yt v8sCJbD/hmqO6fx0SPeKKRYF1N3lUUCSCBzms4thdeqcv49JDAQz2Ali9CH47rDOrNFo qVzQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="FjEF/fTX"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-45369fe5ef9si106482471cf.117.2024.08.19.10.07.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 19 Aug 2024 10:07:56 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="FjEF/fTX"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sg5qW-0000yS-3K; Mon, 19 Aug 2024 13:07:08 -0400 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 1sg5qT-0000xv-Kg for qemu-devel@nongnu.org; Mon, 19 Aug 2024 13:07:05 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sg5qR-0006bd-Nr for qemu-devel@nongnu.org; Mon, 19 Aug 2024 13:07:05 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-42819654737so35613415e9.1 for ; Mon, 19 Aug 2024 10:07:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724087222; x=1724692022; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=4GmzundrD0SbSrTOkmz6GAZvpiktdShaMN8HJog1gps=; b=FjEF/fTXzIzuFIffCqsm0AYqw/0c4pyIRrzybUIvbxkv41qnHvuZPXwWEWYYrJYlFR iSM2kqjzOdja9qmUvsaklr2zrbjcQpOOwiBGaeMy5+CKmsJ3F2wEYPzRsQJBfGyhIyJt qpGeG5eby96cSupm9FYJnA3tumwrjKYbyJhNMIXddkwy7SQni63M9ijhtnJwh3D1qmg5 O5XAKDhkwCLiCoYZgzZPNf226WO6O0uJeLwoJzNRc0J8QXSv4u2BeCjxajSA7NbEVs8l VBx7HSfHsSltPMfPO/gwQ0QDeof5HY/q+OSCZTf7i1+s9HuXst1H9SXLHUX9Gzcyszv2 biJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724087222; x=1724692022; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4GmzundrD0SbSrTOkmz6GAZvpiktdShaMN8HJog1gps=; b=rq8rYFdBuCrlN8wY75QwMAVb79DOwQpiM2XP4y61DilbhMe5TAs4Tl1z+ZCsROpFaw pdOS44bsOAwFP4ahcyveWEG6LLdb+jj784zNQhQLZ9kDsHOkwPgJas+1h+y3/GLtk5Q7 dS3R7bGyUJwzD1gHML7NdR/M5T9ajkPsyYNWmxJVVMwHCX8eAWaHwLpY58HX96iL50yW /sMBtF3XQOgYbPTZhApD5pxez64oAwJLPBAVRM8CzrKBTDa3kQc5zw5Gu1HnTSvCTRZj 0tZ/cIV5GRZE/YA5UjE1+D5BS+vMxkQVy5zw/5rMnUwcGg5zsFqnhbtjcQKKPmv5b1ZE pt2Q== X-Gm-Message-State: AOJu0YzCvitbD6IvC/n+BesvG8cWrHvwxcFX/Ijt68r0WelwXrwHOuns hHw+GnknYg+bRVPyOp+I8VqlQtFJ8iLJdlGlPzwE/FZ7vBKx78A+eKZ6EIFRt5rVYnF1oqhMaif c X-Received: by 2002:a05:600c:3145:b0:426:62c5:4741 with SMTP id 5b1f17b1804b1-429ed7870afmr68081085e9.2.1724087221718; Mon, 19 Aug 2024 10:07:01 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3718985a35fsm11007786f8f.59.2024.08.19.10.07.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2024 10:07:01 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [RFC PATCH] scripts/lsan-suppressions: Add a LeakSanitizer suppressions file Date: Mon, 19 Aug 2024 18:07:00 +0100 Message-Id: <20240819170700.61844-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32a.google.com 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_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Add a LeakSanitizer suppressions file that documents and suppresses known false-positive leaks in either QEMU or its dependencies. To use it you'll need to set LSAN_OPTIONS="suppressions=/path/to/scripts/lsan-suppressions.txt" when running a QEMU built with the leak-sanitizer. The first and currently only entry is for a deliberate leak in glib's g_set_user_dirs() that otherwise causes false positive leak reports in the qga-ssh-test because of its use of G_TEST_OPTION_ISOLATE_DIRS: Direct leak of 321 byte(s) in 5 object(s) allocated from: #0 0x5555dd8abd1e in __interceptor_malloc (/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/asan/qga/qga-ssh-test+0x19cd1e) (BuildId: 7991a166007e8206c51bee401722a8335e7990bb) #1 0x7fb5bc724738 in g_malloc debian/build/deb/../../../glib/gmem.c:128:13 #2 0x7fb5bc739583 in g_strdup debian/build/deb/../../../glib/gstrfuncs.c:361:17 #3 0x7fb5bc757a29 in set_str_if_different debian/build/deb/../../../glib/gutils.c:1659:21 #4 0x7fb5bc757a29 in set_str_if_different debian/build/deb/../../../glib/gutils.c:1647:1 #5 0x7fb5bc757a29 in g_set_user_dirs debian/build/deb/../../../glib/gutils.c:1743:9 #6 0x7fb5bc743d78 in test_do_isolate_dirs debian/build/deb/../../../glib/gtestutils.c:1486:3 #7 0x7fb5bc743d78 in test_case_run debian/build/deb/../../../glib/gtestutils.c:2917:16 #8 0x7fb5bc743d78 in g_test_run_suite_internal debian/build/deb/../../../glib/gtestutils.c:3018:16 #9 0x7fb5bc74380a in g_test_run_suite_internal debian/build/deb/../../../glib/gtestutils.c:3035:18 #10 0x7fb5bc74380a in g_test_run_suite_internal debian/build/deb/../../../glib/gtestutils.c:3035:18 #11 0x7fb5bc743fe9 in g_test_run_suite debian/build/deb/../../../glib/gtestutils.c:3112:13 #12 0x7fb5bc744055 in g_test_run debian/build/deb/../../../glib/gtestutils.c:2231:7 #13 0x7fb5bc744055 in g_test_run debian/build/deb/../../../glib/gtestutils.c:2218:1 #14 0x5555dd9293b1 in main qga/commands-posix-ssh.c:439:12 #15 0x7fb5bc3dfd8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16 #16 0x7fb5bc3dfe3f in __libc_start_main csu/../csu/libc-start.c:392:3 #17 0x5555dd828ed4 in _start (/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/asan/qga/qga-ssh-test+0x119ed4) (BuildId: 7991a166007e8206c51bee401722a8335e7990bb) (Strictly speaking, this is a genuine leak, it's just a deliberate one by glib; they document it in their valgrind-format suppression file upstream.) Signed-off-by: Peter Maydell --- Does this seem like a good idea? It gives us a place to document things like this and to suppress them so we could in theory get a complete clean 'make check' run with the leak sanitizer on. It might be nice if there was an easy way to enable all our "recommended sanitizer settings" (ASAN_OPTIONS="fast_unwind_on_malloc=0 is pretty much required to get useful backtraces, for instance), but I'm not sure there's a neat way to do that. scripts/lsan-suppressions.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 scripts/lsan-suppressions.txt diff --git a/scripts/lsan-suppressions.txt b/scripts/lsan-suppressions.txt new file mode 100644 index 00000000000..5c3cffaa5a0 --- /dev/null +++ b/scripts/lsan-suppressions.txt @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2024 Linaro Limited + +# This is a set of suppressions for LeakSanitizer; you can use it +# by setting +# LSAN_OPTIONS="suppressions=/path/to/scripts/lsan-suppressions.txt" +# when running a QEMU built with the leak-sanitizer. + +# g_set_user_dirs() deliberately leaks the previous cached g_get_user_* +# values. This is documented in upstream glib's valgrind-format +# suppression file: +# https://github.com/GNOME/glib/blob/main/tools/glib.supp +# This avoids false positive leak reports for the qga-ssh-test. +leak:g_set_user_dirs