From patchwork Thu Mar 19 19:33:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 184701 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp2366077ile; Thu, 19 Mar 2020 12:33:53 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvW3ysiWVI2jvqdMpwDXxIok65T76uI5m/U7Uec7yruFPC8zWgzqjmTyIBqQTP/twH+Dj23 X-Received: by 2002:a05:6214:164d:: with SMTP id f13mr4675838qvw.214.1584646433169; Thu, 19 Mar 2020 12:33:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584646433; cv=none; d=google.com; s=arc-20160816; b=AojWjomdSpOpzS/5AcVadZzdLbdO+T1U2k9RYV3JNQVZuJwa5yA4uko3PahfYnkPeJ tCSFmlB2iq0YZfgLvGNrsVu2rrO5qL413ZALINrhCWUhO9C1kHqWbhzek7aBsPaMn5pC 8mNBS1YRFPQnM6CASQdzdR6xmb4X0fo/5nPIdDgBbVjp2LFcpgPZC8D7ByyrgeDFhKba JjFngjMOfersnKwSw+fV+iKijR6eZTVsn8CMMT8VSA/z1w8qrZWuov0vyrPPILcVZduY Qmko42mHXBQs0Xrmx2V7N/STvF6ea5/LTmzXb8BHzK6nNcKjvjWGQsADC/5e3dJ9LEOi 66ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=Jh3gZFW8hITPJm52vDp0+U3ojSlhwuXHPcuBu7ELJi8=; b=1JAvV66Qy3qvoUhqp5P0BXXgDjiiPF7P9vBrS5YcyGGsgZBKzOtnMgf4AWA0vMSURr iRyNDqPMyB051e3FLfjGe9n5EpxpPx9AJR9te0M47b5APsg9AUMtS8jopL5r6ikdAjoT q/8077Ta7JY+Tk+O9aqCZJE9fxN9pegDPRGsw3E7PKX7Qdr2fJQzl7kI8n5R0IydexSq +ubU2WGzZhPk5Lip6tccdLR5c1x7vZJjS0Jm8QdcjRAfzW0mMkOsRp4rTD8vyr0roahP mxGHw3TkqCg/jKmT77R3AdF1wdQmPf0Ui7ra12l9Ik625uIfZN7PxhtukL+peMgD8EyJ f8bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="qK2Y/gWM"; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b14si1643292qkh.223.2020.03.19.12.33.53 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Mar 2020 12:33:53 -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="qK2Y/gWM"; 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 Received: from localhost ([::1]:42164 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jF0vQ-0004Gr-Ob for patch@linaro.org; Thu, 19 Mar 2020 15:33:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58038) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jF0v3-0004GC-G3 for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jF0v2-0005o0-Cu for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:29 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:35028) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jF0v2-0005mv-6p for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:28 -0400 Received: by mail-wr1-x444.google.com with SMTP id h4so4675452wru.2 for ; Thu, 19 Mar 2020 12:33:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Jh3gZFW8hITPJm52vDp0+U3ojSlhwuXHPcuBu7ELJi8=; b=qK2Y/gWMId7ULf7kwlPCJlHcu4zU71MQ4LYOH9JpSjK2zll5B3udpVWapKbFgKNuUh DMcAZG6VExueagn3XquNaX/7hRpzX01tTno0TaqvLTRcy+V4K84uWXuQDvMQHihljf0D lMr+Mo0xUX4gsucio9/9oUDOPGOisCAtSeHLbjtRkehMSTzQwGw3KTMPwY9n9dV+0dYW igzGDxfbwpwASRbZGSQj9kaCAdtBS3z/FFSR4mtEkxPIIC6tSLWNiADvFk5Q1IEKd4l5 +uI3EiaNvbzo/1sTCmOVLp+EfK8DksCaPKbz16WvRYjA04nsGQGoPJqr3DmEgLKz3BJ3 FWyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Jh3gZFW8hITPJm52vDp0+U3ojSlhwuXHPcuBu7ELJi8=; b=q0Oe3ujHgvYRCLvRImfX9V+Gv+Znj+ylwZ0GDXs0V9y5wjDS4VCukg7RTU4hFFSSSd zPKbgN5pQe85PayBOowQmEMT00DMDBxVwolQVKakyS3JtcUVLRUjefUQY2aMkrQTWOHc 52MdEwMvMOKav9uoaqLzd/y96PXa9MC9KJp7qfWg+9J1u9yaFKptaMoX2kb/OhUIfZVd AUiPXlxelH7pi8APcbuz5sYydeR6t3t4slK7HA46t/PabUl9eSN1D3DddDgL5R1Gugia 96YQqT2YTThM4caKIKx3nD6qglY6vBOY13V97Xpa6JVImIB3l0hsSg15dVm2mh3VB9e2 mT6Q== X-Gm-Message-State: ANhLgQ3Jy6Elwszb60zaP+aV4d3ApVVj3ZL5guuZYhAxIiHnMAeQepcO St5y0CyRIdL8qTAvCyDLWUomHl6zi7C/yA== X-Received: by 2002:adf:ecc7:: with SMTP id s7mr6396061wro.386.1584646406640; Thu, 19 Mar 2020 12:33:26 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id o9sm4984794wrw.20.2020.03.19.12.33.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Mar 2020 12:33:26 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH v2 1/6] osdep.h: Drop no-longer-needed Coverity workarounds Date: Thu, 19 Mar 2020 19:33:18 +0000 Message-Id: <20200319193323.2038-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200319193323.2038-1-peter.maydell@linaro.org> References: <20200319193323.2038-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" In commit a1a98357e3fd in 2018 we added some workarounds for Coverity not being able to handle the _Float* types introduced by recent glibc. Newer versions of the Coverity scan tools have support for these types, and will fail with errors about duplicate typedefs if we have our workaround. Remove our copy of the typedefs. Signed-off-by: Peter Maydell --- Sadly I don't think there's any way to tell whether we should or should not provide the typedefs, so anybody with an older Coverity will presumably find this breaks them. --- include/qemu/osdep.h | 14 -------------- 1 file changed, 14 deletions(-) -- 2.20.1 Reviewed-by: Richard Henderson diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 9bd3dcfd136..20f5c5f197d 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -33,20 +33,6 @@ #else #include "exec/poison.h" #endif -#ifdef __COVERITY__ -/* Coverity does not like the new _Float* types that are used by - * recent glibc, and croaks on every single file that includes - * stdlib.h. These typedefs are enough to please it. - * - * Note that these fix parse errors so they cannot be placed in - * scripts/coverity-model.c. - */ -typedef float _Float32; -typedef double _Float32x; -typedef double _Float64; -typedef __float80 _Float64x; -typedef __float128 _Float128; -#endif #include "qemu/compiler.h" From patchwork Thu Mar 19 19:33:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 184702 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp2366082ile; Thu, 19 Mar 2020 12:33:53 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsZDUIfglC3SSpgx49+LH1t3LRRZPaTCfTq6j9gEtxOk6jPSGnlX+FN2vwkALQgu3XXLMyD X-Received: by 2002:ac8:505a:: with SMTP id h26mr4611398qtm.84.1584646433340; Thu, 19 Mar 2020 12:33:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584646433; cv=none; d=google.com; s=arc-20160816; b=0LGNUKCV6/7BeH9Hv2/qy0y+BmYUQh4J7GkNoDnvbjiWUUU+imyoIPWw2vxRlsKfzL ZdZFnkWmBCLTPwNfbiGJ/opQlITEfZtJHaM5MUgtmI0nAIeYDfpiTAZVit+RCJAlVqX1 ySFIbusarwWxcDloKoO3pXQ1W14cPyfbM4uk8oA3FfZ2Pl3jO7XgwU0lHkTJkWGLPnv0 ms/M63FuVO2/ZmNbz8BR7DvYFI9p7l50/GECh2+J4Gewb23eFXEZP4g8/IjiWwR+aMVz PZ264wdjynlOI75O5MpXHTxC5jDis3KdA8JPeQA3te7sS7Ci6eo/oOELEhQY1DXUgncW O/Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=smsrtU5x+Ww0fA4g+LeGtvF6EpGiUdbtArUTIrJNIQ0=; b=VeBF4PBSl4gLPWuxPTOGA4LBZs3+JrAgCHeKbBZVOG+Fc5FfxR1fdV8Hxyx0RRvwQQ lZQm1HEpEsFqwPdOQLCYFehAY8hPSBhz51DE5VL9HgSXTmH7VfJWr4caLoFVL4TW9n7T zAq6394pizl+wn9ALa6yArJ8CmjokA9xAMcnudpcwuX0nOEHr5rrlXL4LNv+qeTcKzkz B5I9HXc+fYKnDRw755yJJlqXLE//CgOl34qA3ika8bXGcsnw3umaFQ8oQJJRw2kZG99F NJ7+rzMgGamzyGwDmU+pyftylyqipQvGVAkopJVsfUO7Vk/7Ax3/XQ/eecQx3wzSVOUw rLwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Q0tDhS99; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a18si1771825qvj.201.2020.03.19.12.33.53 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Mar 2020 12:33:53 -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=Q0tDhS99; 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 Received: from localhost ([::1]:42172 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jF0vQ-0004H7-Sz for patch@linaro.org; Thu, 19 Mar 2020 15:33:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58055) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jF0v4-0004GD-A9 for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jF0v3-0005pT-8B for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:30 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:33977) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jF0v3-0005oW-2N for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:29 -0400 Received: by mail-wr1-x444.google.com with SMTP id z15so4659235wrl.1 for ; Thu, 19 Mar 2020 12:33:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=smsrtU5x+Ww0fA4g+LeGtvF6EpGiUdbtArUTIrJNIQ0=; b=Q0tDhS990sj6uzNWIfGFwU92SMl8u3+aXG+LEXxgAuKb9PRbbSaj39Qgx436xD7Xqc Qc0ZXYx3I1H2suQ1xYvAUdqm9CkjrzaHGLb14LzIvvufALlqyOtknqVA1wp4z3x5MNf5 S7TXvyZZmONJSPtbLXWR7xyfhp4hxQaeKO8KfG/ZAcpz24mcoYRfhtudpc2laRs8Dcpo aXqHX52CeZLfOxldUZrlYlSlnFDaOUooSY2AIfZOdd/acnBbjzxMHLrShItq7JN7ffXI vUj+yrJ0baVZFj16rrgKcYVC3l2RWVMvCt7i/v0a3O29nfwCwwKeKb1skNDp6S5jXEqU 9/Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=smsrtU5x+Ww0fA4g+LeGtvF6EpGiUdbtArUTIrJNIQ0=; b=ijqGu1V411pQhkLK7dNpxYaF1lIVzE5iHT2o8aWdoRSeRZmUqUMeXJrPdvmW3Gao9z EfJrQjZ7wvMAKV/HPRIeXnDdtqVnEOVdhaOgUZUotvNeazACqXGUtb+q8kK5IoIQD65R n9eR93QUUXGPrFn1OJim1Ia4gfzIeS/bV8jiNrNrv4KXLZ5QTHsLHilC0AUAFbnvnddm 2nUan2aYnjlO4YPMkDCUMC+/PoAzbIAB9alpLZJT+OAYZHI6fqq/7itFygoshc/7qTUk LpQ0AqxxRab/1nhWTgGjKWpUv8DNcfUwpfoMyAfBulhocjsEg4T8d6raqkvwBZWFtfBk lC4Q== X-Gm-Message-State: ANhLgQ1FvqGBRyocT0xWYYTCVEFcIV6K7o0uPFWNqbUxnCRbo1dJ+Yxs s0vFGYmQsrT4kcnUAglo/RjgZZdlWLWIIQ== X-Received: by 2002:a5d:5290:: with SMTP id c16mr5922034wrv.235.1584646407864; Thu, 19 Mar 2020 12:33:27 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id o9sm4984794wrw.20.2020.03.19.12.33.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Mar 2020 12:33:27 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH v2 2/6] thread.h: Fix Coverity version of qemu_cond_timedwait() Date: Thu, 19 Mar 2020 19:33:19 +0000 Message-Id: <20200319193323.2038-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200319193323.2038-1-peter.maydell@linaro.org> References: <20200319193323.2038-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" For Coverity's benefit, we provide simpler versions of functions like qemu_mutex_lock(), qemu_cond_wait() and qemu_cond_timedwait(). When we added qemu_cond_timedwait() in commit 3dcc9c6ec4ea, a cut and paste error meant that the Coverity version of qemu_cond_timedwait() was using the wrong _impl function, which makes the Coverity parser complain: "/qemu/include/qemu/thread.h", line 159: warning #140: too many arguments in function call return qemu_cond_timedwait(cond, mutex, ms); ^ "/qemu/include/qemu/thread.h", line 159: warning #120: return value type does not match the function type return qemu_cond_timedwait(cond, mutex, ms); ^ "/qemu/include/qemu/thread.h", line 156: warning #1563: function "qemu_cond_timedwait" not emitted, consider modeling it or review parse diagnostics to improve fidelity static inline bool (qemu_cond_timedwait)(QemuCond *cond, QemuMutex *mutex, ^ These aren't fatal, but reduce the scope of the analysis. Fix the error. Signed-off-by: Peter Maydell --- include/qemu/thread.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.1 Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé diff --git a/include/qemu/thread.h b/include/qemu/thread.h index 047db0307e7..10262c63f58 100644 --- a/include/qemu/thread.h +++ b/include/qemu/thread.h @@ -67,7 +67,7 @@ extern QemuCondTimedWaitFunc qemu_cond_timedwait_func; #define qemu_cond_wait(c, m) \ qemu_cond_wait_impl(c, m, __FILE__, __LINE__); #define qemu_cond_timedwait(c, m, ms) \ - qemu_cond_wait_impl(c, m, ms, __FILE__, __LINE__); + qemu_cond_timedwait_impl(c, m, ms, __FILE__, __LINE__); #else #define qemu_mutex_lock(m) ({ \ QemuMutexLockFunc _f = atomic_read(&qemu_mutex_lock_func); \ From patchwork Thu Mar 19 19:33:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 184706 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp2369052ile; Thu, 19 Mar 2020 12:36:47 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsRbGZtkpdFWjpCoX3jRudtXDagR5XRuinP3Bt4H+rzpZWPiAuPYhhz7pYLBTireV1d2DFI X-Received: by 2002:aed:2a55:: with SMTP id k21mr4834484qtf.159.1584646607018; Thu, 19 Mar 2020 12:36:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584646607; cv=none; d=google.com; s=arc-20160816; b=WBgX3oLQHuI6ytafX+en3Iez2QwYNSo0lYDmlAHzSBH2Xo83pa53ykBSahNSNgX4Uh m2wBue/HCa/AXtJrkN4yTJgsIyl5XD2EJ2nJlr8zMgFL6wUp4clh8IqfUo2QBz2Pkv21 pn8TOGFoBvf7mn8xebLuIGOCRdfe9UIQCF+prkBEPaa6iiUCynvdGSY8tJtK/kM4VPln R0vGb0vwEhgwiCrZVRBEWXGewLZEtZ1/rpl25aznpj73Jbgyl9L1f/kuownzxYoGE6RY De44SPteId8LULAu4iE80tdk6cbzbY/6FNbpyezds/DRgI+8qznps96Z2ecRgj1WybU3 e0Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=QFHCsQgndAIVNPG9R5oLtcytKTpUJCNgdX7D4zaqb8o=; b=VZG404e4/FJ2bUE9oIlVkmEeOZibdYMJMNolTgV9/MxKFln6Xfx50zEt6rEYC+4sec 9fHCfHhGKxDpfL1xs6oKpSBqZZOpJzAxi1BJfgYSpUf5tbjLyOiejgVxPboaz2TUcwVn X3Ar2W+kkC2uOiZNH/piaGvKugT9bwpQAfhmzhontMWPht5osIUk8Bi8WpeG7apiIqJo A2Eyqwf5tTUmEyYtDFrxYHzY9jM2PfIYGh+yaoKb5PMcAuv3o5pFBH3+5zdN7yQAwenT Z7aJYE2C0qSHqciu5OgKSQkXmnfn+07K/wYBMv/0dO+L5RHI7YFI7G23vzRF6g5LwoSs f6nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HZnbEhEt; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o11si2024940qke.53.2020.03.19.12.36.46 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Mar 2020 12:36:47 -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=HZnbEhEt; 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 Received: from localhost ([::1]:42262 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jF0yE-0000HG-J3 for patch@linaro.org; Thu, 19 Mar 2020 15:36:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58085) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jF0v6-0004HE-Ik for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jF0v5-0005tq-Fn for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:32 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:38576) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jF0v5-0005rq-9N for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:31 -0400 Received: by mail-wm1-x344.google.com with SMTP id l20so3745410wmi.3 for ; Thu, 19 Mar 2020 12:33:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QFHCsQgndAIVNPG9R5oLtcytKTpUJCNgdX7D4zaqb8o=; b=HZnbEhEtprEyZe0hBcXSwd2zypShGKy/o2KJ7qX8RFxFFPm9J4TQUDWw8dMz3q5zzQ KIPF9hMnZ9LXAM3ficXklUI5hwr6pgV/MzW/EurzvosxdcBJ5k9JnFL/dnvUwzU6W7k3 M7xkP1rlCGjgJrC6d3QU3xbdw51HTlMEalbnpbt3sc00lNYN46FQkbAWT9E5obIbMSxL y+wT33rQ+gB3GSO/62cQ82Vpg6CGomvGlUCJvlRqt0jK6MdNw/HVJjagpQtFj2i2/2vM Yx8Ooi4MOg0Xw83i1w0dlrCoQ3y5rtPM4XueUwla5ZEwhl0x5ANOMUDbCWXfT8m2Nu06 CxNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QFHCsQgndAIVNPG9R5oLtcytKTpUJCNgdX7D4zaqb8o=; b=AkgGdm734BTb2pKLlD9q45Mp+B6kicPbKNu0Tp7JP25xzoskCLIGQrPgPzVgN/ZcWg vA1mvnZ4PBh64uJ1j96/Hy96Y7fm3v4Nlsan2PLJ1aLCLbUGfQnnXIMglJAZxTn1ezNO Od6zKKASs+MvnqpQUIXVqfWGJP8I3CdJ9Jg6WEBoDnfHtxy6+PQQbYQbRCzWlqs+88u8 W9yy41nYv+qPa/r6tEunwakStOIzods2DrmBzRKxIprhjVjNPmfEA0pOJHtiPCaNJ67f V9OC+3NDELVnwMrFvpDg6Oja+XUP6M3Mdh1HXSKldZzTWBYUhuq0GhEL9GcpgozqRSHE +rnw== X-Gm-Message-State: ANhLgQ01KBefv1oYYUv0BBZDYzfR/uPexKp7HTgRx0Lf+ZGW3S69MtNQ BxZ9XEM8ILAvj6H2TzmdBRqD8gxlzN+Y9Q== X-Received: by 2002:a1c:2dc7:: with SMTP id t190mr5674694wmt.137.1584646408916; Thu, 19 Mar 2020 12:33:28 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id o9sm4984794wrw.20.2020.03.19.12.33.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Mar 2020 12:33:28 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH v2 3/6] thread.h: Remove trailing semicolons from Coverity qemu_mutex_lock() etc Date: Thu, 19 Mar 2020 19:33:20 +0000 Message-Id: <20200319193323.2038-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200319193323.2038-1-peter.maydell@linaro.org> References: <20200319193323.2038-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" All the Coverity-specific definitions of qemu_mutex_lock() and friends have a trailing semicolon. This works fine almost everywhere because of QEMU's mandatory-braces coding style and because most callsites are simple, but target/s390x/sigp.c has a use of qemu_mutex_trylock() as an if() statement, which makes the ';' a syntax error: "../target/s390x/sigp.c", line 461: warning #18: expected a ")" if (qemu_mutex_trylock(&qemu_sigp_mutex)) { ^ Remove the bogus semicolons from the macro definitions. Signed-off-by: Peter Maydell --- include/qemu/thread.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) -- 2.20.1 Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé diff --git a/include/qemu/thread.h b/include/qemu/thread.h index 10262c63f58..d22848138ea 100644 --- a/include/qemu/thread.h +++ b/include/qemu/thread.h @@ -57,17 +57,17 @@ extern QemuCondTimedWaitFunc qemu_cond_timedwait_func; * hide them. */ #define qemu_mutex_lock(m) \ - qemu_mutex_lock_impl(m, __FILE__, __LINE__); + qemu_mutex_lock_impl(m, __FILE__, __LINE__) #define qemu_mutex_trylock(m) \ - qemu_mutex_trylock_impl(m, __FILE__, __LINE__); + qemu_mutex_trylock_impl(m, __FILE__, __LINE__) #define qemu_rec_mutex_lock(m) \ - qemu_rec_mutex_lock_impl(m, __FILE__, __LINE__); + qemu_rec_mutex_lock_impl(m, __FILE__, __LINE__) #define qemu_rec_mutex_trylock(m) \ - qemu_rec_mutex_trylock_impl(m, __FILE__, __LINE__); + qemu_rec_mutex_trylock_impl(m, __FILE__, __LINE__) #define qemu_cond_wait(c, m) \ - qemu_cond_wait_impl(c, m, __FILE__, __LINE__); + qemu_cond_wait_impl(c, m, __FILE__, __LINE__) #define qemu_cond_timedwait(c, m, ms) \ - qemu_cond_timedwait_impl(c, m, ms, __FILE__, __LINE__); + qemu_cond_timedwait_impl(c, m, ms, __FILE__, __LINE__) #else #define qemu_mutex_lock(m) ({ \ QemuMutexLockFunc _f = atomic_read(&qemu_mutex_lock_func); \ From patchwork Thu Mar 19 19:33:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 184703 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp2366138ile; Thu, 19 Mar 2020 12:33:56 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsR5BVhCS2jUXylXxmfH1qZNGDTTd9hOsO1IqTSmIjxw5O0INcRTWoaFMHMzU/QO6RzTBuS X-Received: by 2002:a05:620a:1125:: with SMTP id p5mr4761131qkk.103.1584646436663; Thu, 19 Mar 2020 12:33:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584646436; cv=none; d=google.com; s=arc-20160816; b=e91TOdyT0oQydAm+t4U4w1/3rjpimBmIxA/Kk4c4mu5AYHQ5R4wIVm5ab2mgISwYWV dzCyzwO5ysiuF7bAHSU0cYNPbxU1foiJDOsOEoJuneFMw4xsz4c8k57tW+ePFbf7PuTA Qy/eTZPXy97ycyHNLJ4RkSQFXNC5elfTfaf5og9emrVhLF3pnXDIue6AQrCZcLbk41ci 1RTl3OiqjiFSpaDd5M1NzKi9HV7gsZ04FPZVZsBTJomgj5G78vCeYETxy+XAuQQdP49Y 2n6bt+Me6/B46DQmUewfjMLL13ZNW8H9wuSzFaghc+QhdU7iehXENkL4aXXFUcKqy1XG TocA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=xmJXguFcCJyV8YvdEoeDLFSPVywWgWvisk8RAVF+M1Y=; b=BEms1xRYKagL2d10C7+0PtRdVR3WKKUrQwRRG4n1V3TLIrl7bjywmVjkMjRY85gWhe 59P+/2q3JkQPO0t8khpEMZbv+3haMurT3B6Uh81F0pXusmYNs8Cf68wCiNfd3w6p9MZN K6wx8CNa/DHvjdQo/Yy1geZu5GbN5aFrQox6yCuc8i05brCWgIyO3Q200bPaONYdSq+G YE2HEbyunsRryfaXzCexY/dWXvipq+rvPMvvfMkqM4nE/vfsV9qYu5SWfHsVZGKmEZEe O71KrezN47PXCbNcPl/AzffqPkjOZ4XNwPUDNzi22aQnnElBUDEXCY5LwFygYz7IXrP1 HSzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="QjikPO/l"; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a26si2061037qkn.63.2020.03.19.12.33.56 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Mar 2020 12:33: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="QjikPO/l"; 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 Received: from localhost ([::1]:42184 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jF0vU-0004LG-7z for patch@linaro.org; Thu, 19 Mar 2020 15:33:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58082) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jF0v6-0004H4-F9 for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jF0v5-0005ta-E4 for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:32 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:39738) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jF0v5-0005ro-87 for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:31 -0400 Received: by mail-wm1-x342.google.com with SMTP id a9so688574wmj.4 for ; Thu, 19 Mar 2020 12:33:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xmJXguFcCJyV8YvdEoeDLFSPVywWgWvisk8RAVF+M1Y=; b=QjikPO/llx/bix7LQibhTzqpE1buWelkBsfPF54WGEloF4eLaQRrKbAYm0N8144J0g OHkTXCw/6EXjG/YRKSt6hdqOhAe4LHR7UTDdbJw+pbZRFd6u3fczIJsn19FwxoJ9msgL yEwSj4v6AWOZrHLoUbvT9Rc1DvzSblFlCn641om6KYbyQWHS+pL3pQ86P1ZnHyMLoF4H Gq79P0K1ILHWu5OCDhcOmXP3jcSCAWKTLxhVMUb9JgQrwWFDYCQ4RGC3JPRBV+KJEo8g zaXs2kjVYCKKhGYMGD292ccZokD0h7wiFjHwtHDlmrPINM2d+F6Ha5OyZIP+AvKhczkq hSfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xmJXguFcCJyV8YvdEoeDLFSPVywWgWvisk8RAVF+M1Y=; b=eYTGV8oPuHq2dfD5KEvcRNG8yAYZpUOoowgjvrrx/ILPc/4hV1CeROYS2+fFmMiw2x sNY4CCagrCgoeFzDrCWt8WcJCoL8AazVd90110lfKPvrHg3WXYkpxf2/JbnURPqXVT0b i3P6Z4YenyRNMf3X5rEPZPPYzERyjpBkjvgYZaf9JpTSQn27K5psE5Y4Wdxh1neHqiXc EQjZEL6fPcBf6WOGPGQHLCcLXRLDyF2F4QiICfLWsjj12sqsaqVprzoIWd4+XiiGKT1G o/6H9tO4vYSShcWsOf/xH6VbOTagpioeeAX3qQ9JtQejvuc9ULv/1J0AnD21cRjIlGV0 4hcg== X-Gm-Message-State: ANhLgQ18emOd7CLAXQB03tU2UI0gU30PiPSdRL1ontRLMqig2J3rgone b1f6yBKIUmcs8KLzWFL4L6zwaDGK6kAkPw== X-Received: by 2002:a1c:ba04:: with SMTP id k4mr5648802wmf.165.1584646409886; Thu, 19 Mar 2020 12:33:29 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id o9sm4984794wrw.20.2020.03.19.12.33.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Mar 2020 12:33:29 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH v2 4/6] linux-user/flatload.c: Use "" for include of QEMU header target_flat.h Date: Thu, 19 Mar 2020 19:33:21 +0000 Message-Id: <20200319193323.2038-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200319193323.2038-1-peter.maydell@linaro.org> References: <20200319193323.2038-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The target_flat.h file is a QEMU header, so we should include it using quotes, not angle brackets. Coverity otherwise is unable to find the header: "../linux-user/flatload.c", line 40: error #1712: cannot open source file "target_flat.h" #include ^ because the relevant directory is only on the -iquote path, not the -I path. Signed-off-by: Peter Maydell --- I don't know why Coverity in particular has trouble here but real compilers don't. Still, the "" is the right thing. --- linux-user/flatload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.1 Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé diff --git a/linux-user/flatload.c b/linux-user/flatload.c index 0122ab3afe6..66901f39cc5 100644 --- a/linux-user/flatload.c +++ b/linux-user/flatload.c @@ -37,7 +37,7 @@ #include "qemu.h" #include "flat.h" -#include +#include "target_flat.h" //#define DEBUG From patchwork Thu Mar 19 19:33:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 184704 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp2367999ile; Thu, 19 Mar 2020 12:35:40 -0700 (PDT) X-Google-Smtp-Source: ADFU+vs0LzkU2KJK4KGMRZzrRqCLtvwiShy3lgWgMLMMtMPhLmWQoiXZHv3FHWGwHiFd3Fmr4WU8 X-Received: by 2002:a37:9e05:: with SMTP id h5mr1009919qke.71.1584646540124; Thu, 19 Mar 2020 12:35:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584646540; cv=none; d=google.com; s=arc-20160816; b=PDPy4NmKGDriupOETzEK5wa6QTTEhEBF583ssORq/m1c62owu4jfR0JHis5WyNnvHw NiAQ89bUesay6ctuWaSwVw0qielk1KSkEYBwp7GziGExQOa6lODzuRZkQYPFtx+uzcRQ 2gB6JXZjj4Kq1maaH5WtU7x24kyvpD+htersFrMmZ/VxccqmAFXw5aGIru1lQR3kW+Tp InhfKzV0tRJTJibPgVHwOvfPl3K1O4Gtpc+U9j6ti3/CQGJmxEg3yUbLa3dJRcLkUsYI u5BF9BsH5jvMwWjt7rnUo98dORSzFXGVk9GZx5ECCqPjpYUeIU2EZ8CfI1voQT53aREX ei0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=8ffJlbq2q0JF0+VvZkm8rLGW/gCjOk31Ed0YGik3+A0=; b=SIBIR3o455GE1Y5bBjitMKyVmzZFIi8CTom8VC1JnCORwA9sW6NUs2ArNQdufsZOYU pa5+cEhhlGOds6zLhXHPkxSO3GDL+k6UjzPbc7GvsaL9vxfk+9Whw1KMRl6bfx0YOYYW 93pY4+NQORV19hO6Lqs9qxwamptbbYRQM13sLZfXQDas0u1Bzm0ANfWcsbJ+dK1tmnqa nT9i0gqI7+p9EDn001nzE3cMrIgz2ew8vN6e19/OnV0LWNAGPLjuEqPskIAUu7seasQ/ zLUDqDAfUixz5tVtMFVl2luJ0aRW9+tb6WTllG1MWEBhY/vnCOqXHxa7fQgWea1Idz0s bsTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N9FdOT9J; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j2si2022865qki.113.2020.03.19.12.35.40 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Mar 2020 12:35:40 -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=N9FdOT9J; 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 Received: from localhost ([::1]:42244 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jF0x9-0007P7-Lr for patch@linaro.org; Thu, 19 Mar 2020 15:35:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58114) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jF0v9-0004Mv-H8 for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jF0v7-00061q-8w for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:35 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:38445) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jF0v7-0005y1-13 for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:33 -0400 Received: by mail-wr1-x431.google.com with SMTP id s1so4644601wrv.5 for ; Thu, 19 Mar 2020 12:33:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8ffJlbq2q0JF0+VvZkm8rLGW/gCjOk31Ed0YGik3+A0=; b=N9FdOT9JxNuglsVmzMenuwerlNCbVuq94ocs1I5W+u+JT8/+ydoYLTd8N1L0PMtR4T zQXRfb7OS5Ke9wlTO/mMwUb36JqxtbZPNDK1WN9OHXpnJ3P57uBsUfOl5w4FMdKTR4Is kyWAvarw8iCER3Uj4N9DXcP/WOXkdYq5kqljlN/gaoirz5g+YdhnMNkdo/UkPkhEkq2n iv8UVvjpyyvBC2cNCeDc0tTQ5JNopEGhrhYlqH8wcLUUdlqwCkLqnYV1ArtTdL1s4tUT 6R3f2PK2+V0IH1jX+jQzDkXDqHkuBm6axi6Ob1N/1ijTMQ6djl/r+4SsJC9uXhBZU9C3 vHoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8ffJlbq2q0JF0+VvZkm8rLGW/gCjOk31Ed0YGik3+A0=; b=B29KPrt0Y3fz6ywGwJQzVMHrVD1zs5BdMHU5POViITC230bF+WYClRvjwe9jvXty+l n1pyaFPch1Y4RTeukSfSIj0SNr0nM/NS82IuefG6rb11Aync348UmtYASrlzDl0qjGO2 qc3JfwgAyLH8fz5LoBgwT5UcewMAgt74e+q4JEE3okjqkck+CpbWqEp56YNXQiO1RVLh z4pElDJC0llkU44I3eET+ZkAMyydHLt4F2aHL+dEGE5vbnQN/DqgoWuB05ee3kjp/AKE VYWAINXH8XM6/jFYkee5Goud0qmzxiVSkPn5WTtYJy+Z+sDRKNwBPHGofsEwSjQp3VAV +jdw== X-Gm-Message-State: ANhLgQ1iPTUb9UNNV0KBIbb4BYPUE1WsNdwCICRvSXPU8H6V+jetV12s UWXns4VD0n2QV+OYhIPuWzqZSxYGVh14sA== X-Received: by 2002:adf:f1c4:: with SMTP id z4mr6599188wro.342.1584646411009; Thu, 19 Mar 2020 12:33:31 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id o9sm4984794wrw.20.2020.03.19.12.33.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Mar 2020 12:33:30 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH v2 5/6] scripts/run-coverity-scan: Script to run Coverity Scan build Date: Thu, 19 Mar 2020 19:33:22 +0000 Message-Id: <20200319193323.2038-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200319193323.2038-1-peter.maydell@linaro.org> References: <20200319193323.2038-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::431 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Add a new script to automate the process of running the Coverity Scan build tools and uploading the resulting tarball to the website. This is intended eventually to be driven from Travis, but it can be run locally, if you are a maintainer of the QEMU project on the Coverity Scan website and have the secret upload token. The script must be run on a Fedora 30 system. Support for using a Docker container is added in a following commit. Signed-off-by: Peter Maydell --- changes v1->v2: * fix sense of DRYRUN test in check_upload_permissions * use nproc rather than hardcoding -j8 * use $PWD rather than $(pwd) * minor tweaks to configure line * new --results-tarball option --- MAINTAINERS | 5 + scripts/coverity-scan/run-coverity-scan | 311 ++++++++++++++++++++++++ 2 files changed, 316 insertions(+) create mode 100755 scripts/coverity-scan/run-coverity-scan -- 2.20.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/MAINTAINERS b/MAINTAINERS index 7364af0d8b0..395534522b6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2003,6 +2003,11 @@ M: Markus Armbruster S: Supported F: scripts/coverity-model.c +Coverity Scan integration +M: Peter Maydell +S: Maintained +F: scripts/coverity-scan/ + Device Tree M: Alistair Francis R: David Gibson diff --git a/scripts/coverity-scan/run-coverity-scan b/scripts/coverity-scan/run-coverity-scan new file mode 100755 index 00000000000..d40b51969fa --- /dev/null +++ b/scripts/coverity-scan/run-coverity-scan @@ -0,0 +1,311 @@ +#!/bin/sh -e + +# Upload a created tarball to Coverity Scan, as per +# https://scan.coverity.com/projects/qemu/builds/new + +# This work is licensed under the terms of the GNU GPL version 2, +# or (at your option) any later version. +# See the COPYING file in the top-level directory. +# +# Copyright (c) 2017-2020 Linaro Limited +# Written by Peter Maydell + +# Note that this script will automatically download and +# run the (closed-source) coverity build tools, so don't +# use it if you don't trust them! + +# This script assumes that you're running it from a QEMU source +# tree, and that tree is a fresh clean one, because we do an in-tree +# build. (This is necessary so that the filenames that the Coverity +# Scan server sees are relative paths that match up with the component +# regular expressions it uses; an out-of-tree build won't work for this.) +# The host machine should have as many of QEMU's dependencies +# installed as possible, for maximum coverity coverage. + +# To do an upload you need to be a maintainer in the Coverity online +# service, and you will need to know the "Coverity token", which is a +# secret 8 digit hex string. You can find that from the web UI in the +# project settings, if you have maintainer access there. + +# Command line options: +# --dry-run : run the tools, but don't actually do the upload +# --update-tools-only : update the cached copy of the tools, but don't run them +# --tokenfile : file to read Coverity token from +# --version ver : specify version being analyzed (default: ask git) +# --description desc : specify description of this version (default: ask git) +# --srcdir : QEMU source tree to analyze (default: current working dir) +# --results-tarball : path to copy the results tarball to (default: don't +# copy it anywhere, just upload it) +# +# User-specifiable environment variables: +# COVERITY_TOKEN -- Coverity token +# COVERITY_EMAIL -- the email address to use for uploads (default: +# looks at your git user.email config) +# COVERITY_BUILD_CMD -- make command (default: 'make -jN' where N is +# number of CPUs as determined by 'nproc') +# COVERITY_TOOL_BASE -- set to directory to put coverity tools +# (default: /tmp/coverity-tools) +# +# You must specify the token, either by environment variable or by +# putting it in a file and using --tokenfile. Everything else has +# a reasonable default if this is run from a git tree. + +check_upload_permissions() { + # Check whether we can do an upload to the server; will exit the script + # with status 1 if the check failed (usually a bad token); + # will exit the script with status 0 if the check indicated that we + # can't upload yet (ie we are at quota) + # Assumes that PROJTOKEN, PROJNAME and DRYRUN have been initialized. + + echo "Checking upload permissions..." + + if ! up_perm="$(wget https://scan.coverity.com/api/upload_permitted --post-data "token=$PROJTOKEN&project=$PROJNAME" -q -O -)"; then + echo "Coverity Scan API access denied: bad token?" + exit 1 + fi + + # Really up_perm is a JSON response with either + # {upload_permitted:true} or {next_upload_permitted_at:} + # We do some hacky string parsing instead of properly parsing it. + case "$up_perm" in + *upload_permitted*true*) + echo "Coverity Scan: upload permitted" + ;; + *next_upload_permitted_at*) + if [ "$DRYRUN" = yes ]; then + echo "Coverity Scan: upload quota reached, continuing dry run" + else + echo "Coverity Scan: upload quota reached; stopping here" + # Exit success as this isn't a build error. + exit 0 + fi + ;; + *) + echo "Coverity Scan upload check: unexpected result $up_perm" + exit 1 + ;; + esac +} + + +update_coverity_tools () { + # Check for whether we need to download the Coverity tools + # (either because we don't have a copy, or because it's out of date) + # Assumes that COVERITY_TOOL_BASE, PROJTOKEN and PROJNAME are set. + + mkdir -p "$COVERITY_TOOL_BASE" + cd "$COVERITY_TOOL_BASE" + + echo "Checking for new version of coverity build tools..." + wget https://scan.coverity.com/download/linux64 --post-data "token=$PROJTOKEN&project=$PROJNAME&md5=1" -O coverity_tool.md5.new + + if ! cmp -s coverity_tool.md5 coverity_tool.md5.new; then + # out of date md5 or no md5: download new build tool + # blow away the old build tool + echo "Downloading coverity build tools..." + rm -rf coverity_tool coverity_tool.tgz + wget https://scan.coverity.com/download/linux64 --post-data "token=$PROJTOKEN&project=$PROJNAME" -O coverity_tool.tgz + if ! (cat coverity_tool.md5.new; echo " coverity_tool.tgz") | md5sum -c --status; then + echo "Downloaded tarball didn't match md5sum!" + exit 1 + fi + # extract the new one, keeping it corralled in a 'coverity_tool' directory + echo "Unpacking coverity build tools..." + mkdir -p coverity_tool + cd coverity_tool + tar xf ../coverity_tool.tgz + cd .. + mv coverity_tool.md5.new coverity_tool.md5 + fi + + rm -f coverity_tool.md5.new +} + + +# Check user-provided environment variables and arguments +DRYRUN=no +UPDATE_ONLY=no + +while [ "$#" -ge 1 ]; do + case "$1" in + --dry-run) + shift + DRYRUN=yes + ;; + --update-tools-only) + shift + UPDATE_ONLY=yes + ;; + --version) + shift + if [ $# -eq 0 ]; then + echo "--version needs an argument" + exit 1 + fi + VERSION="$1" + shift + ;; + --description) + shift + if [ $# -eq 0 ]; then + echo "--description needs an argument" + exit 1 + fi + DESCRIPTION="$1" + shift + ;; + --tokenfile) + shift + if [ $# -eq 0 ]; then + echo "--tokenfile needs an argument" + exit 1 + fi + COVERITY_TOKEN="$(cat "$1")" + shift + ;; + --srcdir) + shift + if [ $# -eq 0 ]; then + echo "--srcdir needs an argument" + exit 1 + fi + SRCDIR="$1" + shift + ;; + --results-tarball) + shift + if [ $# -eq 0 ]; then + echo "--results-tarball needs an argument" + exit 1 + fi + RESULTSTARBALL="$1" + shift + ;; + *) + echo "Unexpected argument '$1'" + exit 1 + ;; + esac +done + +if [ -z "$COVERITY_TOKEN" ]; then + echo "COVERITY_TOKEN environment variable not set" + exit 1 +fi + +if [ -z "$COVERITY_BUILD_CMD" ]; then + NPROC=$(nproc) + COVERITY_BUILD_CMD="make -j$NPROC" + echo "COVERITY_BUILD_CMD: using default '$COVERITY_BUILD_CMD'" +fi + +if [ -z "$COVERITY_TOOL_BASE" ]; then + echo "COVERITY_TOOL_BASE: using default /tmp/coverity-tools" + COVERITY_TOOL_BASE=/tmp/coverity-tools +fi + +if [ -z "$SRCDIR" ]; then + SRCDIR="$PWD" +fi + +PROJTOKEN="$COVERITY_TOKEN" +PROJNAME=QEMU +TARBALL=cov-int.tar.xz + + +if [ "$UPDATE_ONLY" = yes ]; then + # Just do the tools update; we don't need to check whether + # we are in a source tree or have upload rights for this, + # so do it before some of the command line and source tree checks. + update_coverity_tools + exit 0 +fi + +cd "$SRCDIR" + +echo "Checking this is a QEMU source tree..." +if ! [ -e "$SRCDIR/VERSION" ]; then + echo "Not in a QEMU source tree?" + exit 1 +fi + +# Fill in defaults used by the non-update-only process +if [ -z "$VERSION" ]; then + VERSION="$(git describe --always HEAD)" +fi + +if [ -z "$DESCRIPTION" ]; then + DESCRIPTION="$(git rev-parse HEAD)" +fi + +if [ -z "$COVERITY_EMAIL" ]; then + COVERITY_EMAIL="$(git config user.email)" +fi + +check_upload_permissions + +update_coverity_tools + +TOOLBIN="$(cd "$COVERITY_TOOL_BASE" && echo $PWD/coverity_tool/cov-analysis-*/bin)" + +if ! test -x "$TOOLBIN/cov-build"; then + echo "Couldn't find cov-build in the coverity build-tool directory??" + exit 1 +fi + +export PATH="$TOOLBIN:$PATH" + +cd "$SRCDIR" + +echo "Doing make distclean..." +make distclean + +echo "Configuring..." +# We configure with a fixed set of enables here to ensure that we don't +# accidentally reduce the scope of the analysis by doing the build on +# the system that's missing a dependency that we need to build part of +# the codebase. +./configure --disable-modules --enable-sdl --enable-gtk \ + --enable-opengl --enable-vte --enable-gnutls \ + --enable-nettle --enable-curses --enable-curl \ + --audio-drv-list=oss,alsa,sdl,pa --enable-virtfs \ + --enable-vnc --enable-vnc-sasl --enable-vnc-jpeg --enable-vnc-png \ + --enable-xen --enable-brlapi \ + --enable-linux-aio --enable-attr \ + --enable-cap-ng --enable-trace-backends=log --enable-spice --enable-rbd \ + --enable-xfsctl --enable-libusb --enable-usb-redir \ + --enable-libiscsi --enable-libnfs --enable-seccomp \ + --enable-tpm --enable-libssh --enable-lzo --enable-snappy --enable-bzip2 \ + --enable-numa --enable-rdma --enable-smartcard --enable-virglrenderer \ + --enable-mpath --enable-libxml2 --enable-glusterfs \ + --enable-virtfs --enable-zstd + +echo "Making libqemustub.a..." +make libqemustub.a + +echo "Running cov-build..." +rm -rf cov-int +mkdir cov-int +cov-build --dir cov-int $COVERITY_BUILD_CMD + +echo "Creating results tarball..." +tar cvf - cov-int | xz > "$TARBALL" + +if [ ! -z "$RESULTSTARBALL" ]; then + echo "Copying results tarball to $RESULTSTARBALL..." + cp "$TARBALL" "$RESULTSTARBALL" +fi + +echo "Uploading results tarball..." + +if [ "$DRYRUN" = yes ]; then + echo "Dry run only, not uploading $TARBALL" + exit 0 +fi + +curl --form token="$PROJTOKEN" --form email="$COVERITY_EMAIL" \ + --form file=@"$TARBALL" --form version="$VERSION" \ + --form description="$DESCRIPTION" \ + https://scan.coverity.com/builds?project="$PROJNAME" + +echo "Done." From patchwork Thu Mar 19 19:33:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 184707 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp2369876ile; Thu, 19 Mar 2020 12:37:41 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtFv5cAEEUg15x/YrU3n9AOXYFKkwGohaDSvrsIIL/FMZL4IiHfGCK9TTQ7WI0nPNVHhjKB X-Received: by 2002:ad4:5427:: with SMTP id g7mr4690307qvt.23.1584646661411; Thu, 19 Mar 2020 12:37:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584646661; cv=none; d=google.com; s=arc-20160816; b=IAvlQg5P3xCtYKkRJXABHRfQNHITEDsTiUnY1nb4cRHIouj214W1BeoR+190iFIlGZ AhjXnTZDfaOPHShLQsca+/vMxu4EPNLYygXm7c2jjSVEXSAYJTUvWXbugZJsTmvpmJ9I 14WqJkvyYbXPtCaCdIDLSY3P9ta8sFyYQ/GfJ8GIgojtvYxstQiLcXg8alMk0AoXQPJ3 +4nSi0UUzHPBbf1KQjUTA2Hcdgf7efZlM3+1Vt1rGCo8qJMSw0rIM9eaXZbLbjAOGaIN IFLSo5pC7Y1sC7t/76RDEtVvoq2WHN184AmYpSTWkY6hqCmMAGqF6YcM0FXPbbcRGeYn rXLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=SF8R5D5p5UyH4Z2/xaugTdMkdjsfKFt6GxrCOXYQG78=; b=prHPwahL2x3q/1eTiYNfZgRlckZgZjCz1l9xwL7ODmmaNyHFpAbB21yd1UEGE+bAkF uq81Xm9RGHmpwItXcxmS2y5vnAEfTTHN7ZSYfy10kVw0C0trIs4lv/badNWzDTtHtPKm qWtwF/n9rx0jTjoMGBvBZC3SGOqZl06l81OnsIxq9g13vdFOot2UAA/CLDHX+r+C9z5Z 3WC963jeq7RQMwhYYlLrJL/oaz9W4z0iVAQBnmCbAxhc/mCqdNGc9EfFEdZEnY/unTIF aOutR2wX8tXyaUm1WN0W2deRYb7Kvq5y7UhzrP+31PMc9vhjdgqnIMltgvPXquuuV5p0 /OUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jZRPhr5K; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n191si1958095qkn.231.2020.03.19.12.37.41 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Mar 2020 12:37:41 -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=jZRPhr5K; 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 Received: from localhost ([::1]:42286 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jF0z6-0001M8-VO for patch@linaro.org; Thu, 19 Mar 2020 15:37:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58121) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jF0vB-0004Nj-Ek for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jF0v7-00064Y-Vh for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:37 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:40994) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jF0v7-00061G-O9 for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:33 -0400 Received: by mail-wr1-x42a.google.com with SMTP id h9so4623828wrc.8 for ; Thu, 19 Mar 2020 12:33:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SF8R5D5p5UyH4Z2/xaugTdMkdjsfKFt6GxrCOXYQG78=; b=jZRPhr5KVfSmJhz+ndRsRgeXlFpnzHf2zU5seVrih4C0XoqHyolvrEsVTkU/ItB4VT YjX2pW1K66uieHOsAFRpLST27jixROhJHLYFIXwEK/Ax+UfmuSlMSgR9CuFk5QrOpggw Zz/C644E+odemwOiAMrKUqkAMs7OITPcHrZb6j16PGmxPw/WgXofSRHn9E6XxSSeI/SQ nUwBB4Zk2HFlYfrqWSOwD1m/jmHo1dExAMNa6uXSo5d+2+Msh/vG3w9VzVYjCtXiLQyz tNLYOzhWsjR/ScfK4W9mQDcsvDOiIgpNQ+v6UDIfVTBTLTiAPT9yThrVGNmO+2w6P8TP 49ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SF8R5D5p5UyH4Z2/xaugTdMkdjsfKFt6GxrCOXYQG78=; b=k/RiulOsLzb7ldeuTsKiNMAxJWCxsJJkFdVWninPWI45XDjA9/Rr/Eqrls0URZ760Z 11PAkkMUDmtbh+zGwdm8e//JKuMthejlmGxM1LVXU3V1QEvqWKD85mTy2hWflt9UryET T+zlfR+lu2jD6eSXWXew0+arI78Dqqs/fqHahOag4jt6WMQ5gLbvK02CdOTomPcxNp0s cAiGYY2ymRsHDoXodYn9FOYKUvtgPSXBVxa1TOEY+RIuDs2e8izdtEFUbXwZ2zA58U/x AH5yTWtT7w6xUFPgd2zciH6/AzwjJakxz65QUNYi4dUpXBG2uPsXHmAMppREjffo3ZJC B7Zw== X-Gm-Message-State: ANhLgQ3rgswtutsWfwoKeVpueAn6I+jsraFwcBYcbqNPIgrZVoEss+sw /R+zQB/YuUKiDFBddC1kFesdSf3fCuLL9w== X-Received: by 2002:adf:83c4:: with SMTP id 62mr6574854wre.105.1584646412099; Thu, 19 Mar 2020 12:33:32 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id o9sm4984794wrw.20.2020.03.19.12.33.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Mar 2020 12:33:31 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH v2 6/6] scripts/coverity-scan: Add Docker support Date: Thu, 19 Mar 2020 19:33:23 +0000 Message-Id: <20200319193323.2038-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200319193323.2038-1-peter.maydell@linaro.org> References: <20200319193323.2038-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42a X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Add support for running the Coverity Scan tools inside a Docker container rather than directly on the host system. Signed-off-by: Peter Maydell --- v1->v2: * various bug fixes * added --src-tarball rather than putting the whole source tree in the 'secrets' directory * docker file package list updated --- scripts/coverity-scan/coverity-scan.docker | 131 +++++++++++++++++++++ scripts/coverity-scan/run-coverity-scan | 90 ++++++++++++++ 2 files changed, 221 insertions(+) create mode 100644 scripts/coverity-scan/coverity-scan.docker -- 2.20.1 Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé diff --git a/scripts/coverity-scan/coverity-scan.docker b/scripts/coverity-scan/coverity-scan.docker new file mode 100644 index 00000000000..a4f64d12834 --- /dev/null +++ b/scripts/coverity-scan/coverity-scan.docker @@ -0,0 +1,131 @@ +# syntax=docker/dockerfile:1.0.0-experimental +# +# Docker setup for running the "Coverity Scan" tools over the source +# tree and uploading them to the website, as per +# https://scan.coverity.com/projects/qemu/builds/new +# We do this on a fixed config (currently Fedora 30 with a known +# set of dependencies and a configure command that enables a specific +# set of options) so that random changes don't result in our accidentally +# dropping some files from the scan. +# +# We don't build on top of the fedora.docker file because we don't +# want to accidentally change or break the scan config when that +# is updated. + +# The work of actually doing the build is handled by the +# run-coverity-scan script. + +FROM fedora:30 +ENV PACKAGES \ + alsa-lib-devel \ + bc \ + bison \ + brlapi-devel \ + bzip2 \ + bzip2-devel \ + ccache \ + clang \ + curl \ + cyrus-sasl-devel \ + dbus-daemon \ + device-mapper-multipath-devel \ + findutils \ + flex \ + gcc \ + gcc-c++ \ + gettext \ + git \ + glib2-devel \ + glusterfs-api-devel \ + gnutls-devel \ + gtk3-devel \ + hostname \ + libaio-devel \ + libasan \ + libattr-devel \ + libblockdev-mpath-devel \ + libcap-devel \ + libcap-ng-devel \ + libcurl-devel \ + libepoxy-devel \ + libfdt-devel \ + libgbm-devel \ + libiscsi-devel \ + libjpeg-devel \ + libpmem-devel \ + libnfs-devel \ + libpng-devel \ + librbd-devel \ + libseccomp-devel \ + libssh-devel \ + libubsan \ + libudev-devel \ + libusbx-devel \ + libxml2-devel \ + libzstd-devel \ + llvm \ + lzo-devel \ + make \ + mingw32-bzip2 \ + mingw32-curl \ + mingw32-glib2 \ + mingw32-gmp \ + mingw32-gnutls \ + mingw32-gtk3 \ + mingw32-libjpeg-turbo \ + mingw32-libpng \ + mingw32-libtasn1 \ + mingw32-nettle \ + mingw32-nsis \ + mingw32-pixman \ + mingw32-pkg-config \ + mingw32-SDL2 \ + mingw64-bzip2 \ + mingw64-curl \ + mingw64-glib2 \ + mingw64-gmp \ + mingw64-gnutls \ + mingw64-gtk3 \ + mingw64-libjpeg-turbo \ + mingw64-libpng \ + mingw64-libtasn1 \ + mingw64-nettle \ + mingw64-pixman \ + mingw64-pkg-config \ + mingw64-SDL2 \ + ncurses-devel \ + nettle-devel \ + nss-devel \ + numactl-devel \ + perl \ + perl-Test-Harness \ + pixman-devel \ + pulseaudio-libs-devel \ + python3 \ + python3-sphinx \ + PyYAML \ + rdma-core-devel \ + SDL2-devel \ + snappy-devel \ + sparse \ + spice-server-devel \ + systemd-devel \ + systemtap-sdt-devel \ + tar \ + texinfo \ + usbredir-devel \ + virglrenderer-devel \ + vte291-devel \ + wget \ + which \ + xen-devel \ + xfsprogs-devel \ + zlib-devel +ENV QEMU_CONFIGURE_OPTS --python=/usr/bin/python3 + +RUN dnf install -y $PACKAGES +RUN rpm -q $PACKAGES | sort > /packages.txt +ENV PATH $PATH:/usr/libexec/python3-sphinx/ +ENV COVERITY_TOOL_BASE=/coverity-tools +COPY run-coverity-scan run-coverity-scan +RUN --mount=type=secret,id=coverity.token,required ./run-coverity-scan --update-tools-only --tokenfile /run/secrets/coverity.token diff --git a/scripts/coverity-scan/run-coverity-scan b/scripts/coverity-scan/run-coverity-scan index d40b51969fa..2e067ef5cfc 100755 --- a/scripts/coverity-scan/run-coverity-scan +++ b/scripts/coverity-scan/run-coverity-scan @@ -29,6 +29,7 @@ # Command line options: # --dry-run : run the tools, but don't actually do the upload +# --docker : create and work inside a docker container # --update-tools-only : update the cached copy of the tools, but don't run them # --tokenfile : file to read Coverity token from # --version ver : specify version being analyzed (default: ask git) @@ -36,6 +37,8 @@ # --srcdir : QEMU source tree to analyze (default: current working dir) # --results-tarball : path to copy the results tarball to (default: don't # copy it anywhere, just upload it) +# --src-tarball : tarball to untar into src dir (default: none); this +# is intended mainly for internal use by the Docker support # # User-specifiable environment variables: # COVERITY_TOKEN -- Coverity token @@ -125,6 +128,7 @@ update_coverity_tools () { # Check user-provided environment variables and arguments DRYRUN=no UPDATE_ONLY=no +DOCKER=no while [ "$#" -ge 1 ]; do case "$1" in @@ -181,6 +185,19 @@ while [ "$#" -ge 1 ]; do RESULTSTARBALL="$1" shift ;; + --src-tarball) + shift + if [ $# -eq 0 ]; then + echo "--src-tarball needs an argument" + exit 1 + fi + SRCTARBALL="$1" + shift + ;; + --docker) + DOCKER=yes + shift + ;; *) echo "Unexpected argument '$1'" exit 1 @@ -212,6 +229,10 @@ PROJTOKEN="$COVERITY_TOKEN" PROJNAME=QEMU TARBALL=cov-int.tar.xz +if [ "$UPDATE_ONLY" = yes ] && [ "$DOCKER" = yes ]; then + echo "Combining --docker and --update-only is not supported" + exit 1 +fi if [ "$UPDATE_ONLY" = yes ]; then # Just do the tools update; we don't need to check whether @@ -221,8 +242,17 @@ if [ "$UPDATE_ONLY" = yes ]; then exit 0 fi +if [ ! -e "$SRCDIR" ]; then + mkdir "$SRCDIR" +fi + cd "$SRCDIR" +if [ ! -z "$SRCTARBALL" ]; then + echo "Untarring source tarball into $SRCDIR..." + tar xvf "$SRCTARBALL" +fi + echo "Checking this is a QEMU source tree..." if ! [ -e "$SRCDIR/VERSION" ]; then echo "Not in a QEMU source tree?" @@ -242,6 +272,66 @@ if [ -z "$COVERITY_EMAIL" ]; then COVERITY_EMAIL="$(git config user.email)" fi +# Run ourselves inside docker if that's what the user wants +if [ "$DOCKER" = yes ]; then + # build docker container including the coverity-scan tools + # Put the Coverity token into a temporary file that only + # we have read access to, and then pass it to docker build + # using --secret. This requires at least Docker 18.09. + # Mostly what we are trying to do here is ensure we don't leak + # the token into the Docker image. + umask 077 + SECRETDIR=$(mktemp -d) + if [ -z "$SECRETDIR" ]; then + echo "Failed to create temporary directory" + exit 1 + fi + trap 'rm -rf "$SECRETDIR"' INT TERM EXIT + echo "Created temporary directory $SECRETDIR" + SECRET="$SECRETDIR/token" + echo "$COVERITY_TOKEN" > "$SECRET" + echo "Building docker container..." + # TODO: This re-downloads the tools every time, rather than + # caching and reusing the image produced with the downloaded tools. + # Not sure why. + # TODO: how do you get 'docker build' to print the output of the + # commands it is running to its stdout? This would be useful for debug. + DOCKER_BUILDKIT=1 docker build -t coverity-scanner \ + --secret id=coverity.token,src="$SECRET" \ + -f scripts/coverity-scan/coverity-scan.docker \ + scripts/coverity-scan + echo "Archiving sources to be analyzed..." + ./scripts/archive-source.sh "$SECRETDIR/qemu-sources.tgz" + if [ "$DRYRUN" = yes ]; then + DRYRUNARG=--dry-run + fi + echo "Running scanner..." + # If we need to capture the output tarball, get the inner run to + # save it to the secrets directory so we can copy it out before the + # directory is cleaned up. + if [ ! -z "$RESULTSTARBALL" ]; then + RTARGS="--results-tarball /work/cov-int.tar.xz" + else + RTARGS="" + fi + # Arrange for this docker run to get access to the sources with -v. + # We pass through all the configuration from the outer script to the inner. + export COVERITY_EMAIL COVERITY_BUILD_CMD + docker run -it --env COVERITY_EMAIL --env COVERITY_BUILD_CMD \ + -v "$SECRETDIR:/work" coverity-scanner \ + ./run-coverity-scan --version "$VERSION" \ + --description "$DESCRIPTION" $DRYRUNARG --tokenfile /work/token \ + --srcdir /qemu --src-tarball /work/qemu-sources.tgz $RTARGS + if [ ! -z "$RESULTSTARBALL" ]; then + echo "Copying results tarball to $RESULTSTARBALL..." + cp "$SECRETDIR/cov-int.tar.xz" "$RESULTSTARBALL" + fi + echo "Docker work complete." + exit 0 +fi + +# Otherwise, continue with the full build and upload process. + check_upload_permissions update_coverity_tools