From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F2076C531DC for ; Fri, 16 Aug 2024 08:24:43 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sesG4-0005ie-Bx; Fri, 16 Aug 2024 04:24:28 -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 1sesG3-0005hm-FF for qemu-devel@nongnu.org; Fri, 16 Aug 2024 04:24:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sesG1-0004K1-OJ for qemu-devel@nongnu.org; Fri, 16 Aug 2024 04:24:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1723796665; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=tzuw0jhGtEEpOqvm2iVSzUFi/qmzZkyeDjV1tfEWnLU=; b=Wutdwj+LRL2nXjjpbKYgSvGn9JtU69AV/aIFEe/UaX7A0NptdT2LHeQFvXGPtEUR5o3k83 hvRGW1aibGAx9ro2ct89mM2cVwozGioOwidT1j8XNnXgBpKcGOgEiQwM3JtoA3xpWrsrcJ lPhlEtjuspQVYsm49+JGC2wJeiMcZ88= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-152-Ny2fo7HFO0Gz8EM-GTZ45g-1; Fri, 16 Aug 2024 04:24:21 -0400 X-MC-Unique: Ny2fo7HFO0Gz8EM-GTZ45g-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-36848f30d39so933958f8f.3 for ; Fri, 16 Aug 2024 01:24:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723796660; x=1724401460; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=tzuw0jhGtEEpOqvm2iVSzUFi/qmzZkyeDjV1tfEWnLU=; b=gLlAp/XpTKRJRn6veyeRThgTvLUhpF5XBEs4IWXaCynJ5LAOo2Vw8TPQyJjywz/KTq +UDfXh3rs40ZFH6U0FZ4OMZ7xE5RrzDJQ0EzNC2MvrhjZ6zrrn2J7GoFVpTheuGO9YJ3 oFahVRcE6cVYfiFNSrJ3XZXIx0Z3rM0o0AoVrmXPh5NuIbzh1K+C0io9YRiGMdkTB6rH FxsUHhCAM1y/LhTB+AxythhlWWZbN+SLgcFrI0k41zMvH4VldrZYAPJQR+TVhiWOhP/k be9oKYLHUrBUPPJgLTzBuMJ856HCTc0vHgH5CqWvh4PrxMq2O1E0pXe71KbidiAtknXj mvjw== X-Gm-Message-State: AOJu0YxISGwLimI+kn1B2I/Llips7Gu2DWLCt/iqHQDEzTvprfXj7mqw B4LUh1uv3x/F8hzHnwTLbZ/m+74eDs0ry9E3eLjtUWW4QRE/vEHWC+tCwzeA5ewXsOl+e9UTp4u 3gaJyTDLBZz+WKFwSSi46PcgbN9YRiZ/qnJ2/rLsWjwDxIs1WveDw X-Received: by 2002:a5d:452b:0:b0:371:9360:c4a8 with SMTP id ffacd0b85a97d-37194315205mr1127397f8f.6.1723796660206; Fri, 16 Aug 2024 01:24:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEmXToVaAzDatC/i7WtiSsT2LBgEEmZ1qaAf7bzfjzLPmCewriYB0xU5/15CKk9bT5R1pgNJA== X-Received: by 2002:a5d:452b:0:b0:371:9360:c4a8 with SMTP id ffacd0b85a97d-37194315205mr1127383f8f.6.1723796659655; Fri, 16 Aug 2024 01:24:19 -0700 (PDT) Received: from [192.168.0.6] (ip-109-43-177-15.web.vodafone.de. [109.43.177.15]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3718983a306sm3108301f8f.15.2024.08.16.01.24.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 16 Aug 2024 01:24:19 -0700 (PDT) Message-ID: <12206320-2647-448e-a206-685ff95be8c3@redhat.com> Date: Fri, 16 Aug 2024 10:24:17 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3] meson: Use -fno-sanitize=function when available To: Akihiko Odaki , =?UTF-8?Q?Alex_Benn=C3=A9e?= , =?UTF-8?Q?Philippe_Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Beraldo Leal , Paolo Bonzini , =?UTF-8?Q?Marc-Andr=C3=A9_Lureau?= , =?UTF-8?Q?Daniel_P=2E_Berrang=C3=A9?= Cc: qemu-devel@nongnu.org References: <20240816-function-v3-1-32ff225e550e@daynix.com> <3d417232-ba66-4781-8278-a6a31987b54c@redhat.com> <337e647e-3edf-475c-8e37-de3d28b30340@daynix.com> <6d1949bc-a0c2-487c-8b6c-21db12f6a0af@daynix.com> <4b4dd3bc-8338-4452-a8b2-013405094e1b@daynix.com> Content-Language: en-US From: Thomas Huth Autocrypt: addr=thuth@redhat.com; keydata= xsFNBFH7eUwBEACzyOXKU+5Pcs6wNpKzrlJwzRl3VGZt95VCdb+FgoU9g11m7FW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nqGwZ7JhwARAQABwsFfBBgBAgAJBQJR+3lM AhsMAAoJEC7Z13T+cC21hPAQAIsBL9MdGpdEpvXs9CYrBkd6tS9mbaSWj6XBDfA1AEdQkBOn ZH1Qt7HJesk+qNSnLv6+jP4VwqK5AFMrKJ6IjE7jqgzGxtcZnvSjeDGPF1h2CKZQPpTw890k fy18AvgFHkVk2Oylyexw3aOBsXg6ukN44vIFqPoc+YSU0+0QIdYJp/XFsgWxnFIMYwDpxSHS 5fdDxUjsk3UBHZx+IhFjs2siVZi5wnHIqM7eK9abr2cK2weInTBwXwqVWjsXZ4tq5+jQrwDK cvxIcwXdUTLGxc4/Z/VRH1PZSvfQxdxMGmNTGaXVNfdFZjm4fz0mz+OUi6AHC4CZpwnsliGV ODqwX8Y1zic9viSTbKS01ZNp175POyWViUk9qisPZB7ypfSIVSEULrL347qY/hm9ahhqmn17 Ng255syASv3ehvX7iwWDfzXbA0/TVaqwa1YIkec+/8miicV0zMP9siRcYQkyTqSzaTFBBmqD oiT+z+/E59qj/EKfyce3sbC9XLjXv3mHMrq1tKX4G7IJGnS989E/fg6crv6NHae9Ckm7+lSs IQu4bBP2GxiRQ+NV3iV/KU3ebMRzqIC//DCOxzQNFNJAKldPe/bKZMCxEqtVoRkuJtNdp/5a yXFZ6TfE1hGKrDBYAm4vrnZ4CXFSBDllL59cFFOJCkn4Xboj/aVxxJxF30bn In-Reply-To: <4b4dd3bc-8338-4452-a8b2-013405094e1b@daynix.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.131, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org On 16/08/2024 10.21, Akihiko Odaki wrote: > On 2024/08/16 17:03, Thomas Huth wrote: >> On 16/08/2024 09.30, Akihiko Odaki wrote: >>> On 2024/08/16 16:27, Thomas Huth wrote: >>>> On 16/08/2024 09.12, Akihiko Odaki wrote: >>>>> On 2024/08/16 16:03, Thomas Huth wrote: >>>>>> On 16/08/2024 08.22, Akihiko Odaki wrote: >>>>>>> Commit 23ef50ae2d0c (".gitlab-ci.d/buildtest.yml: Use >>>>>>> -fno-sanitize=function in the clang-system job") adds >>>>>>> -fno-sanitize=function for the CI but doesn't add the flag in the >>>>>>> other context. Add it to meson.build for such. It is not removed from >>>>>>> .gitlab-ci.d/buildtest.yml because -fno-sanitize=function in meson.build >>>>>>> does not affect --extra-cflags due to argument ordering. >>>>>>> >>>>>>> Signed-off-by: Akihiko Odaki >>>>>>> --- >>>>>>> Changes in v3: >>>>>>> - I was not properly dropping the change of .gitlab-ci.d/buildtest.yml >>>>>>>    but only updated the message. v3 fixes this. (Thomas Huth) >>>>>>> - Link to v2: >>>>>>> https://lore.kernel.org/r/20240729-function-v2-1-2401ab18b30b@daynix.com >>>>>>> >>>>>>> Changes in v2: >>>>>>> - Dropped the change of: .gitlab-ci.d/buildtest.yml >>>>>>> - Link to v1: >>>>>>> https://lore.kernel.org/r/20240714-function-v1-1-cc2acb4171ba@daynix.com >>>>>>> --- >>>>>>>   meson.build | 1 + >>>>>>>   1 file changed, 1 insertion(+) >>>>>>> >>>>>>> diff --git a/meson.build b/meson.build >>>>>>> index 5613b62a4f42..a4169c572ba9 100644 >>>>>>> --- a/meson.build >>>>>>> +++ b/meson.build >>>>>>> @@ -609,6 +609,7 @@ if host_os != 'openbsd' and \ >>>>>>>   endif >>>>>>>   qemu_common_flags += cc.get_supported_arguments(hardening_flags) >>>>>>> +qemu_common_flags += >>>>>>> cc.get_supported_arguments('-fno-sanitize=function') >>>>>> >>>>>> As I mentioned in my last mail: I think it would make sense to move >>>>>> this at the end of the "if get_option('tsan')" block in meson.build, >>>>>> since this apparently only fixes the use of "--enable-sanitizers", and >>>>>> cannot fix the "--extra-cflags" that a user might have specified? >>>>> >>>>> Sorry, I missed it. It cannot fix --extra-cflags, but it should be able >>>>> to fix compiler flags specified by compiler distributor. >>>> >>>> Oh, you mean that there are distros that enable -fsanitize=function by >>>> default? Can you name one? If so, I think that information should go >>>> into the patch description...? >>> >>> No, it is just a precaution. >> >> Ok. I don't think any normal distro will enable this by default since this >> impacts performance of the programs, so it's either the user specifying >> --enable-sanitizers or the user specifying >> --extra-cflags="-fsanitize=...". In the latter case, your patch does not >> help. In the former case, I think this setting should go into the same >> code block as where we set -fsanitize=undefined in our meson.build file, >> so that it is clear where it belongs to. > > It does not look like -fno-sanitize=function belongs to the code block to > me. Putting -fno-sanitize=function in the code block will make it seem to > say that we should disable function sanitizer because the user requests to > enable sanitizers, which makes little sense. As far as I understood, -fsanitize=undefine turns on -fsanitize=function, too, or did I get that wrong? If not, how did you run into this problem? How did you enable the function sanitizer if not using --enable-sanitizers ? Thomas