From nobody Sun May 5 07:09:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1626718778; cv=none; d=zohomail.com; s=zohoarc; b=Bh4xKIaSLZU4KS/V8VYzT99NQRg2LFdaEOfxNYTb+6GPYaWRFrHtzhrKn4evdaovTLpqTaFaGUsjsjxJZyJvp9Jb8SqcdlepiHV1Gvjbj1kRkQdmORSCBfMZ/4vLzrEOh8A1YNmWiaTMaIzSjuvieHvDM6+yjncScuJfRwXSLjw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626718778; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=8UxZyLXGe6vOUg1OCbMm2dcGjWKxoz0MIthGxvs1UZU=; b=gzHVJVogdhgTpMF6EhrjmWF8N++CEITQTfSdlnHnjHpABBIBNsuJdTcH/MGgVPzTrCTvSZ/Cz333S1ASyFj/ZPNquWjghQrCBgiPfOfWPee4Pd2l3VLJcXOPydZSwrPmgUDxG6luNprqPWqYn5SC2jhO9S61wiTcHGb1i4imjqU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1626718778158813.0793217552447; Mon, 19 Jul 2021 11:19:38 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-239-B9TggMJKNd-GyHw_u7LhfQ-1; Mon, 19 Jul 2021 14:19:34 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 62E4D81C85D; Mon, 19 Jul 2021 18:19:27 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 04B2E100EB3E; Mon, 19 Jul 2021 18:19:25 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 434664E9F5; Mon, 19 Jul 2021 18:19:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 16JIJJaW011056 for ; Mon, 19 Jul 2021 14:19:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4B2E35C232; Mon, 19 Jul 2021 18:19:19 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-193.ams2.redhat.com [10.36.112.193]) by smtp.corp.redhat.com (Postfix) with ESMTP id 931DD5C1C5; Mon, 19 Jul 2021 18:19:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626718777; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=8UxZyLXGe6vOUg1OCbMm2dcGjWKxoz0MIthGxvs1UZU=; b=Q6RDy0hJhpEz4DJUI//BL3t/4uQFICfsXh8SUTqrP7K5HiCe2LtoDaLBGiY9OVAFbzalsr jPm4LiBvqHH/QzByTTOG9b2cXIXliFzDh8WTVrvn6x8b1iRcDYLnDzIL1cPmAVYQr5EdGF TztvKhZFnQoZHGFyMACHNZL1XK4njJQ= X-MC-Unique: B9TggMJKNd-GyHw_u7LhfQ-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [PATCH] meson: disable bogus warnings from sanitizers on Fedora Date: Mon, 19 Jul 2021 19:19:13 +0100 Message-Id: <20210719181913.2509110-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1626718779894100001 When building with sanitizers on Fedora we get a wierd error message In file included from /usr/include/string.h:519, from ../src/internal.h:28, from ../src/util/virsocket.h:21, from ../src/util/virsocketaddr.h:21, from ../src/util/virnetdevip.h:21, from ../src/util/virnetdevip.c:21: In function =E2=80=98memcpy=E2=80=99, inlined from =E2=80=98virNetDevGetifaddrsAddress=E2=80=99 at ../src/uti= l/virnetdevip.c:702:13, inlined from =E2=80=98virNetDevIPAddrGet=E2=80=99 at ../src/util/virnet= devip.c:754:16: /usr/include/bits/string_fortified.h:29:10: error: =E2=80=98__builtin_memcp= y=E2=80=99 offset [2, 27] from the object at =E2=80=98addr=E2=80=99 is out = of the bounds of referenced subobject =E2=80=98ss_family=E2=80=99 with type= =E2=80=98short unsigned int=E2=80=99 at offset 0 [-Werror=3Darray-bounds] 29 | return __builtin___memcpy_chk (__dest, __src, __len, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 30 | __glibc_objsize0 (__dest)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/bits/socket.h:175, from /usr/include/sys/socket.h:33, from ../src/util/virsocket.h:66, from ../src/util/virsocketaddr.h:21, from ../src/util/virnetdevip.h:21, from ../src/util/virnetdevip.c:21: ../src/util/virnetdevip.c: In function =E2=80=98virNetDevIPAddrGet=E2=80=99: /usr/include/bits/socket.h:193:5: note: subobject =E2=80=98ss_family=E2=80= =99 declared here 193 | __SOCKADDR_COMMON (ss_); /* Address family, etc. */ | ^~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors The code is correct, and this only happens when building at -O2. The docs for -Warray-bounds say that a value of "2" is known to be liable to generate false positives. Rather than downgrade the check everywhere, we do it selectively for sanitizers. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Tim Wiederhake --- meson.build | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index ca4291e37a..d4c142eebb 100644 --- a/meson.build +++ b/meson.build @@ -227,6 +227,11 @@ alloc_max =3D run_command( # sanitizer instrumentation may enlarge stack frames stack_frame_size =3D get_option('b_sanitize') =3D=3D 'none' ? 4096 : 8192 =20 +# array_bounds=3D2 check triggers false positive on some GCC +# versions when using sanitizers. Seen on Fedora 34 with +# GCC 11.1.1 +array_bounds =3D get_option('b_sanitize') =3D=3D 'none' ? 2 : 1 + cc_flags +=3D [ '-fasynchronous-unwind-tables', '-fexceptions', @@ -238,7 +243,7 @@ cc_flags +=3D [ '-Waggressive-loop-optimizations', '-Walloc-size-larger-than=3D@0@'.format(alloc_max.stdout().strip()), '-Walloca', - '-Warray-bounds=3D2', + '-Warray-bounds=3D@0@'.format(array_bounds), '-Wattribute-alias=3D2', '-Wattribute-warning', '-Wattributes', --=20 2.31.1