From patchwork Thu Oct 24 09:55:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 838100 Delivered-To: patch@linaro.org Received: by 2002:adf:a399:0:b0:37d:45d0:187 with SMTP id l25csp270559wrb; Thu, 24 Oct 2024 02:58:14 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXq3smJYJOFt9KtC42+EML4aFpCX3qeW+qdlYgV/bdrLfGnPVIMCAn9cLQoeSsa5hmAKINMrQ==@linaro.org X-Google-Smtp-Source: AGHT+IEdxI36qcdv/dh3m2Yp4xxqmKjFOJt+zfZXl9HtzHvsLrsp96WCkW0YWwCfUrNOFtBn8PVW X-Received: by 2002:a05:620a:4481:b0:79f:67b:4ffc with SMTP id af79cd13be357-7b17e540593mr698075685a.5.1729763893898; Thu, 24 Oct 2024 02:58:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729763893; cv=none; d=google.com; s=arc-20240605; b=QvQQWut05F+9VnaCW05Q6nKgjUeG5eKPr+8Dbqn27W0+hZ+IQRwRlzFZpNnVOaIHPH RMJVJAPszopEC8rGDZ/xdDmYXLLyVnw80X/YEdtzMtTpfo+2H+dAUkUfLYrX3bDY+9l9 zHiuH9eM5CaDq424NfUcKgUyEpZ+ryGRNJ0BJFMeX7DyIsGlQdwL+JmhWwMhYMaANymA 0cpynXgTsLGH9b70fMO5GZ/bpCvCCdSa7pZeeuVaX8/dKgz+CzyXCoQJQkzDCf1OOhwm r2cG5bJ6pzp/hpohXorEofQV8ZsDvSVYnZDfrhyB7MEgqiIEzLaXbbT8GOU7y2Ol7gG9 +9Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WuPv/uXk8QTOtd5rNfjJz9xPAaD3KPuwf7iO+KnrLkg=; fh=KLuSYkmRYgfIbzlLyvGS0g75pF85i3WjZA7EQ5ipYIA=; b=SKzwsSyGl/X5KpRLlYIgW0oDuWFe1yVuouk4ZKRTSq5qlTN93lXAvno1Pgfda0eo1/ tYWRnmyGP4q/0iu9zuF42UGYxTJIN+bibmTIZzK3/kUbKGgHNrX10w4vKKT3QeO8fs9k hGZDBIsgolf0eLhBeucF6eLagZEItRf+D8Wb/hF44XVf0ocHylb7YiovAsHZtWmgV0h5 OiSeOxWQpSBi+yV7D6GGCzVrShvEMRySayKwrieMcsjlH89j2p4rVo2dIDf4+AlrdS86 6AIrfNrsXlzVi5Zr27yZ5YjR0eJ9hStINJnKZjtk2YmIoj3usMEf+44sAG6A2AstIuYc 8kmw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wfQEW69e; 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 af79cd13be357-7b1659fb0b5si1130898685a.182.2024.10.24.02.58.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Oct 2024 02:58:13 -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=wfQEW69e; 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 1t3ua3-0001Ek-Uc; Thu, 24 Oct 2024 05:56:35 -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 1t3uZi-00017s-CI for qemu-devel@nongnu.org; Thu, 24 Oct 2024 05:56:15 -0400 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t3uZf-0003my-QT for qemu-devel@nongnu.org; Thu, 24 Oct 2024 05:56:13 -0400 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-5c941623a5aso3166406a12.0 for ; Thu, 24 Oct 2024 02:56:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729763770; x=1730368570; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WuPv/uXk8QTOtd5rNfjJz9xPAaD3KPuwf7iO+KnrLkg=; b=wfQEW69eG+mQvNAazfIKrfp29Z6eUgqpHNt+Ja5vKBJPl636fk4UTNrEypeckAeQb7 ZuGv39nm3voKUjXqA3MbLZ/KvZs5EW9//QU7gd2p3kjh2t/eFSCrcjQWVP/adH/4iey9 1DTGm4FhxmsShQnQ6ZcuwGLNqMej40hqUtDO3MKDkXs6gNFxpMFfurYEPZBEbm2Pi7A3 sUtEdwEw7Orm3shDURbhcETffCwHbwptakofW/+3e83i56H7oiCaCdJIFJ7qWi5kxC6m TS1XfDltaEPt/ClQiD93XOx4veSwTuVBmg7DxDS0/ph2Ciau7EvTzFu4gHUshGzBsN4v uyxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729763770; x=1730368570; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WuPv/uXk8QTOtd5rNfjJz9xPAaD3KPuwf7iO+KnrLkg=; b=kg++Ilvfwt6tIYUimirsWXA5MFrJCKlWQPeXCHWXkgpEv9RXglECSMkW5DwqW0Ivo/ 5AdTMyug4sDYFe7ZhdamF92UAeFyafFl9eVI+xGfHkC+0ETJ+C/Se1e7NI8+vjVfly2i Cl7O5dc+IOB8CAsfcsSaBKfTWh1W5zDBd3p6GxDYZo+mnhOHOXMbyjr83m5b+f2kBkLL Xchu5okQbF2jQx5RadhWiodX4J6Z7vIzPpYO3SMaCIvLgEAQk6lDC6WwnFE26aMzipZA na58Z4OoVXKtGIqEQuITNLm2VLRPvgxZiPGxF6cHex+wR9v3mb+dK8l44ETg/Jbipi3f G6fA== X-Gm-Message-State: AOJu0Ywsga7z/ro3qmQJviUL+urJRit0t8/tenIiOIwJSf56N/hB1qhc LKTUqGK2cg3Bjynrl+DhHFEi1E89/OrC6iasNSYdzh78h43oCoFkcRpFhJ8IVYU= X-Received: by 2002:a05:6402:2486:b0:5c9:7f41:eb1b with SMTP id 4fb4d7f45d1cf-5cba2110569mr1905298a12.17.1729763770192; Thu, 24 Oct 2024 02:56:10 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5cb66c725dfsm5478729a12.81.2024.10.24.02.56.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 02:56:07 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 748805F913; Thu, 24 Oct 2024 10:56:04 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Pierrick Bouvier , Thomas Huth , =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PULL 05/17] docs/devel: update tsan build documentation Date: Thu, 24 Oct 2024 10:55:51 +0100 Message-Id: <20241024095603.1813285-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241024095603.1813285-1-alex.bennee@linaro.org> References: <20241024095603.1813285-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x530.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 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 From: Pierrick Bouvier Mention it's now possible to build with gcc, instead of clang, and explain how to build a sanitized glib version. Signed-off-by: Pierrick Bouvier Reviewed-by: Thomas Huth Message-Id: <20240910174013.1433331-4-pierrick.bouvier@linaro.org> Signed-off-by: Alex Bennée Message-Id: <20241023113406.1284676-6-alex.bennee@linaro.org> diff --git a/docs/devel/testing/main.rst b/docs/devel/testing/main.rst index 09725e8ea9..91f4dc61fb 100644 --- a/docs/devel/testing/main.rst +++ b/docs/devel/testing/main.rst @@ -628,20 +628,38 @@ Building and Testing with TSan It is possible to build and test with TSan, with a few additional steps. These steps are normally done automatically in the docker. -There is a one time patch needed in clang-9 or clang-10 at this time: +TSan is supported for clang and gcc. +One particularity of sanitizers is that all the code, including shared objects +dependencies, should be built with it. +In the case of TSan, any synchronization primitive from glib (GMutex for +instance) will not be recognized, and will lead to false positives. + +To build a tsan version of glib: .. code:: - sed -i 's/^const/static const/g' \ - /usr/lib/llvm-10/lib/clang/10.0.0/include/sanitizer/tsan_interface.h + $ git clone --depth=1 --branch=2.81.0 https://github.com/GNOME/glib.git + $ cd glib + $ CFLAGS="-O2 -g -fsanitize=thread" meson build + $ ninja -C build To configure the build for TSan: .. code:: - ../configure --enable-tsan --cc=clang-10 --cxx=clang++-10 \ + ../configure --enable-tsan \ --disable-werror --extra-cflags="-O0" +When executing qemu, don't forget to point to tsan glib: + +.. code:: + + $ glib_dir=/path/to/glib + $ export LD_LIBRARY_PATH=$glib_dir/build/gio:$glib_dir/build/glib:$glib_dir/build/gmodule:$glib_dir/build/gobject:$glib_dir/build/gthread + # check correct version is used + $ ldd build/qemu-x86_64 | grep glib + $ qemu-system-x86_64 ... + The runtime behavior of TSAN is controlled by the TSAN_OPTIONS environment variable.