From nobody Mon May 6 01:18:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1626944439; cv=none; d=zohomail.com; s=zohoarc; b=KnNyNCl+ghMRRiNaVTuAx4k0KYxZ/UcY5MOSmj9SlfS2God7rMzTFNaMMh0dxay7wGDg5m/SIGH75zQhVspUH4YIRyMKt5kLmXsTYW/K+wLhivzffGtfPIHKVAEx/H5fekXHxsSxemNAn8eGaBML5K03P/jZSqh4fz9Oh9oreZc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626944439; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zviICAzqRG8GmIKeax4EfKn4BQfNgtrS8k89YL8sKGY=; b=HsF4uly1r55ugcVYy7aCXuUvPpLe0A9QICWrn2QsRuWTfb43peiqf9Hqcu+bECUDNuTYotuSpiDaZ+RY/VWn/cP3sLFA3Be2rg3eCUjdGp1efbwllqEhqhe6/XKdX/YVzIWWpLrs+YFy/Fo6imxNETtfVyGN68m2WOVn7ibPs5U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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 [170.10.133.124]) by mx.zohomail.com with SMTPS id 1626944439627279.75685771208805; Thu, 22 Jul 2021 02:00:39 -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-248-hpZX92b1NlOV5K7HefjlsQ-1; Thu, 22 Jul 2021 05:00:36 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1CDB11084F55; Thu, 22 Jul 2021 09:00:31 +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 EA9202B0A9; Thu, 22 Jul 2021 09:00:30 +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 648294A7C8; Thu, 22 Jul 2021 09:00:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 16M90RvN016956 for ; Thu, 22 Jul 2021 05:00:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0C2F8100763D; Thu, 22 Jul 2021 09:00:27 +0000 (UTC) Received: from work.redhat.com (ovpn-112-127.ams2.redhat.com [10.36.112.127]) by smtp.corp.redhat.com (Postfix) with ESMTP id 52DEC1007604; Thu, 22 Jul 2021 09:00:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626944438; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=zviICAzqRG8GmIKeax4EfKn4BQfNgtrS8k89YL8sKGY=; b=MzDjCCGkvqBvKjHojy64P+vWzSkY72tO9dppFiuWYUExngYoHdYZ5SPkyw0XEvG9Nh7don M65Uo/rVd/uWb2o2x6X0igitQAk35p5z8oN8iQ364ILIJhYx/tOr2U0IY7V0waZLW4wNUi RRzt8L2Rdrc3CMlzxXkKf//BmiuTX6g= X-MC-Unique: hpZX92b1NlOV5K7HefjlsQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH v2 1/2] virFileReadLimFD: Cast maxlen to size_t before adding Date: Thu, 22 Jul 2021 11:00:17 +0200 Message-Id: <20210722090018.46195-2-twiederh@redhat.com> In-Reply-To: <20210722090018.46195-1-twiederh@redhat.com> References: <20210722090018.46195-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.79 on 10.5.11.13 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1626944441358100001 Content-Type: text/plain; charset="utf-8" If the function is called with maxlen equal to `INT_MAX`, adding one will trigger a signed integer overflow. Signed-off-by: Tim Wiederhake Reviewed-by: Daniel P. Berrang=C3=A9 --- src/util/virfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virfile.c b/src/util/virfile.c index 723e1ca6e5..ad491251a2 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -1422,7 +1422,7 @@ virFileReadLimFD(int fd, int maxlen, char **buf) errno =3D EINVAL; return -1; } - s =3D saferead_lim(fd, maxlen+1, &len); + s =3D saferead_lim(fd, (size_t) maxlen + 1, &len); if (s =3D=3D NULL) return -1; if (len > maxlen || (int)len !=3D len) { --=20 2.31.1 From nobody Mon May 6 01:18:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1626944448; cv=none; d=zohomail.com; s=zohoarc; b=VztKt/Zi3Q46uZM0LnBCFgtGoPVSPRYUSCaIcLVjZtYfVs3uPdkH4RPTz+H+LLPlcw7Sh6uNOeCNuz8ztOytyyLPmZvG4Ir4Dn6oaIDDAMz+d4/fvnlWjohGSJwEdGS61u+p1miQXz3OyaT7FSmdEgJ32m1EVBXq3JzulGaFOl8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626944448; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ryo22P9pKe/mcY6Yb4oerp6XMe060DE/kaIl7+QFleE=; b=ScY2Q2skyDLTukCY3ansAR28um3QrKhxssF8k59FpVhOP27yMyO+XEx8vxT8UneXWkKzw7maaAybY5L1vwRB7yT6QeFrAtBhRARUbBI5h/JPoAHYhQmoAq3eOAvFxIphwN/GpCpBcUreHuyNLc/nI6woRKBg/ocoaf2zMlJ60P4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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 [170.10.133.124]) by mx.zohomail.com with SMTPS id 1626944448554462.8084079119743; Thu, 22 Jul 2021 02:00:48 -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-154-xhhvX3hUOV63srJdz9z-Kw-1; Thu, 22 Jul 2021 05:00:45 -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 EB2ED6409E; Thu, 22 Jul 2021 09:00:40 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C378E1007604; Thu, 22 Jul 2021 09:00:40 +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 7EA80180BAB1; Thu, 22 Jul 2021 09:00:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 16M90SHq016967 for ; Thu, 22 Jul 2021 05:00:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1ABF5101E663; Thu, 22 Jul 2021 09:00:28 +0000 (UTC) Received: from work.redhat.com (ovpn-112-127.ams2.redhat.com [10.36.112.127]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5F7E41007604; Thu, 22 Jul 2021 09:00:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626944447; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ryo22P9pKe/mcY6Yb4oerp6XMe060DE/kaIl7+QFleE=; b=WtQcJIey/2+76j2/Df4PmUa78Q2pJdsEji4fvTjlLl6LKvpOZKHdE1Ndx9AarMFWNNlTpe KLTxCxsbJAzTrRB2Gb4w/YOVQA7gc3PaK+tgCDAahqxD7DhV1izDCE2C58RmCYN1Xe3GlE Bmyb4O213CUvJpARB58slwbcBWHyb2w= X-MC-Unique: xhhvX3hUOV63srJdz9z-Kw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH v2 2/2] ci: Halt on sanitizer errors Date: Thu, 22 Jul 2021 11:00:18 +0200 Message-Id: <20210722090018.46195-3-twiederh@redhat.com> In-Reply-To: <20210722090018.46195-1-twiederh@redhat.com> References: <20210722090018.46195-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1626944450647100001 Content-Type: text/plain; charset="utf-8" The undefined behaviour sanitizer (UBSAN) defaults to merely printing an error message if it detects undefined behaviour. These error messages often end up in captured output and do not fail the tests, effectively hiding the warning. Make the test cases fail to make the issues visible. Signed-off-by: Tim Wiederhake Reviewed-by: Daniel P. Berrang=C3=A9 --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3cb6ff5e6b..4757139fa9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -89,6 +89,8 @@ stages: - meson build --werror -Ddocs=3Ddisabled -Db_lundef=3Dfalse -Db_saniti= ze=3D"$SANITIZER" - ninja -C build; - ninja -C build test; + variables: + UBSAN_OPTIONS: print_stacktrace=3D1:halt_on_error=3D1 =20 # Jobs that we delegate to Cirrus CI because they require an operating # system other than Linux. These jobs will only run if the required --=20 2.31.1