From patchwork Wed Jun 23 12:14:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1496082 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=TWcYdjOm; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4G92K23fdWz9sVp for ; Wed, 23 Jun 2021 22:15:18 +1000 (AEST) Received: from localhost ([::1]:51628 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lw1mm-0003xD-7t for incoming@patchwork.ozlabs.org; Wed, 23 Jun 2021 08:15:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46624) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lw1m4-0003rc-7x for qemu-devel@nongnu.org; Wed, 23 Jun 2021 08:14:32 -0400 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]:42513) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lw1m1-0001yB-DP for qemu-devel@nongnu.org; Wed, 23 Jun 2021 08:14:31 -0400 Received: by mail-ed1-x530.google.com with SMTP id m14so3134980edp.9 for ; Wed, 23 Jun 2021 05:14:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nv0ACy0+Eum8qUTT1PI/Lvp1yQqi/xZRGLjc430QOSY=; b=TWcYdjOmunWyTSXp9lwr+6OcwegzBLpkA6NZZTUzelIEzyx1Y2jf9GXQY7jupM2ChK QMB3ne3kEWF0FSifxJ48YcqSOAKgOE4BjCv8KH/WaFkYwblpJ9FEFaKJnm46XxEWNWRc q0lb98oEG/AhYASykomXym/ULMC6UfDXwxXMZ+EuFN4nL1xD3ypoWftUdlAohfkyOdJS OlrwHqn+Q65k93VbKSWRGgxRwMulxFDlj3F4y4CSLBGC7Q79KBTJYdNRiMOSCA+dbx/V ArMD1QQTjLk7sI+Tei23pvQP2QXEz1+NxxSQ7X/QFO4WV2TdVo16FlZl547aAZxGs+as AGmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=nv0ACy0+Eum8qUTT1PI/Lvp1yQqi/xZRGLjc430QOSY=; b=nQ+mf467bNu6rnLD5wnkNXkw+xoCoB4ZqL8bnhNUWj0fNR/R1b0iyzBimrNFp41ro1 IRUhPfMAI/qcdcbdaapm/6Sq0XVQ1MX9brh6M6jh9Ac509IdfN5hLNviPV1Zk/r+2dV/ leMS5nVuQqtomh+jy+LnK3hLT96lF7xdldgyDnQ+c0g4iWDnVBgQyq6iD4L9SwalxFzO gmORxArIaJJn2SboI0Yv+IaCBj1BIWLhfpijME/XbILofN8FcNft7VXsPGb498h/xtlX EB6SJoHRmdOGULmQr2G+tvCUOn7NAGYsEjWNt4GZdlBV/jJ9u8szAq4ijWv0WCq2p/YG 48dw== X-Gm-Message-State: AOAM5322Iohd9ZJSu5JtJejhMRC4zQmyCaCuUu77QFPEMDiKDCUvEIGB rnJIEyLkJtXMM1phhuBS5UCe8Konwxw= X-Google-Smtp-Source: ABdhPJwl9B4e5gEsHbh6329ZMCORatsP3HrA00ExUKHKQMITKeNP9XpKQ7whBHN6ZWDnGd9fXDTfoQ== X-Received: by 2002:aa7:db03:: with SMTP id t3mr11866991eds.153.1624450466357; Wed, 23 Jun 2021 05:14:26 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id o5sm1680778edt.44.2021.06.23.05.14.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 05:14:26 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 01/12] target/i386: kvm: add support for TSC scaling Date: Wed, 23 Jun 2021 14:14:13 +0200 Message-Id: <20210623121424.1259496-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210623121424.1259496-1-pbonzini@redhat.com> References: <20210623121424.1259496-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=paolo.bonzini@gmail.com; helo=mail-ed1-x530.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Linux 5.14 will add support for nested TSC scaling. Add the corresponding feature in QEMU; to keep support for existing kernels, do not add it to any processor yet. The handling of the VMCS enumeration MSR is ugly; once we have more than one case, we may want to add a table to check VMX features against. Signed-off-by: Paolo Bonzini --- target/i386/cpu.c | 2 +- target/i386/cpu.h | 1 + target/i386/kvm/kvm.c | 12 ++++++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index a9fe1662d3..d8f3ab3192 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1031,7 +1031,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = { "vmx-invpcid-exit", "vmx-vmfunc", "vmx-shadow-vmcs", "vmx-encls-exit", "vmx-rdseed-exit", "vmx-pml", NULL, NULL, "vmx-xsaves", NULL, NULL, NULL, - NULL, NULL, NULL, NULL, + NULL, "vmx-tsc-scaling", NULL, NULL, NULL, NULL, NULL, NULL, }, .msr = { diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 1e11071d81..f7fa5870b1 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -972,6 +972,7 @@ typedef uint64_t FeatureWordArray[FEATURE_WORDS]; #define VMX_SECONDARY_EXEC_RDSEED_EXITING 0x00010000 #define VMX_SECONDARY_EXEC_ENABLE_PML 0x00020000 #define VMX_SECONDARY_EXEC_XSAVES 0x00100000 +#define VMX_SECONDARY_EXEC_TSC_SCALING 0x02000000 #define VMX_PIN_BASED_EXT_INTR_MASK 0x00000001 #define VMX_PIN_BASED_NMI_EXITING 0x00000008 diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index ad950c3c27..04e4ec063f 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -2700,8 +2700,6 @@ static uint64_t make_vmx_msr_value(uint32_t index, uint32_t features) return must_be_one | (((uint64_t)can_be_one) << 32); } -#define VMCS12_MAX_FIELD_INDEX (0x17) - static void kvm_msr_entry_add_vmx(X86CPU *cpu, FeatureWordArray f) { uint64_t kvm_vmx_basic = @@ -2791,8 +2789,14 @@ static void kvm_msr_entry_add_vmx(X86CPU *cpu, FeatureWordArray f) CR0_PE_MASK | CR0_PG_MASK | CR0_NE_MASK); kvm_msr_entry_add(cpu, MSR_IA32_VMX_CR4_FIXED0, CR4_VMXE_MASK); - kvm_msr_entry_add(cpu, MSR_IA32_VMX_VMCS_ENUM, - VMCS12_MAX_FIELD_INDEX << 1); + + if (f[FEAT_VMX_SECONDARY_CTLS] & VMX_SECONDARY_EXEC_TSC_SCALING) { + /* TSC multiplier (0x2032). */ + kvm_msr_entry_add(cpu, MSR_IA32_VMX_VMCS_ENUM, 0x32); + } else { + /* Preemption timer (0x482E). */ + kvm_msr_entry_add(cpu, MSR_IA32_VMX_VMCS_ENUM, 0x2E); + } } static void kvm_msr_entry_add_perf(X86CPU *cpu, FeatureWordArray f) From patchwork Wed Jun 23 12:14:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1496087 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=Gvb3XDcb; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4G92QX1QZwz9sVp for ; Wed, 23 Jun 2021 22:20:04 +1000 (AEST) Received: from localhost ([::1]:37728 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lw1rN-0005lP-U8 for incoming@patchwork.ozlabs.org; Wed, 23 Jun 2021 08:20:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lw1m3-0003rR-UR for qemu-devel@nongnu.org; Wed, 23 Jun 2021 08:14:31 -0400 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]:42586) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lw1m1-0001yx-7c for qemu-devel@nongnu.org; Wed, 23 Jun 2021 08:14:31 -0400 Received: by mail-ej1-x62f.google.com with SMTP id bg14so3647588ejb.9 for ; Wed, 23 Jun 2021 05:14:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NaoA/Gz5B3VaHjNe4o2mJuay6G0a5kmwmmXcYmBXU30=; b=Gvb3XDcbe0hiI8n5pi01XgqBTRl+rA8ANzggSIyvpVTzFPep/ZfTE3xFqszlcEpIMR 6Q1c6Us51Nq8zF4+6b2527ad9hU/dJG6VXOLdleLl3VZuTBGbJXo/NxFaQ6+KeC+8UQ/ IdCjp4MowyZcT/W3IqJ4RqnioS9vogFOKlq8/5vREIGgwwrrLbfA5fYBh/8vBOowUeYq PDbaOyXvjrj7hMagqxUnOQewV7mSKMd6YgHrJFw2nXfu418fphbq9oW7pz44kM1iO27m reuweGvjXQl3Jc05cSymvK0BZB1aIx2ejUY3T/75//kQxis5jEAtGjL98zESjGiOX98I fqnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=NaoA/Gz5B3VaHjNe4o2mJuay6G0a5kmwmmXcYmBXU30=; b=rFSr8DWMK6Y2V7Kq911Q/v8FAY5t8t2hQQZQXV8a7pvruZWmP9qIUomLFWc0+UgTaT 4CeuoFIyM1LRDAijsBHiNkE6XZhEK0B/IUbSeOgbGj1k3Mhe999MA+xsIi/IuVf/px2T Ev7XxdHUtlNyDBfQo4Hy3/Bj/4QBAdkTnIiJ0ynclPIkFePKJkw/clfNMzzYgle82My3 PWr53bAZkdyu5QXkNPVI6XTmi0MV+2yyhaB93yNK+AjHppNpiDg6wBy4b4X6BnAJIGbZ lbFYZyjwL6cAZVrSOD4uT2i1Jq/CGXRdS9XJMDfuGKqyZby0JV9UwWRvwdsq4OIOWE6s 4Pcg== X-Gm-Message-State: AOAM531prDZAAsaZX+A3E2YZMPmeEfeeOcyEpIzDlSdT/2aoU2z8ErCK ANEXfdvoIP07cazfnh3ZoMVU98lfAH8= X-Google-Smtp-Source: ABdhPJwuQCnRx1fgGlbEvvX7941gm9xeddO7Ilq2jCe/iPs41FyQ1I/KO58gs3wwM5zdjFzGXLSkxw== X-Received: by 2002:a17:906:2b85:: with SMTP id m5mr9856466ejg.141.1624450467053; Wed, 23 Jun 2021 05:14:27 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id o5sm1680778edt.44.2021.06.23.05.14.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 05:14:26 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 02/12] meson: drop unused CONFIG_GCRYPT_HMAC Date: Wed, 23 Jun 2021 14:14:14 +0200 Message-Id: <20210623121424.1259496-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210623121424.1259496-1-pbonzini@redhat.com> References: <20210623121424.1259496-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62f; envelope-from=paolo.bonzini@gmail.com; helo=mail-ej1-x62f.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" CONFIG_GCRYPT_HMAC has been removed now that all supported distros have it. Reviewed-by: Richard Henderson Reviewed-by: Daniel P. Berrangé Signed-off-by: Paolo Bonzini --- meson.build | 1 - 1 file changed, 1 deletion(-) diff --git a/meson.build b/meson.build index d8a92666fb..87147a5f3f 100644 --- a/meson.build +++ b/meson.build @@ -2664,7 +2664,6 @@ summary_info += {'GNUTLS support': config_host.has_key('CONFIG_GNUTLS')} # TODO: add back version summary_info += {'libgcrypt': config_host.has_key('CONFIG_GCRYPT')} if config_host.has_key('CONFIG_GCRYPT') - summary_info += {' hmac': config_host.has_key('CONFIG_GCRYPT_HMAC')} summary_info += {' XTS': not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')} endif # TODO: add back version From patchwork Wed Jun 23 12:14:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1496084 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=QN+7lVSa; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4G92Mr5Fmfz9sVp for ; Wed, 23 Jun 2021 22:17:44 +1000 (AEST) Received: from localhost ([::1]:57636 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lw1p7-0000Bs-Cb for incoming@patchwork.ozlabs.org; Wed, 23 Jun 2021 08:17:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46570) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lw1m2-0003rC-NF for qemu-devel@nongnu.org; Wed, 23 Jun 2021 08:14:30 -0400 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]:43593) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lw1m0-0001zU-Ul for qemu-devel@nongnu.org; Wed, 23 Jun 2021 08:14:30 -0400 Received: by mail-ej1-x62c.google.com with SMTP id nb6so3656369ejc.10 for ; Wed, 23 Jun 2021 05:14:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VP9s5JyOxdlmVpItLUdNGhW5j1cHS9B8ambxVV+LEbo=; b=QN+7lVSaXDYlyuHIYEFz38wryx2Goi/L+OhqI0p1d4tv24ZSmj8dyxUBgIhXGolswO aRhIvEYJJf4/I8fF4XcgxuCz+58J/ammr2hXIs6RtYxiA7PTYMdd9JYIy6UTSonaue/b pbVl0PgG5JkP+4A83Y5GBlgR4kOcJdwSSvseY8PmD95i4Ov/KM7W/HJuMgD/9lZbojJA JKWvRpuKtNNdr38Fsmv4yiF7RXJUzUGg8bXnjjqQOFSP0b0YAYqLyrGfSdnaxk1nxohX j3dLA6jNURfRVC2ySaQnqh3GGwOJgONeJPX3/0MavFj52LCZ0NFZm2teLzATgs/pQsk7 5oJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=VP9s5JyOxdlmVpItLUdNGhW5j1cHS9B8ambxVV+LEbo=; b=as1T95eu+GZQRCAdtQyafcsQixLQ42NgSMGawQkU2kqeI2B4gZm4Ky7LGdQDdyCXGH 36mRq8CnEwmjP4Q7xz4q17ngcrI9tmKzZnvlaPcX6Tu2zqRkZN0VjEerQl1P0XtDPpbl /39YitMtijhPvSLpT/SSuNuo81MvZ0UkdIk19U16kafV23+2WRkkq1Xfp+8d6kLooGN8 KrZQp82agAfKOX7xrSGenxFki0qn5h/bp/8tR3lF5S0eayC77nYfXqzCo3osYCW17dX4 ycKeHSXTCjnf4G6PaDWlAfZ2EeTPHfDg5NPP1tkPkyQT7a/czIDQ0hB+7CxTZ+ZBDdk1 Ab9A== X-Gm-Message-State: AOAM5330i+HWR2S/Qfq8krET4k+Bb4XPhWzfWQF6nPrexrSwHP1JD47y p4/UtJEPaRCg7X9gPwOogoLiaOWOSl0= X-Google-Smtp-Source: ABdhPJzLokrNpVGMZ5zQapMe5Sn0K9Kyd4RrmaFWM/pprsehLU2MVIxLSn0TRUhyrFolKvMZFLfgUg== X-Received: by 2002:a17:906:1681:: with SMTP id s1mr9631162ejd.321.1624450467715; Wed, 23 Jun 2021 05:14:27 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id o5sm1680778edt.44.2021.06.23.05.14.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 05:14:27 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 03/12] configure: drop unused variables for xts Date: Wed, 23 Jun 2021 14:14:15 +0200 Message-Id: <20210623121424.1259496-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210623121424.1259496-1-pbonzini@redhat.com> References: <20210623121424.1259496-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62c; envelope-from=paolo.bonzini@gmail.com; helo=mail-ej1-x62c.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" All XTS configuration uses qemu_private_xts. Drop other variables as they have only ever been used to generate the summary (which has since been moved to meson.build). Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Daniel P. Berrangé Signed-off-by: Paolo Bonzini --- configure | 4 ---- 1 file changed, 4 deletions(-) diff --git a/configure b/configure index 38704b4e11..00e7dd749a 100755 --- a/configure +++ b/configure @@ -406,9 +406,7 @@ gtk="auto" tls_priority="NORMAL" gnutls="$default_feature" nettle="$default_feature" -nettle_xts="no" gcrypt="$default_feature" -gcrypt_xts="no" qemu_private_xts="yes" auth_pam="$default_feature" vte="$default_feature" @@ -2897,7 +2895,6 @@ int main(void) { } EOF if compile_prog "$nettle_cflags" "$nettle_libs" ; then - nettle_xts=yes qemu_private_xts=no fi fi @@ -2938,7 +2935,6 @@ int main(void) { } EOF if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then - gcrypt_xts=yes qemu_private_xts=no fi elif test "$gcrypt" = "yes"; then From patchwork Wed Jun 23 12:14:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1496089 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=lwA0Acxk; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4G92Tk3Pstz9sVp for ; Wed, 23 Jun 2021 22:22:49 +1000 (AEST) Received: from localhost ([::1]:43138 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lw1u3-00016g-0N for incoming@patchwork.ozlabs.org; Wed, 23 Jun 2021 08:22:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lw1m4-0003rS-0m for qemu-devel@nongnu.org; Wed, 23 Jun 2021 08:14:32 -0400 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]:42507) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lw1m1-0001zb-IX for qemu-devel@nongnu.org; Wed, 23 Jun 2021 08:14:31 -0400 Received: by mail-ed1-x529.google.com with SMTP id m14so3135116edp.9 for ; Wed, 23 Jun 2021 05:14:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=89nOTmh6DcrB7ef5TmzMI2kJ0TGNno4c7shX8+Dmj50=; b=lwA0Acxk7ggmkeLQmoQse+LYN9xsPIU99SPL1px7DJbpH+Me+ein9PHSrhUBZnEppr EsQpM8gzADa47DICVYXK+im16Hr5HlBiaUMTV2DrqHQ7JMxbXLPStp427Q9DxbfQVtay RIMnNQNh4H4qAnIoSnCvijnJnANtOGk3ixKmtRW38ucbfn+cVuaoKYy5nKj/t954h5iY RZnvtAx0lO0DLFLiBjHrrxB0eeA/XE2582eSMnfgIGvX9e6UWW7WBhKI4nDlwZPvqnSm pkboP4oPl1byZ3HOfmoI1o61g7eWX1qG9xfA1vKGEktQSunOmqVgKpmNgTaxRDLmxtWX S6cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=89nOTmh6DcrB7ef5TmzMI2kJ0TGNno4c7shX8+Dmj50=; b=X3IC5qsjHg9mNu/6gOp7nNMEnVWlEgXez6rCKwymVZpP2lHZHIBHt7DcIorkigOvq9 KwbFM3Z6VkONMe2sWlIrFrxjduaGRyZwOd1LWjsWfuyrj8N04UQDM8EtLPbJYlbRp0AG OYskiDGLiXTEbyMxqlZ0SkmImnUUttA2bLRst12uLJ7fORtZmFz0Sh5GsZzZjvtrPeKW dMKGUud4boRaJrtZEbgnoSwsDEgtd5bBXmhsL9DooQBk5Gy+FLCLY9Cy8IzowcfmxuuL OWjc1wgWAdCQwUnMlObQR6oGiXDAuh2xRR04at8mFOZkBXGyTNQ0JbgtdWvnYKn/eGli AqGA== X-Gm-Message-State: AOAM533EZFzOTrZ7IDj0Krxvue5NBVxXzSBpGlJyy7i5LAI/Xp3Bzozc sVZeEBkU0V3PJdsYu45A6LmDR3wX3Pw= X-Google-Smtp-Source: ABdhPJy1O0pOXYALArKAKrAV8OCtHKwufuWVT9xoV1Z2Lg7hHZ7ZqfV8SS/TgxxBK7RKICEMHIGm3Q== X-Received: by 2002:a05:6402:290b:: with SMTP id ee11mr11714444edb.325.1624450468331; Wed, 23 Jun 2021 05:14:28 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id o5sm1680778edt.44.2021.06.23.05.14.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 05:14:28 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 04/12] meson: remove preadv from summary Date: Wed, 23 Jun 2021 14:14:16 +0200 Message-Id: <20210623121424.1259496-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210623121424.1259496-1-pbonzini@redhat.com> References: <20210623121424.1259496-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::529; envelope-from=paolo.bonzini@gmail.com; helo=mail-ed1-x529.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Meson is more verbose than the configure script; the outcome of the preadv test can be found in its output and it is not worth including it again in the summary. Reviewed-by: Daniel P. Berrangé Signed-off-by: Paolo Bonzini --- meson.build | 1 - 1 file changed, 1 deletion(-) diff --git a/meson.build b/meson.build index 87147a5f3f..3809f51f7f 100644 --- a/meson.build +++ b/meson.build @@ -2565,7 +2565,6 @@ summary_info += {'PIE': get_option('b_pie')} summary_info += {'static build': config_host.has_key('CONFIG_STATIC')} summary_info += {'malloc trim support': has_malloc_trim} summary_info += {'membarrier': config_host.has_key('CONFIG_MEMBARRIER')} -summary_info += {'preadv support': config_host_data.get('CONFIG_PREADV')} summary_info += {'fdatasync': config_host.has_key('CONFIG_FDATASYNC')} summary_info += {'madvise': config_host.has_key('CONFIG_MADVISE')} summary_info += {'posix_madvise': config_host.has_key('CONFIG_POSIX_MADVISE')} From patchwork Wed Jun 23 12:14:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1496090 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=nK1mXZ+l; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4G92XV6rR6z9tB1 for ; Wed, 23 Jun 2021 22:25:14 +1000 (AEST) Received: from localhost ([::1]:47378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lw1wO-0003z2-MP for incoming@patchwork.ozlabs.org; Wed, 23 Jun 2021 08:25:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46626) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lw1m4-0003re-97 for qemu-devel@nongnu.org; Wed, 23 Jun 2021 08:14:32 -0400 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]:46937) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lw1m2-0001zq-8q for qemu-devel@nongnu.org; Wed, 23 Jun 2021 08:14:32 -0400 Received: by mail-ej1-x62c.google.com with SMTP id he7so3623094ejc.13 for ; Wed, 23 Jun 2021 05:14:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VArWV/JYlPRB+ITaKgwursWuWO5skwybUaAhhu6OsTQ=; b=nK1mXZ+lIhmC4ergM+GsER2cXZJgJxYTH99CgldX/Nfv7ZzZZ+Ovqu3Ss74i0X7tqF Nh0V3pkoCr9kMjOFZT2KHMZEIBmqqcYq1pppYKMWxfE/+XswF6OO6Cp54OlaiaQyF2Gs Ho8OTDpk+d08OSIzb1zlJWEiKipD7gHGJvcJboKl5/qQfbma3H11T69LHvDD3WigJCPK N5buwBXYNe3oS29hQ6UmzHTeQEtwh8wTR7iucr6t96sEuJEuXg3C47P7GPi7JnLA1oju Os1lGykQzc2cCXAPP0O9T0h/W8i+4qMwDTImIcYR36Ze4fKywAuadr1aDsDXDMfVbBjV mwCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=VArWV/JYlPRB+ITaKgwursWuWO5skwybUaAhhu6OsTQ=; b=JCLtGSUXst9l/DQfxvuAaXNCkIZMhkg+fjUKzh92jp2YlMp9D2ZYjB2p1Z5ViW4a29 gblWqi6+vjgb6N9NJ/qv+B2q0lq+JnybwDVXo3DNmhBGniZaYmNZser2NpihFiCMXQVm FNel6Cdq8ACJRACAeMJvrVg8wZ8FjTcXRfNCXUIdog7vrpEG4aYQ86DkvlHXyytp00Pd T2COyqPFB3XyD/CvYzLtxjFJHjtqBexPZAWG0vlJgrbdLR4B+4DqaRPSnmYzQ3X8LDYh OhoYusAZF8ODipq/xG1a3iP5TPYroACL8TjZqSTVrPxtRm59bZ8i+FStK9v8G2WNX0Hy Po5A== X-Gm-Message-State: AOAM532YZQm7dSRwNznNg2N1b2BouLhEgR5O+2HF6ScTIArGNf4pQi5P HdJ+pvMcFh1d8w++m0UJ4fsJ7wOBjno= X-Google-Smtp-Source: ABdhPJy47auNVr3d/9DVkaImCMhTQaz04R3VKyPu7Bq2bqR3sqSM8LqjEXvOOIuGCUrY1hrNoK0CqA== X-Received: by 2002:a17:907:1dd9:: with SMTP id og25mr9540782ejc.108.1624450469027; Wed, 23 Jun 2021 05:14:29 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id o5sm1680778edt.44.2021.06.23.05.14.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 05:14:28 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 05/12] tests: remove QCRYPTO_HAVE_TLS_TEST_SUPPORT Date: Wed, 23 Jun 2021 14:14:17 +0200 Message-Id: <20210623121424.1259496-6-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210623121424.1259496-1-pbonzini@redhat.com> References: <20210623121424.1259496-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62c; envelope-from=paolo.bonzini@gmail.com; helo=mail-ej1-x62c.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" meson.build already decides whether it is possible to build the TLS test suite. There is no need to include that in the source as well. The dummy tests in fact are broken because they do not produce valid TAP output (empty output is rejected by scripts/tap-driver.pl). Cc: Daniel P. Berrangé Signed-off-by: Paolo Bonzini --- tests/unit/crypto-tls-psk-helpers.c | 6 ------ tests/unit/crypto-tls-psk-helpers.h | 4 ---- tests/unit/crypto-tls-x509-helpers.c | 4 ---- tests/unit/crypto-tls-x509-helpers.h | 11 +---------- tests/unit/pkix_asn1_tab.c | 3 --- tests/unit/test-crypto-tlscredsx509.c | 12 ------------ tests/unit/test-crypto-tlssession.c | 12 ------------ tests/unit/test-io-channel-tls.c | 12 ------------ 8 files changed, 1 insertion(+), 63 deletions(-) diff --git a/tests/unit/crypto-tls-psk-helpers.c b/tests/unit/crypto-tls-psk-helpers.c index a8395477c3..7f8a488961 100644 --- a/tests/unit/crypto-tls-psk-helpers.c +++ b/tests/unit/crypto-tls-psk-helpers.c @@ -20,14 +20,10 @@ #include "qemu/osdep.h" -/* Include this first because it defines QCRYPTO_HAVE_TLS_TEST_SUPPORT */ #include "crypto-tls-x509-helpers.h" - #include "crypto-tls-psk-helpers.h" #include "qemu/sockets.h" -#ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT - void test_tls_psk_init(const char *pskfile) { FILE *fp; @@ -46,5 +42,3 @@ void test_tls_psk_cleanup(const char *pskfile) { unlink(pskfile); } - -#endif /* QCRYPTO_HAVE_TLS_TEST_SUPPORT */ diff --git a/tests/unit/crypto-tls-psk-helpers.h b/tests/unit/crypto-tls-psk-helpers.h index 5aa9951cb6..faa645c629 100644 --- a/tests/unit/crypto-tls-psk-helpers.h +++ b/tests/unit/crypto-tls-psk-helpers.h @@ -23,11 +23,7 @@ #include -#ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT - void test_tls_psk_init(const char *keyfile); void test_tls_psk_cleanup(const char *keyfile); -#endif /* QCRYPTO_HAVE_TLS_TEST_SUPPORT */ - #endif diff --git a/tests/unit/crypto-tls-x509-helpers.c b/tests/unit/crypto-tls-x509-helpers.c index 97658592a2..fc609b3fd4 100644 --- a/tests/unit/crypto-tls-x509-helpers.c +++ b/tests/unit/crypto-tls-x509-helpers.c @@ -24,8 +24,6 @@ #include "crypto/init.h" #include "qemu/sockets.h" -#ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT - /* * This stores some static data that is needed when * encoding extensions in the x509 certs @@ -504,5 +502,3 @@ void test_tls_discard_cert(QCryptoTLSTestCertReq *req) unlink(req->filename); } } - -#endif /* QCRYPTO_HAVE_TLS_TEST_SUPPORT */ diff --git a/tests/unit/crypto-tls-x509-helpers.h b/tests/unit/crypto-tls-x509-helpers.h index 8fcd7785ab..cf6329e653 100644 --- a/tests/unit/crypto-tls-x509-helpers.h +++ b/tests/unit/crypto-tls-x509-helpers.h @@ -23,14 +23,7 @@ #include #include - -#if !(defined WIN32) && \ - defined(CONFIG_TASN1) -# define QCRYPTO_HAVE_TLS_TEST_SUPPORT -#endif - -#ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT -# include +#include /* @@ -127,6 +120,4 @@ void test_tls_cleanup(const char *keyfile); extern const asn1_static_node pkix_asn1_tab[]; -#endif /* QCRYPTO_HAVE_TLS_TEST_SUPPORT */ - #endif diff --git a/tests/unit/pkix_asn1_tab.c b/tests/unit/pkix_asn1_tab.c index 15397cf77a..89521408a1 100644 --- a/tests/unit/pkix_asn1_tab.c +++ b/tests/unit/pkix_asn1_tab.c @@ -6,8 +6,6 @@ #include "qemu/osdep.h" #include "crypto-tls-x509-helpers.h" -#ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT - const asn1_static_node pkix_asn1_tab[] = { {"PKIX1", 536875024, 0}, {0, 1073741836, 0}, @@ -1105,4 +1103,3 @@ const asn1_static_node pkix_asn1_tab[] = { {0, 1048586, "2"}, {0, 0, 0} }; -#endif /* QCRYPTO_HAVE_TLS_TEST_SUPPORT */ diff --git a/tests/unit/test-crypto-tlscredsx509.c b/tests/unit/test-crypto-tlscredsx509.c index f487349c32..aab4149b56 100644 --- a/tests/unit/test-crypto-tlscredsx509.c +++ b/tests/unit/test-crypto-tlscredsx509.c @@ -25,8 +25,6 @@ #include "qapi/error.h" #include "qemu/module.h" -#ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT - #define WORKDIR "tests/test-crypto-tlscredsx509-work/" #define KEYFILE WORKDIR "key-ctx.pem" @@ -706,13 +704,3 @@ int main(int argc, char **argv) return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE; } - -#else /* ! QCRYPTO_HAVE_TLS_TEST_SUPPORT */ - -int -main(void) -{ - return EXIT_SUCCESS; -} - -#endif /* ! QCRYPTO_HAVE_TLS_TEST_SUPPORT */ diff --git a/tests/unit/test-crypto-tlssession.c b/tests/unit/test-crypto-tlssession.c index 8b2453fa79..5f0da9192c 100644 --- a/tests/unit/test-crypto-tlssession.c +++ b/tests/unit/test-crypto-tlssession.c @@ -31,8 +31,6 @@ #include "qemu/sockets.h" #include "authz/list.h" -#ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT - #define WORKDIR "tests/test-crypto-tlssession-work/" #define PSKFILE WORKDIR "keys.psk" #define KEYFILE WORKDIR "key-ctx.pem" @@ -648,13 +646,3 @@ int main(int argc, char **argv) return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE; } - -#else /* ! QCRYPTO_HAVE_TLS_TEST_SUPPORT */ - -int -main(void) -{ - return EXIT_SUCCESS; -} - -#endif /* ! QCRYPTO_HAVE_TLS_TEST_SUPPORT */ diff --git a/tests/unit/test-io-channel-tls.c b/tests/unit/test-io-channel-tls.c index ad7554c534..f6fb988c01 100644 --- a/tests/unit/test-io-channel-tls.c +++ b/tests/unit/test-io-channel-tls.c @@ -34,8 +34,6 @@ #include "authz/list.h" #include "qom/object_interfaces.h" -#ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT - #define WORKDIR "tests/test-io-channel-tls-work/" #define KEYFILE WORKDIR "key-ctx.pem" @@ -334,13 +332,3 @@ int main(int argc, char **argv) return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE; } - -#else /* ! QCRYPTO_HAVE_TLS_TEST_SUPPORT */ - -int -main(void) -{ - return EXIT_SUCCESS; -} - -#endif /* ! QCRYPTO_HAVE_TLS_TEST_SUPPORT */ From patchwork Wed Jun 23 12:14:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1496088 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=o6It/hu7; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4G92Qt427Wz9sWl for ; Wed, 23 Jun 2021 22:20:22 +1000 (AEST) Received: from localhost ([::1]:38418 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lw1rg-0006Ft-53 for incoming@patchwork.ozlabs.org; Wed, 23 Jun 2021 08:20:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46670) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lw1m6-0003vD-85 for qemu-devel@nongnu.org; Wed, 23 Jun 2021 08:14:34 -0400 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]:38771) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lw1m3-00020C-5X for qemu-devel@nongnu.org; Wed, 23 Jun 2021 08:14:33 -0400 Received: by mail-ej1-x62f.google.com with SMTP id hq39so3679778ejc.5 for ; Wed, 23 Jun 2021 05:14:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GLj4HwwMombY8CaOsQjh5wwXRLnVD6SOn+E3r9+SCmQ=; b=o6It/hu7gTbQpBF6FQPcRg2iV/gopfAIkBu2M6MBTKGXLjypdDiL4P9cf/CcOAX1/p yhpgq4XTQ+Dy6mOAntEacf/oaUlZ7DYYdUZKZy+SumyPi92KG9umAN9CT9xaOAUd4pCZ CuPiAMJXV0VTPepA+IdEuJBGTAeH2uuIg92hQic0ECXHJKMdchgEuTSVBQyVeeCiF/sj L0EoPpVp0PbwjmbQDfwbHh6roXIY4eGQu987c84nVbjH3p/hzt4zay1eyytChqAiekW3 hRI9WvcFj2iGvUmNQjqKzXNlaEWz5GQj0wKl/dVafI93Mf+i/zjFURhMr4bSxFUbicgN IWIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=GLj4HwwMombY8CaOsQjh5wwXRLnVD6SOn+E3r9+SCmQ=; b=M9gJeUYQM3ZLsWjg94YfgVM2BosxEIGnBFCVXFuCZ19fOUIi6rdaUze2oO0iunjjG8 hFbjlguoVG0/qYa0nLCv5s3Xa/mbhPGzGMRwkAA6TAEkH5Uh1iDE/hbRV1Lms7kYtfd7 rtKEpqQlx2Tg/lvCZGS9Mmi90s8DCpCIr373vPxwq2IL/M57eS/RNrJk8Z/8o4dhKlDS KZR2ItK7ge3AaZMrw77vFnZqP4svV+AF+5R+VUFuqCIuDECQDlEqCZeMJImi8b0Zv8xX dFDzd8Eq1o6r0giqiZNNAYJXqdQEc7RXnr+A0v/44OqbuL0yVvsXc+OxtdLFxczE8vVc 4heQ== X-Gm-Message-State: AOAM533hsvcAW99fvktCmjjSfjY6XwqVtdKNknZR0m3MaBJZkavXAdSH AvWmfK5iEKxbRQ18NcTkafUT4upJfoE= X-Google-Smtp-Source: ABdhPJwRyd1k9Qs7Qdy3YrgM1uOFGPUdUpFCG7WTe4KeyoJTTDsQ+86Yrz7ICVKxA0z4WQ37mCCj4g== X-Received: by 2002:a17:906:1c84:: with SMTP id g4mr9167246ejh.99.1624450469727; Wed, 23 Jun 2021 05:14:29 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id o5sm1680778edt.44.2021.06.23.05.14.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 05:14:29 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 06/12] configure, meson: convert crypto detection to meson Date: Wed, 23 Jun 2021 14:14:18 +0200 Message-Id: <20210623121424.1259496-7-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210623121424.1259496-1-pbonzini@redhat.com> References: <20210623121424.1259496-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62f; envelope-from=paolo.bonzini@gmail.com; helo=mail-ej1-x62f.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Richard Henderson Reviewed-by: Daniel P. Berrangé Signed-off-by: Paolo Bonzini --- configure | 188 +++-------------------------------------- crypto/meson.build | 41 +++------ meson.build | 81 +++++++++++++----- meson_options.txt | 6 ++ tests/unit/meson.build | 6 +- 5 files changed, 90 insertions(+), 232 deletions(-) diff --git a/configure b/configure index 00e7dd749a..897e968e02 100755 --- a/configure +++ b/configure @@ -404,10 +404,9 @@ seccomp="auto" glusterfs="auto" gtk="auto" tls_priority="NORMAL" -gnutls="$default_feature" -nettle="$default_feature" -gcrypt="$default_feature" -qemu_private_xts="yes" +gnutls="auto" +nettle="auto" +gcrypt="auto" auth_pam="$default_feature" vte="$default_feature" virglrenderer="$default_feature" @@ -1372,17 +1371,17 @@ for opt do ;; --tls-priority=*) tls_priority="$optarg" ;; - --disable-gnutls) gnutls="no" + --disable-gnutls) gnutls="disabled" ;; - --enable-gnutls) gnutls="yes" + --enable-gnutls) gnutls="enabled" ;; - --disable-nettle) nettle="no" + --disable-nettle) nettle="disabled" ;; - --enable-nettle) nettle="yes" + --enable-nettle) nettle="enabled" ;; - --disable-gcrypt) gcrypt="no" + --disable-gcrypt) gcrypt="disabled" ;; - --enable-gcrypt) gcrypt="yes" + --enable-gcrypt) gcrypt="enabled" ;; --disable-auth-pam) auth_pam="no" ;; @@ -2800,156 +2799,6 @@ EOF fi fi -########################################## -# GNUTLS probe - -if test "$gnutls" != "no"; then - pass="no" - if $pkg_config --exists "gnutls >= 3.5.18"; then - gnutls_cflags=$($pkg_config --cflags gnutls) - gnutls_libs=$($pkg_config --libs gnutls) - # Packaging for the static libraries is not always correct. - # At least ubuntu 18.04 ships only shared libraries. - write_c_skeleton - if compile_prog "" "$gnutls_libs" ; then - pass="yes" - fi - fi - if test "$pass" = "no" && test "$gnutls" = "yes"; then - feature_not_found "gnutls" "Install gnutls devel >= 3.1.18" - else - gnutls="$pass" - fi -fi - - -# If user didn't give a --disable/enable-gcrypt flag, -# then mark as disabled if user requested nettle -# explicitly -if test -z "$gcrypt" -then - if test "$nettle" = "yes" - then - gcrypt="no" - fi -fi - -# If user didn't give a --disable/enable-nettle flag, -# then mark as disabled if user requested gcrypt -# explicitly -if test -z "$nettle" -then - if test "$gcrypt" = "yes" - then - nettle="no" - fi -fi - -has_libgcrypt() { - if ! has "libgcrypt-config" - then - return 1 - fi - - if test -n "$cross_prefix" - then - host=$(libgcrypt-config --host) - if test "$host-" != $cross_prefix - then - return 1 - fi - fi - - maj=`libgcrypt-config --version | awk -F . '{print $1}'` - min=`libgcrypt-config --version | awk -F . '{print $2}'` - - if test $maj != 1 || test $min -lt 8 - then - return 1 - fi - - return 0 -} - - -if test "$nettle" != "no"; then - pass="no" - if $pkg_config --exists "nettle >= 3.4"; then - nettle_cflags=$($pkg_config --cflags nettle) - nettle_libs=$($pkg_config --libs nettle) - # Link test to make sure the given libraries work (e.g for static). - write_c_skeleton - if compile_prog "" "$nettle_libs" ; then - if test -z "$gcrypt"; then - gcrypt="no" - fi - pass="yes" - fi - fi - if test "$pass" = "yes" - then - cat > $TMPC << EOF -#include -int main(void) { - return 0; -} -EOF - if compile_prog "$nettle_cflags" "$nettle_libs" ; then - qemu_private_xts=no - fi - fi - if test "$pass" = "no" && test "$nettle" = "yes"; then - feature_not_found "nettle" "Install nettle devel >= 2.7.1" - else - nettle="$pass" - fi -fi - -if test "$gcrypt" != "no"; then - pass="no" - if has_libgcrypt; then - gcrypt_cflags=$(libgcrypt-config --cflags) - gcrypt_libs=$(libgcrypt-config --libs) - # Debian has removed -lgpg-error from libgcrypt-config - # as it "spreads unnecessary dependencies" which in - # turn breaks static builds... - if test "$static" = "yes" - then - gcrypt_libs="$gcrypt_libs -lgpg-error" - fi - - # Link test to make sure the given libraries work (e.g for static). - write_c_skeleton - if compile_prog "" "$gcrypt_libs" ; then - pass="yes" - fi - fi - if test "$pass" = "yes"; then - gcrypt="yes" - cat > $TMPC << EOF -#include -int main(void) { - gcry_cipher_hd_t handle; - gcry_cipher_open(&handle, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_XTS, 0); - return 0; -} -EOF - if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then - qemu_private_xts=no - fi - elif test "$gcrypt" = "yes"; then - feature_not_found "gcrypt" "Install gcrypt devel >= 1.5.0" - else - gcrypt="no" - fi -fi - - -if test "$gcrypt" = "yes" && test "$nettle" = "yes" -then - error_exit "Only one of gcrypt & nettle can be enabled" -fi - ########################################## # libtasn1 - only for the TLS creds/session test suite @@ -5705,24 +5554,6 @@ if test "$gdbus_codegen" != "" ; then echo "GDBUS_CODEGEN=$gdbus_codegen" >> $config_host_mak fi echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak -if test "$gnutls" = "yes" ; then - echo "CONFIG_GNUTLS=y" >> $config_host_mak - echo "GNUTLS_CFLAGS=$gnutls_cflags" >> $config_host_mak - echo "GNUTLS_LIBS=$gnutls_libs" >> $config_host_mak -fi -if test "$gcrypt" = "yes" ; then - echo "CONFIG_GCRYPT=y" >> $config_host_mak - echo "GCRYPT_CFLAGS=$gcrypt_cflags" >> $config_host_mak - echo "GCRYPT_LIBS=$gcrypt_libs" >> $config_host_mak -fi -if test "$nettle" = "yes" ; then - echo "CONFIG_NETTLE=y" >> $config_host_mak - echo "NETTLE_CFLAGS=$nettle_cflags" >> $config_host_mak - echo "NETTLE_LIBS=$nettle_libs" >> $config_host_mak -fi -if test "$qemu_private_xts" = "yes" ; then - echo "CONFIG_QEMU_PRIVATE_XTS=y" >> $config_host_mak -fi if test "$tasn1" = "yes" ; then echo "CONFIG_TASN1=y" >> $config_host_mak fi @@ -6439,6 +6270,7 @@ if test "$skip_meson" = no; then -Dcurl=$curl -Dglusterfs=$glusterfs -Dbzip2=$bzip2 -Dlibiscsi=$libiscsi \ -Dlibnfs=$libnfs -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\ -Drbd=$rbd -Dlzo=$lzo -Dsnappy=$snappy -Dlzfse=$lzfse \ + -Dgnutls=$gnutls -Dnettle=$nettle -Dgcrypt=$gcrypt \ -Dzstd=$zstd -Dseccomp=$seccomp -Dvirtfs=$virtfs -Dcap_ng=$cap_ng \ -Dattr=$attr -Ddefault_devices=$default_devices \ -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \ diff --git a/crypto/meson.build b/crypto/meson.build index af7e80c6f6..7cbf1a6ba7 100644 --- a/crypto/meson.build +++ b/crypto/meson.build @@ -22,48 +22,31 @@ crypto_ss.add(files( 'tlssession.c', )) -if 'CONFIG_NETTLE' in config_host - crypto_ss.add(files('hash-nettle.c', 'hmac-nettle.c', 'pbkdf-nettle.c')) -elif 'CONFIG_GCRYPT' in config_host - crypto_ss.add(files('hash-gcrypt.c', 'pbkdf-gcrypt.c')) - crypto_ss.add(files('hmac-gcrypt.c')) +if nettle.found() + crypto_ss.add(nettle, files('hash-nettle.c', 'hmac-nettle.c', 'pbkdf-nettle.c')) +elif gcrypt.found() + crypto_ss.add(gcrypt, files('hash-gcrypt.c', 'hmac-gcrypt.c', 'pbkdf-gcrypt.c')) else crypto_ss.add(files('hash-glib.c', 'hmac-glib.c', 'pbkdf-stub.c')) endif +if xts == 'private' + crypto_ss.add(files('xts.c')) +endif crypto_ss.add(when: 'CONFIG_SECRET_KEYRING', if_true: files('secret_keyring.c')) -crypto_ss.add(when: 'CONFIG_QEMU_PRIVATE_XTS', if_true: files('xts.c')) crypto_ss.add(when: 'CONFIG_AF_ALG', if_true: files('afalg.c', 'cipher-afalg.c', 'hash-afalg.c')) -crypto_ss.add(when: 'CONFIG_GNUTLS', if_true: files('tls-cipher-suites.c')) - -if 'CONFIG_NETTLE' in config_host - crypto_ss.add(nettle) -elif 'CONFIG_GCRYPT' in config_host - crypto_ss.add(gcrypt) -endif - -if 'CONFIG_GNUTLS' in config_host - crypto_ss.add(gnutls) -endif - +crypto_ss.add(when: gnutls, if_true: files('tls-cipher-suites.c')) util_ss.add(files('aes.c')) util_ss.add(files('init.c')) -if 'CONFIG_GCRYPT' in config_host - util_ss.add(files('random-gcrypt.c')) -elif 'CONFIG_GNUTLS' in config_host - util_ss.add(files('random-gnutls.c')) +if gcrypt.found() + util_ss.add(gcrypt, files('random-gcrypt.c')) +elif gnutls.found() + util_ss.add(gnutls, files('random-gnutls.c')) elif 'CONFIG_RNG_NONE' in config_host util_ss.add(files('random-none.c')) else util_ss.add(files('random-platform.c')) endif -if 'CONFIG_GCRYPT' in config_host - util_ss.add(gcrypt) -endif - -if 'CONFIG_GNUTLS' in config_host - util_ss.add(gnutls) -endif diff --git a/meson.build b/meson.build index 3809f51f7f..286b37aecb 100644 --- a/meson.build +++ b/meson.build @@ -320,21 +320,6 @@ urcubp = not_found if 'CONFIG_TRACE_UST' in config_host urcubp = declare_dependency(link_args: config_host['URCU_BP_LIBS'].split()) endif -gcrypt = not_found -if 'CONFIG_GCRYPT' in config_host - gcrypt = declare_dependency(compile_args: config_host['GCRYPT_CFLAGS'].split(), - link_args: config_host['GCRYPT_LIBS'].split()) -endif -nettle = not_found -if 'CONFIG_NETTLE' in config_host - nettle = declare_dependency(compile_args: config_host['NETTLE_CFLAGS'].split(), - link_args: config_host['NETTLE_LIBS'].split()) -endif -gnutls = not_found -if 'CONFIG_GNUTLS' in config_host - gnutls = declare_dependency(compile_args: config_host['GNUTLS_CFLAGS'].split(), - link_args: config_host['GNUTLS_LIBS'].split()) -endif pixman = not_found if have_system or have_tools pixman = dependency('pixman-1', required: have_system, version:'>=0.21.8', @@ -829,6 +814,54 @@ if 'CONFIG_OPENGL' in config_host link_args: config_host['OPENGL_LIBS'].split()) endif +gnutls = not_found +if not get_option('gnutls').auto() or have_system + gnutls = dependency('gnutls', version: '>=3.5.18', + method: 'pkg-config', + required: get_option('gnutls'), + kwargs: static_kwargs) +endif + +# Nettle has priority over gcrypt +gcrypt = not_found +nettle = not_found +xts = 'private' +if get_option('nettle').enabled() and get_option('gcrypt').enabled() + error('Only one of gcrypt & nettle can be enabled') +elif (not get_option('nettle').auto() or have_system) and not get_option('gcrypt').enabled() + nettle = dependency('nettle', version: '>=3.4', + method: 'pkg-config', + required: get_option('nettle'), + kwargs: static_kwargs) + if nettle.found() and cc.has_header('nettle/xts.h', dependencies: nettle) + xts = 'nettle' + endif +endif +if (not get_option('gcrypt').auto() or have_system) and not nettle.found() + gcrypt = dependency('libgcrypt', version: '>=1.5', + method: 'config-tool', + required: get_option('gcrypt'), + kwargs: static_kwargs) + if gcrypt.found() and cc.compiles(''' + #include + int main(void) { + gcry_cipher_hd_t handle; + gcry_cipher_open(&handle, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_XTS, 0); + return 0; + } + ''', dependencies: gcrypt) + xts = 'gcrypt' + endif + # Debian has removed -lgpg-error from libgcrypt-config + # as it "spreads unnecessary dependencies" which in + # turn breaks static builds... + if gcrypt.found() and enable_static + gcrypt = declare_dependency(dependencies: [ + gcrypt, + cc.find_library('gpg-error', required: true, kwargs: static_kwargs)]) + endif +endif + gtk = not_found gtkx11 = not_found if not get_option('gtk').auto() or (have_system and not cocoa.found()) @@ -1165,6 +1198,10 @@ config_host_data.set('CONFIG_VIRTFS', have_virtfs) config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.found()) config_host_data.set('CONFIG_KEYUTILS', keyutils.found()) config_host_data.set('CONFIG_GETTID', has_gettid) +config_host_data.set('CONFIG_GNUTLS', gnutls.found()) +config_host_data.set('CONFIG_GCRYPT', gcrypt.found()) +config_host_data.set('CONFIG_NETTLE', nettle.found()) +config_host_data.set('CONFIG_QEMU_PRIVATE_XTS', xts == 'private') config_host_data.set('CONFIG_MALLOC_TRIM', has_malloc_trim) config_host_data.set('CONFIG_STATX', has_statx) config_host_data.set('CONFIG_ZSTD', zstd.found()) @@ -2659,16 +2696,16 @@ summary(summary_info, bool_yn: true, section: 'Block layer support') # Crypto summary_info = {} summary_info += {'TLS priority': config_host['CONFIG_TLS_PRIORITY']} -summary_info += {'GNUTLS support': config_host.has_key('CONFIG_GNUTLS')} +summary_info += {'GNUTLS support': gnutls.found()} # TODO: add back version -summary_info += {'libgcrypt': config_host.has_key('CONFIG_GCRYPT')} -if config_host.has_key('CONFIG_GCRYPT') - summary_info += {' XTS': not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')} +summary_info += {'libgcrypt': gcrypt.found()} +if gcrypt.found() + summary_info += {' XTS': xts != 'private'} endif # TODO: add back version -summary_info += {'nettle': config_host.has_key('CONFIG_NETTLE')} -if config_host.has_key('CONFIG_NETTLE') - summary_info += {' XTS': not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')} +summary_info += {'nettle': nettle.found()} +if nettle.found() + summary_info += {' XTS': xts != 'private'} endif summary_info += {'crypto afalg': config_host.has_key('CONFIG_AF_ALG')} summary_info += {'rng-none': config_host.has_key('CONFIG_RNG_NONE')} diff --git a/meson_options.txt b/meson_options.txt index 3d304cac96..343ffffb7c 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -76,6 +76,12 @@ option('iconv', type : 'feature', value : 'auto', description: 'Font glyph conversion support') option('curses', type : 'feature', value : 'auto', description: 'curses UI') +option('gnutls', type : 'feature', value : 'auto', + description: 'GNUTLS cryptography support') +option('nettle', type : 'feature', value : 'auto', + description: 'nettle cryptography support') +option('gcrypt', type : 'feature', value : 'auto', + description: 'libgcrypt cryptography support') option('libudev', type : 'feature', value : 'auto', description: 'Use libudev to enumerate host devices') option('lzfse', type : 'feature', value : 'auto', diff --git a/tests/unit/meson.build b/tests/unit/meson.build index b3bc2109da..fcf6ed2ef5 100644 --- a/tests/unit/meson.build +++ b/tests/unit/meson.build @@ -83,7 +83,7 @@ if have_block 'test-crypto-afsplit': [io], 'test-crypto-block': [io], } - if 'CONFIG_GNUTLS' in config_host and \ + if gnutls.found() and \ 'CONFIG_TASN1' in config_host and \ 'CONFIG_POSIX' in config_host tests += { @@ -97,7 +97,7 @@ if have_block if 'CONFIG_AUTH_PAM' in config_host tests += {'test-authz-pam': [authz]} endif - if 'CONFIG_QEMU_PRIVATE_XTS' in config_host + if xts == 'private' tests += {'test-crypto-xts': [crypto, io]} endif if 'CONFIG_POSIX' in config_host @@ -106,7 +106,7 @@ if have_block if 'CONFIG_REPLICATION' in config_host tests += {'test-replication': [testblock]} endif - if 'CONFIG_NETTLE' in config_host or 'CONFIG_GCRYPT' in config_host + if nettle.found() or gcrypt.found() tests += {'test-crypto-pbkdf': [io]} endif if 'CONFIG_EPOLL_CREATE1' in config_host From patchwork Wed Jun 23 12:14:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1496083 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=sb6QrnFj; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4G92K519rYz9sVp for ; Wed, 23 Jun 2021 22:15:21 +1000 (AEST) Received: from localhost ([::1]:51648 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lw1mo-0003y5-RN for incoming@patchwork.ozlabs.org; Wed, 23 Jun 2021 08:15:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46652) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lw1m5-0003tq-HD for qemu-devel@nongnu.org; Wed, 23 Jun 2021 08:14:33 -0400 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]:36711) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lw1m3-00021b-Md for qemu-devel@nongnu.org; Wed, 23 Jun 2021 08:14:33 -0400 Received: by mail-ej1-x62b.google.com with SMTP id nd37so3710189ejc.3 for ; Wed, 23 Jun 2021 05:14:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7ElfB3hCixBdlT6W7KW1tRrgymRkAv9P5WGy6JvpRnA=; b=sb6QrnFj0m0+otAHiP8uoPu/QWLKwwi0/icwL5zJbytz9GeA7CHV2KTiY6XB29PBVt +4OTDmM0qfB58FYE90MkZZCuuXwefz93wHEVfP6P5XkvBeHNOQXANF/vJhhddSY9spBh Mck9wZKfO7WEq2qgnnEFgSXIA6PaD00u+PiD6mfq91VCHxsrV6uuibaAHkw381iCE/pn MwTLZszAcLlPj7lo53BRSFuK0QMkMSraper9wZ46MOKx14UQd2K6jVLJJitRIayR2Rzy bCkLRpE0OFcGrwZAr603vxF8mPSIYqAyYWadNfpJlQORhPOmqmMDOVmuxNxeD27RiwNI vTDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=7ElfB3hCixBdlT6W7KW1tRrgymRkAv9P5WGy6JvpRnA=; b=G5mRw4RCerUWlan4iHsxl3fmt8OVzE+jtM1fxkxW9TJkNCi5jBNf9zkBoI4BIRYI+P bgxuqxlhxcYm9228l5efjho6qjt003lS0Rp3wp0tAmJY2RVEft703iarQZdBAOQkZ7KZ PPmnOcbEJGRP0rQ52hA8u8KVqVSx8pI3vkf0mJ8cCyvYkxtA6KfCkMuSDe6cxsg0pQlC aLxEChoWiUKzK3A5IUF+fHmj4ARY9VjUvFGwsXbpm8LrCSa5Sez9gouszPX39bAxSsya 0lWoQHndoy0ehOyYI6hmFbZXw7OiOgcmbQleUUzeZScJnJQPyII5Miu2vVSSJ9YxgZcq N/sw== X-Gm-Message-State: AOAM533eM3ShObdXnUMetgXdG5kYA5LNJAMmASk8MvzH7Hk6nYg/d/jq CviO0X6Rnhx6eC226RKmVzEHB0u2dbc= X-Google-Smtp-Source: ABdhPJxSwq+4iCYCe/Ve+qcQHlUes3kzmwAa5DAmO2WtZMq44yHcp78VNcRmetvESfRYpJRlAwBwwA== X-Received: by 2002:a17:906:3794:: with SMTP id n20mr9338985ejc.276.1624450470446; Wed, 23 Jun 2021 05:14:30 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id o5sm1680778edt.44.2021.06.23.05.14.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 05:14:30 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 07/12] configure, meson: convert libtasn1 detection to meson Date: Wed, 23 Jun 2021 14:14:19 +0200 Message-Id: <20210623121424.1259496-8-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210623121424.1259496-1-pbonzini@redhat.com> References: <20210623121424.1259496-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62b; envelope-from=paolo.bonzini@gmail.com; helo=mail-ej1-x62b.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Make it depend on gnutls too, since it is only used as part of gnutls tests. Reviewed-by: Richard Henderson Reviewed-by: Daniel P. Berrangé Signed-off-by: Paolo Bonzini --- configure | 19 ------------------- meson.build | 9 +++++---- tests/unit/meson.build | 2 +- 3 files changed, 6 insertions(+), 24 deletions(-) diff --git a/configure b/configure index 897e968e02..3d36eea55f 100755 --- a/configure +++ b/configure @@ -2799,20 +2799,6 @@ EOF fi fi -########################################## -# libtasn1 - only for the TLS creds/session test suite - -tasn1=yes -tasn1_cflags="" -tasn1_libs="" -if $pkg_config --exists "libtasn1"; then - tasn1_cflags=$($pkg_config --cflags libtasn1) - tasn1_libs=$($pkg_config --libs libtasn1) -else - tasn1=no -fi - - ########################################## # PAM probe @@ -5554,9 +5540,6 @@ if test "$gdbus_codegen" != "" ; then echo "GDBUS_CODEGEN=$gdbus_codegen" >> $config_host_mak fi echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak -if test "$tasn1" = "yes" ; then - echo "CONFIG_TASN1=y" >> $config_host_mak -fi if test "$auth_pam" = "yes" ; then echo "CONFIG_AUTH_PAM=y" >> $config_host_mak fi @@ -6017,8 +6000,6 @@ echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak echo "EXESUF=$EXESUF" >> $config_host_mak echo "HOST_DSOSUF=$HOST_DSOSUF" >> $config_host_mak echo "LIBS_QGA=$libs_qga" >> $config_host_mak -echo "TASN1_LIBS=$tasn1_libs" >> $config_host_mak -echo "TASN1_CFLAGS=$tasn1_cflags" >> $config_host_mak if test "$gcov" = "yes" ; then echo "CONFIG_GCOV=y" >> $config_host_mak fi diff --git a/meson.build b/meson.build index 286b37aecb..d4ce2ca57b 100644 --- a/meson.build +++ b/meson.build @@ -985,9 +985,10 @@ if 'CONFIG_LIBDAXCTL' in config_host libdaxctl = declare_dependency(link_args: config_host['LIBDAXCTL_LIBS'].split()) endif tasn1 = not_found -if 'CONFIG_TASN1' in config_host - tasn1 = declare_dependency(compile_args: config_host['TASN1_CFLAGS'].split(), - link_args: config_host['TASN1_LIBS'].split()) +if gnutls.found() + tasn1 = dependency('libtasn1', + method: 'pkg-config', + kwargs: static_kwargs) endif keyutils = dependency('libkeyutils', required: false, method: 'pkg-config', kwargs: static_kwargs) @@ -2727,7 +2728,7 @@ summary_info += {'pixman': pixman.found()} summary_info += {'VTE support': config_host.has_key('CONFIG_VTE')} # TODO: add back version summary_info += {'slirp support': slirp_opt == 'disabled' ? false : slirp_opt} -summary_info += {'libtasn1': config_host.has_key('CONFIG_TASN1')} +summary_info += {'libtasn1': tasn1.found()} summary_info += {'PAM': config_host.has_key('CONFIG_AUTH_PAM')} summary_info += {'iconv support': iconv.found()} summary_info += {'curses support': curses.found()} diff --git a/tests/unit/meson.build b/tests/unit/meson.build index fcf6ed2ef5..4c1ebc06ac 100644 --- a/tests/unit/meson.build +++ b/tests/unit/meson.build @@ -84,7 +84,7 @@ if have_block 'test-crypto-block': [io], } if gnutls.found() and \ - 'CONFIG_TASN1' in config_host and \ + tasn1.found() and \ 'CONFIG_POSIX' in config_host tests += { 'test-crypto-tlscredsx509': ['crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c', From patchwork Wed Jun 23 12:14:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1496086 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=iVVyoTgy; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4G92Mw1ndvz9sVp for ; Wed, 23 Jun 2021 22:17:48 +1000 (AEST) Received: from localhost ([::1]:58096 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lw1pB-0000Vx-U6 for incoming@patchwork.ozlabs.org; Wed, 23 Jun 2021 08:17:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46676) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lw1m6-0003vh-Lr for qemu-devel@nongnu.org; Wed, 23 Jun 2021 08:14:34 -0400 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]:34556) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lw1m4-000223-Gz for qemu-devel@nongnu.org; Wed, 23 Jun 2021 08:14:34 -0400 Received: by mail-ed1-x52e.google.com with SMTP id i5so3189394eds.1 for ; Wed, 23 Jun 2021 05:14:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wdNBBsrW5vIL9utRkwMG1tSad8yWDV0BnIWqmy35G8s=; b=iVVyoTgyOEGcfBnP8byUhqjaNaImzxrvEe4DXfJU8bN7CMB0ANPnxJqUvCtY3GzBKw 3L0m+ZxbHnxKfaX5aZ30OOgsHN/7VB6gU3oGYyWUK8LjB6Anm8G1Ou4P5BP64KME5fyh EX49n6aiGlQXj4hJtpPTGTyCTbfxuW7IG3Gi3Ffk2zxR1uq5Ih88dx1Eh5jDhuQQAIXX vh82mTemZr7sFC7Mi5k/eNjRikRcd2LqR1RoYhnceS94w0fBOs1CHD08dQFWk6lPuHzy WsukHrTa33sRHOzHALiuImaoP/RmfGp/9ed/b+3FPCKIJWW/tWjaPmXZBeadkXSNR741 gzwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=wdNBBsrW5vIL9utRkwMG1tSad8yWDV0BnIWqmy35G8s=; b=StX14Y5BDPnB1Nf2R4b9vr91YyFuEoF2TS3M9+KMj3eIRfhInmohozxmVI/lW4mEkq dsc6uxj1Fhogu/w+/PG5aBk7Tr2FwGInOCQIKCdIhCm8ix107CeTiQgKpHkrQeQ/lily wJiPZJXgraMBzYH91PF34SYhoti7COhAFeI84UAY1ivGOGxKYwGUhLiN+t5Sxf+cfJAV nu3/FJa6LVVwbmnPKFjkU/39y05D7XG8eVR1sm/0p4LRxPKyDp2obGGlRQWfzOSwd65V j0ql3mqMK7a9Xd3g3eqGUzjUPQGRjq+g1XUrfBJ6Fo8/K5CunaVYm0ZF4rcmQ5cHgsor DPQw== X-Gm-Message-State: AOAM531R6CxKMk7z97beUIIn6g7inifKH9mr8ruHZAq796weAAf4RLSj /zTbeMkpBanvV/+EdAKHgZmrAfps7Pc= X-Google-Smtp-Source: ABdhPJyq1IizHFcOP+PA/wSNgGbOBcWCT0psv+6sfClJ/ldUyPc1HaSm4iyIruvwuyoaEydsZI7sqQ== X-Received: by 2002:aa7:d818:: with SMTP id v24mr11734367edq.22.1624450471098; Wed, 23 Jun 2021 05:14:31 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id o5sm1680778edt.44.2021.06.23.05.14.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 05:14:30 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 08/12] configure, meson: convert pam detection to meson Date: Wed, 23 Jun 2021 14:14:20 +0200 Message-Id: <20210623121424.1259496-9-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210623121424.1259496-1-pbonzini@redhat.com> References: <20210623121424.1259496-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52e; envelope-from=paolo.bonzini@gmail.com; helo=mail-ed1-x52e.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Daniel P. Berrangé Signed-off-by: Paolo Bonzini --- authz/meson.build | 2 +- configure | 38 ++++---------------------------------- meson.build | 30 +++++++++++++++++++++++++----- meson_options.txt | 2 ++ tests/unit/meson.build | 2 +- 5 files changed, 33 insertions(+), 41 deletions(-) diff --git a/authz/meson.build b/authz/meson.build index 88fa7769cb..42a1ec0ff6 100644 --- a/authz/meson.build +++ b/authz/meson.build @@ -6,4 +6,4 @@ authz_ss.add(files( 'simple.c', )) -authz_ss.add(when: ['CONFIG_AUTH_PAM', pam], if_true: files('pamacct.c')) +authz_ss.add(when: pam, if_true: files('pamacct.c')) diff --git a/configure b/configure index 3d36eea55f..237e99c3d0 100755 --- a/configure +++ b/configure @@ -407,7 +407,7 @@ tls_priority="NORMAL" gnutls="auto" nettle="auto" gcrypt="auto" -auth_pam="$default_feature" +auth_pam="auto" vte="$default_feature" virglrenderer="$default_feature" tpm="$default_feature" @@ -1383,9 +1383,9 @@ for opt do ;; --enable-gcrypt) gcrypt="enabled" ;; - --disable-auth-pam) auth_pam="no" + --disable-auth-pam) auth_pam="disabled" ;; - --enable-auth-pam) auth_pam="yes" + --enable-auth-pam) auth_pam="enabled" ;; --enable-rdma) rdma="yes" ;; @@ -2799,33 +2799,6 @@ EOF fi fi -########################################## -# PAM probe - -if test "$auth_pam" != "no"; then - cat > $TMPC < -#include -int main(void) { - const char *service_name = "qemu"; - const char *user = "frank"; - const struct pam_conv pam_conv = { 0 }; - pam_handle_t *pamh = NULL; - pam_start(service_name, user, &pam_conv, &pamh); - return 0; -} -EOF - if compile_prog "" "-lpam" ; then - auth_pam=yes - else - if test "$auth_pam" = "yes"; then - feature_not_found "PAM" "Install PAM development package" - else - auth_pam=no - fi - fi -fi - ########################################## # VTE probe @@ -5540,9 +5513,6 @@ if test "$gdbus_codegen" != "" ; then echo "GDBUS_CODEGEN=$gdbus_codegen" >> $config_host_mak fi echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak -if test "$auth_pam" = "yes" ; then - echo "CONFIG_AUTH_PAM=y" >> $config_host_mak -fi if test "$have_broken_size_max" = "yes" ; then echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak fi @@ -6251,7 +6221,7 @@ if test "$skip_meson" = no; then -Dcurl=$curl -Dglusterfs=$glusterfs -Dbzip2=$bzip2 -Dlibiscsi=$libiscsi \ -Dlibnfs=$libnfs -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\ -Drbd=$rbd -Dlzo=$lzo -Dsnappy=$snappy -Dlzfse=$lzfse \ - -Dgnutls=$gnutls -Dnettle=$nettle -Dgcrypt=$gcrypt \ + -Dgnutls=$gnutls -Dnettle=$nettle -Dgcrypt=$gcrypt -Dauth_pam=$auth_pam \ -Dzstd=$zstd -Dseccomp=$seccomp -Dvirtfs=$virtfs -Dcap_ng=$cap_ng \ -Dattr=$attr -Ddefault_devices=$default_devices \ -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \ diff --git a/meson.build b/meson.build index d4ce2ca57b..c9266bd3cc 100644 --- a/meson.build +++ b/meson.build @@ -325,10 +325,6 @@ if have_system or have_tools pixman = dependency('pixman-1', required: have_system, version:'>=0.21.8', method: 'pkg-config', kwargs: static_kwargs) endif -pam = not_found -if 'CONFIG_AUTH_PAM' in config_host - pam = cc.find_library('pam') -endif libaio = cc.find_library('aio', required: false) zlib = dependency('zlib', required: true, kwargs: static_kwargs) linux_io_uring = not_found @@ -907,6 +903,30 @@ if get_option('vnc').enabled() endif endif +pam = not_found +if not get_option('auth_pam').auto() or have_system + pam = cc.find_library('pam', has_headers: ['security/pam_appl.h'], + required: get_option('auth_pam'), + kwargs: static_kwargs) +endif +if pam.found() and not cc.links(''' + #include + int main(void) { + const char *service_name = "qemu"; + const char *user = "frank"; + const struct pam_conv pam_conv = { 0 }; + pam_handle_t *pamh = NULL; + pam_start(service_name, user, &pam_conv, &pamh); + return 0; + }''', dependencies: pam) + pam = not_found + if get_option('auth_pam').enabled() + error('could not link libpam') + else + warning('could not link libpam, disabling') + endif +endif + snappy = not_found if not get_option('snappy').auto() or have_system snappy = cc.find_library('snappy', has_headers: ['snappy-c.h'], @@ -2729,7 +2749,7 @@ summary_info += {'VTE support': config_host.has_key('CONFIG_VTE')} # TODO: add back version summary_info += {'slirp support': slirp_opt == 'disabled' ? false : slirp_opt} summary_info += {'libtasn1': tasn1.found()} -summary_info += {'PAM': config_host.has_key('CONFIG_AUTH_PAM')} +summary_info += {'PAM': pam.found()} summary_info += {'iconv support': iconv.found()} summary_info += {'curses support': curses.found()} # TODO: add back version diff --git a/meson_options.txt b/meson_options.txt index 343ffffb7c..ac6e90da07 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -52,6 +52,8 @@ option('multiprocess', type: 'feature', value: 'auto', option('attr', type : 'feature', value : 'auto', description: 'attr/xattr support') +option('auth_pam', type : 'feature', value : 'auto', + description: 'PAM access control') option('brlapi', type : 'feature', value : 'auto', description: 'brlapi character device driver') option('bzip2', type : 'feature', value : 'auto', diff --git a/tests/unit/meson.build b/tests/unit/meson.build index 4c1ebc06ac..3e0504dd21 100644 --- a/tests/unit/meson.build +++ b/tests/unit/meson.build @@ -94,7 +94,7 @@ if have_block 'test-io-channel-tls': ['io-channel-helpers.c', 'crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c', tasn1, io, crypto, gnutls]} endif - if 'CONFIG_AUTH_PAM' in config_host + if pam.found() tests += {'test-authz-pam': [authz]} endif if xts == 'private' From patchwork Wed Jun 23 12:14:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1496091 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=PTWFceoK; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4G92ZJ18Lsz9tJD for ; Wed, 23 Jun 2021 22:26:47 +1000 (AEST) Received: from localhost ([::1]:51032 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lw1xt-0006ce-9X for incoming@patchwork.ozlabs.org; Wed, 23 Jun 2021 08:26:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46686) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lw1m7-0003wY-2r for qemu-devel@nongnu.org; Wed, 23 Jun 2021 08:14:35 -0400 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]:46867) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lw1m5-00022m-4W for qemu-devel@nongnu.org; Wed, 23 Jun 2021 08:14:34 -0400 Received: by mail-ed1-x52d.google.com with SMTP id s15so3100653edt.13 for ; Wed, 23 Jun 2021 05:14:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6339Efw60Jl/NQWy3OYFPNuGJDbHQC3IgrkTeNLIbRI=; b=PTWFceoKULUjelcNXMZrk2mzQ3VBIMCMk03rQRPPmg5Tvyi6rokgVw5TGjK/jmWw6O LiNJwf1wVuXjTgfU8DgPPMP2CQ+lF5MYjYISjRBl+tPSRebKfW2grTeiNsW6qX94GYB0 m7z6KL1n5YGAJZ13JyYaBxr4J8NbWUPqZZIev+/+aJ0YoIPEWxErqVy1Pu76y8cF49KB Zq7SjVbLPw/FrbrgFGr73Ndz1cyn7b3bkcCmhDozVtn7VdndDoBGXWurCp/ZSAq0itYK OgHIYybs/BTtIZjL5r3WkxotJOlQxxR3PnRC5dtSjFUlbnQCdJv9QJqQn/8+n5DK5+p7 J8ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=6339Efw60Jl/NQWy3OYFPNuGJDbHQC3IgrkTeNLIbRI=; b=PytM9KymcBMNL45xzxTw3S6ihngMiWuaWYvkb8MiQonubOrXWbnzTXrrjO5gxnUM8c EMEw8Wkj4CpBMHdwAoZWNprL5mAXU8HLapBwqC0A1WHxKtZiSeNGm8YtOWe4/+I7ssg8 z7xgnPweI/1RFhOm2dnCuFvsA3gqXdTwdXwUsb54Q4+CLB9df3P6m9h3kOM0kvBd4Uap kWj5eBmQDs9icQ/kSfGc4wrcbycdoe/315yAExz1Cg3ShJF9yMAOZODCTTtldAu4uQ57 8YssQBNABRHswqJNSimKfpWRdbq0vDvw4ahSV4idmzO1MRbkwszub1W8nqY4SgCWwstg Ww3Q== X-Gm-Message-State: AOAM530NoFiAsZtn3SvvV/ImLetZ/NJDSOfIVn6zjPHBILJTEK/vgL1v tmWe9pxNEkWXreW1PO6Yhx56AkmRlaQ= X-Google-Smtp-Source: ABdhPJxx6un0My/z8BYTGjpe9DraIQSkNNmoP9ZjpTTVYajz4BznUUxtyD1sOpp9wNrLrKp2CQK/7w== X-Received: by 2002:a05:6402:1355:: with SMTP id y21mr12044922edw.136.1624450471760; Wed, 23 Jun 2021 05:14:31 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id o5sm1680778edt.44.2021.06.23.05.14.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 05:14:31 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 09/12] configure, meson: convert libusb detection to meson Date: Wed, 23 Jun 2021 14:14:21 +0200 Message-Id: <20210623121424.1259496-10-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210623121424.1259496-1-pbonzini@redhat.com> References: <20210623121424.1259496-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52d; envelope-from=paolo.bonzini@gmail.com; helo=mail-ed1-x52d.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Daniel P. Berrangé Signed-off-by: Paolo Bonzini --- configure | 27 ++++----------------------- hw/usb/meson.build | 2 +- meson.build | 11 +++++++---- meson_options.txt | 2 ++ 4 files changed, 14 insertions(+), 28 deletions(-) diff --git a/configure b/configure index 237e99c3d0..e54d06b99e 100755 --- a/configure +++ b/configure @@ -374,7 +374,7 @@ spice_protocol="auto" rbd="auto" smartcard="$default_feature" u2f="auto" -libusb="$default_feature" +libusb="auto" usb_redir="$default_feature" opengl="$default_feature" cpuid_h="no" @@ -1285,9 +1285,9 @@ for opt do ;; --enable-u2f) u2f="enabled" ;; - --disable-libusb) libusb="no" + --disable-libusb) libusb="disabled" ;; - --enable-libusb) libusb="yes" + --enable-libusb) libusb="enabled" ;; --disable-usb-redir) usb_redir="no" ;; @@ -3994,20 +3994,6 @@ if test "$smartcard" != "no"; then fi fi -# check for libusb -if test "$libusb" != "no" ; then - if $pkg_config --atleast-version=1.0.13 libusb-1.0; then - libusb="yes" - libusb_cflags=$($pkg_config --cflags libusb-1.0) - libusb_libs=$($pkg_config --libs libusb-1.0) - else - if test "$libusb" = "yes"; then - feature_not_found "libusb" "Install libusb devel >= 1.0.13" - fi - libusb="no" - fi -fi - # check for usbredirparser for usb network redirection support if test "$usb_redir" != "no" ; then if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then @@ -5631,12 +5617,6 @@ if test "$smartcard" = "yes" ; then echo "SMARTCARD_LIBS=$libcacard_libs" >> $config_host_mak fi -if test "$libusb" = "yes" ; then - echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak - echo "LIBUSB_CFLAGS=$libusb_cflags" >> $config_host_mak - echo "LIBUSB_LIBS=$libusb_libs" >> $config_host_mak -fi - if test "$usb_redir" = "yes" ; then echo "CONFIG_USB_REDIR=y" >> $config_host_mak echo "USB_REDIR_CFLAGS=$usb_redir_cflags" >> $config_host_mak @@ -6215,6 +6195,7 @@ if test "$skip_meson" = no; then -Dkvm=$kvm -Dhax=$hax -Dwhpx=$whpx -Dhvf=$hvf -Dnvmm=$nvmm \ -Dxen=$xen -Dxen_pci_passthrough=$xen_pci_passthrough -Dtcg=$tcg \ -Dcocoa=$cocoa -Dgtk=$gtk -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \ + -Dlibusb=$libusb \ -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \ -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f -Dvirtiofsd=$virtiofsd \ -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt -Dbrlapi=$brlapi \ diff --git a/hw/usb/meson.build b/hw/usb/meson.build index f357270d0b..bd3f8735b9 100644 --- a/hw/usb/meson.build +++ b/hw/usb/meson.build @@ -72,7 +72,7 @@ if config_host.has_key('CONFIG_USB_REDIR') endif # usb pass-through -softmmu_ss.add(when: ['CONFIG_USB', 'CONFIG_USB_LIBUSB', libusb], +softmmu_ss.add(when: ['CONFIG_USB', libusb], if_true: files('host-libusb.c'), if_false: files('host-stub.c')) softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('host-stub.c')) diff --git a/meson.build b/meson.build index c9266bd3cc..58d3a3bdc9 100644 --- a/meson.build +++ b/meson.build @@ -991,10 +991,12 @@ if 'CONFIG_USB_REDIR' in config_host link_args: config_host['USB_REDIR_LIBS'].split()) endif libusb = not_found -if 'CONFIG_USB_LIBUSB' in config_host - libusb = declare_dependency(compile_args: config_host['LIBUSB_CFLAGS'].split(), - link_args: config_host['LIBUSB_LIBS'].split()) +if not get_option('libusb').auto() or have_system + libusb = dependency('libusb-1.0', required: get_option('libusb'), + version: '>=1.0.13', method: 'pkg-config', + kwargs: static_kwargs) endif + libpmem = not_found if 'CONFIG_LIBPMEM' in config_host libpmem = declare_dependency(compile_args: config_host['LIBPMEM_CFLAGS'].split(), @@ -1210,6 +1212,7 @@ config_host_data.set('CONFIG_SDL', sdl.found()) config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found()) config_host_data.set('CONFIG_SECCOMP', seccomp.found()) config_host_data.set('CONFIG_SNAPPY', snappy.found()) +config_host_data.set('CONFIG_USB_LIBUSB', libusb.found()) config_host_data.set('CONFIG_VHOST_USER_BLK_SERVER', have_vhost_user_blk_server) config_host_data.set('CONFIG_VNC', vnc.found()) config_host_data.set('CONFIG_VNC_JPEG', jpeg.found()) @@ -2779,7 +2782,7 @@ summary_info += {'rbd support': rbd.found()} summary_info += {'xfsctl support': config_host.has_key('CONFIG_XFS')} summary_info += {'smartcard support': config_host.has_key('CONFIG_SMARTCARD')} summary_info += {'U2F support': u2f.found()} -summary_info += {'libusb': config_host.has_key('CONFIG_USB_LIBUSB')} +summary_info += {'libusb': libusb.found()} summary_info += {'usb net redir': config_host.has_key('CONFIG_USB_REDIR')} summary_info += {'OpenGL support': config_host.has_key('CONFIG_OPENGL')} summary_info += {'GBM': config_host.has_key('CONFIG_GBM')} diff --git a/meson_options.txt b/meson_options.txt index ac6e90da07..02c14d4751 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -86,6 +86,8 @@ option('gcrypt', type : 'feature', value : 'auto', description: 'libgcrypt cryptography support') option('libudev', type : 'feature', value : 'auto', description: 'Use libudev to enumerate host devices') +option('libusb', type : 'feature', value : 'auto', + description: 'libusb support for USB passthrough') option('lzfse', type : 'feature', value : 'auto', description: 'lzfse support for DMG images') option('lzo', type : 'feature', value : 'auto', From patchwork Wed Jun 23 12:14:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1496085 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=HHwI4lsi; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4G92Mw2HXgz9sWc for ; Wed, 23 Jun 2021 22:17:48 +1000 (AEST) Received: from localhost ([::1]:58028 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lw1pB-0000Sa-Uq for incoming@patchwork.ozlabs.org; Wed, 23 Jun 2021 08:17:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46698) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lw1m7-0003xc-Md for qemu-devel@nongnu.org; Wed, 23 Jun 2021 08:14:35 -0400 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]:44704) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lw1m5-000230-Ru for qemu-devel@nongnu.org; Wed, 23 Jun 2021 08:14:35 -0400 Received: by mail-ed1-x536.google.com with SMTP id h17so3111090edw.11 for ; Wed, 23 Jun 2021 05:14:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=d32XUzLMeRriXItMsV+5xfA+70J9flcGtyFqi4t8lOc=; b=HHwI4lsinn2ua4/Ze5YpDoLU+2/pJ8hq5s52mBZi5YciOjxEHuWyB5QjpK6o3IQ/LP KYfOd17Jru5J3p3YjPC4J10hKSWXByEmNZmgMwV6QCj03LrGjfkqpkDv+m9hvdQM4iPn eQRhalxSqIysLOiE6NJRWXeNytFyhu7lkmuYKUdE94EQo6aLhI8NLdp635TSjcctPRw6 +ag3x3VuWheec7DP74BYXHb/vbDDwNhTp6aF/v2tHn1hGWeG42aa/znVmVwVeTvuq2KZ eLfaewL5gnmPK4swbfApBuaItf9CVQvI2oTKRxZq3z0nAnZc9FIWnFUNRZMeNIuPxYm8 tbaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=d32XUzLMeRriXItMsV+5xfA+70J9flcGtyFqi4t8lOc=; b=QmHD6Jv7wEWGqrnbOroX23PzNwtFjsQGKiIWhabIGBd8EUY6UGa0xAfi/KR1dn2Rij tYlSfJ/Bf+/3JiWx+C00x1VJZvSUr3z2Ra3jVsJ7gT+r88MkFr6hFX7Dw6GS5Ud/NYKY LsEIodXu7tRhVgCqGWRQVy2quzZB/zYZbIuA6g66bP8+FhBqK/QcxDcMXosNqjCD3iBq LjCSGkAxntMQeZIC8mklO34DRn3YTkM1yA5QwnZgqEgC30SOru5XGTNTV9xIVSZJTWA1 KGXg11PuR/x/j5n5jZVigl6y9siVi6Zoan+M9v9BP6q7e5fzTwekupXNxxI45zuJeHoc wasQ== X-Gm-Message-State: AOAM5337vZbbls0expcw7Td/A/i4Q6XIoU0adkeYaUit92WFDk6oFq4m 3gSA5uqMPCqmVGaaD6MTYpiyZ1ylunc= X-Google-Smtp-Source: ABdhPJwu0Ou0BKLrrl2WjycQE6Kkk9d6SlNiJf1qkRMFgc7exR6xE8P1fzQq3DT+P3XYua9eLrpIag== X-Received: by 2002:aa7:dd57:: with SMTP id o23mr11810521edw.6.1624450472466; Wed, 23 Jun 2021 05:14:32 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id o5sm1680778edt.44.2021.06.23.05.14.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 05:14:32 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 10/12] configure, meson: convert libcacard detection to meson Date: Wed, 23 Jun 2021 14:14:22 +0200 Message-Id: <20210623121424.1259496-11-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210623121424.1259496-1-pbonzini@redhat.com> References: <20210623121424.1259496-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::536; envelope-from=paolo.bonzini@gmail.com; helo=mail-ed1-x536.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Daniel P. Berrangé Signed-off-by: Paolo Bonzini --- configure | 28 ++++------------------------ hw/usb/meson.build | 2 +- meson.build | 9 +++++---- meson_options.txt | 2 ++ 4 files changed, 12 insertions(+), 29 deletions(-) diff --git a/configure b/configure index e54d06b99e..02b0acc1f5 100755 --- a/configure +++ b/configure @@ -372,7 +372,7 @@ trace_file="trace" spice="$default_feature" spice_protocol="auto" rbd="auto" -smartcard="$default_feature" +smartcard="auto" u2f="auto" libusb="auto" usb_redir="$default_feature" @@ -1277,9 +1277,9 @@ for opt do ;; --enable-xfsctl) xfs="yes" ;; - --disable-smartcard) smartcard="no" + --disable-smartcard) smartcard="disabled" ;; - --enable-smartcard) smartcard="yes" + --enable-smartcard) smartcard="enabled" ;; --disable-u2f) u2f="disabled" ;; @@ -3980,20 +3980,6 @@ EOF fi fi -# check for smartcard support -if test "$smartcard" != "no"; then - if $pkg_config --atleast-version=2.5.1 libcacard; then - libcacard_cflags=$($pkg_config --cflags libcacard) - libcacard_libs=$($pkg_config --libs libcacard) - smartcard="yes" - else - if test "$smartcard" = "yes"; then - feature_not_found "smartcard" "Install libcacard devel" - fi - smartcard="no" - fi -fi - # check for usbredirparser for usb network redirection support if test "$usb_redir" != "no" ; then if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then @@ -5611,12 +5597,6 @@ if test "$spice" = "yes" ; then echo "SPICE_LIBS=$spice_libs" >> $config_host_mak fi -if test "$smartcard" = "yes" ; then - echo "CONFIG_SMARTCARD=y" >> $config_host_mak - echo "SMARTCARD_CFLAGS=$libcacard_cflags" >> $config_host_mak - echo "SMARTCARD_LIBS=$libcacard_libs" >> $config_host_mak -fi - if test "$usb_redir" = "yes" ; then echo "CONFIG_USB_REDIR=y" >> $config_host_mak echo "USB_REDIR_CFLAGS=$usb_redir_cflags" >> $config_host_mak @@ -6195,7 +6175,7 @@ if test "$skip_meson" = no; then -Dkvm=$kvm -Dhax=$hax -Dwhpx=$whpx -Dhvf=$hvf -Dnvmm=$nvmm \ -Dxen=$xen -Dxen_pci_passthrough=$xen_pci_passthrough -Dtcg=$tcg \ -Dcocoa=$cocoa -Dgtk=$gtk -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \ - -Dlibusb=$libusb \ + -Dlibusb=$libusb -Dsmartcard=$smartcard \ -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \ -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f -Dvirtiofsd=$virtiofsd \ -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt -Dbrlapi=$brlapi \ diff --git a/hw/usb/meson.build b/hw/usb/meson.build index bd3f8735b9..df9effbb10 100644 --- a/hw/usb/meson.build +++ b/hw/usb/meson.build @@ -49,7 +49,7 @@ softmmu_ss.add(when: ['CONFIG_POSIX', 'CONFIG_USB_STORAGE_MTP'], if_true: files( # smartcard softmmu_ss.add(when: 'CONFIG_USB_SMARTCARD', if_true: files('dev-smartcard-reader.c')) -if config_host.has_key('CONFIG_SMARTCARD') +if cacard.found() usbsmartcard_ss = ss.source_set() usbsmartcard_ss.add(when: 'CONFIG_USB_SMARTCARD', if_true: [cacard, files('ccid-card-emulated.c', 'ccid-card-passthru.c')]) diff --git a/meson.build b/meson.build index 58d3a3bdc9..3172b7e63d 100644 --- a/meson.build +++ b/meson.build @@ -975,9 +975,10 @@ if 'CONFIG_XEN_BACKEND' in config_host link_args: config_host['XEN_LIBS'].split()) endif cacard = not_found -if 'CONFIG_SMARTCARD' in config_host - cacard = declare_dependency(compile_args: config_host['SMARTCARD_CFLAGS'].split(), - link_args: config_host['SMARTCARD_LIBS'].split()) +if not get_option('smartcard').auto() or have_system + cacard = dependency('libcacard', required: get_option('smartcard'), + version: '>=2.5.1', method: 'pkg-config', + kwargs: static_kwargs) endif u2f = not_found if have_system @@ -2780,7 +2781,7 @@ summary_info += {'bpf support': libbpf.found()} summary_info += {'spice support': config_host.has_key('CONFIG_SPICE')} summary_info += {'rbd support': rbd.found()} summary_info += {'xfsctl support': config_host.has_key('CONFIG_XFS')} -summary_info += {'smartcard support': config_host.has_key('CONFIG_SMARTCARD')} +summary_info += {'smartcard support': cacard.found()} summary_info += {'U2F support': u2f.found()} summary_info += {'libusb': libusb.found()} summary_info += {'usb net redir': config_host.has_key('CONFIG_USB_REDIR')} diff --git a/meson_options.txt b/meson_options.txt index 02c14d4751..cd9374384e 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -102,6 +102,8 @@ option('sdl_image', type : 'feature', value : 'auto', description: 'SDL Image support for icons') option('seccomp', type : 'feature', value : 'auto', description: 'seccomp support') +option('smartcard', type : 'feature', value : 'auto', + description: 'CA smartcard emulation support') option('snappy', type : 'feature', value : 'auto', description: 'snappy compression support') option('u2f', type : 'feature', value : 'auto', From patchwork Wed Jun 23 12:14:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1496092 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=LsJGpLHU; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4G92cX40f0z9t0p for ; Wed, 23 Jun 2021 22:28:44 +1000 (AEST) Received: from localhost ([::1]:54744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lw1zl-0000iQ-AH for incoming@patchwork.ozlabs.org; Wed, 23 Jun 2021 08:28:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46708) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lw1m8-0003zl-Eq for qemu-devel@nongnu.org; Wed, 23 Jun 2021 08:14:36 -0400 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]:37501) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lw1m6-00023C-Hj for qemu-devel@nongnu.org; Wed, 23 Jun 2021 08:14:36 -0400 Received: by mail-ej1-x635.google.com with SMTP id ji1so3701486ejc.4 for ; Wed, 23 Jun 2021 05:14:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kFzdldg2EyRCSItr1sneSdB29YIgEZbKKLYDNLVcEbA=; b=LsJGpLHUvEEBdrtzzkfzc+Vbz2JbDTUWsPOSFkKjjTDi6BFkhjtGIijLs49ARfTkuz YTNhxyarA8QknfqxxIAnDmpVpzsKbKaB/gIl2Cb6QCj4f61NDqLcvNjIUDFUxWwhew0m 8lMbivU1Dy0sx9Jco9FA9RM8t+TOae3JCo+gHxVoWtb7mgKUyV++SFNtqysgZsZEOsIy Luvm06Xj/dLbl96xwB3XHNVXvQtXUAerGBeIP3nNLtoboPCSgqJiU5XtyQ+9s9VS2Ii+ yPKw3/g2RlgEBm9v3cSCl/Paheuc/Iy/nBvEi67QYfAiVR2dVCKr6H5KZ3QHWYt9JQJ2 qYnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=kFzdldg2EyRCSItr1sneSdB29YIgEZbKKLYDNLVcEbA=; b=o2Dt/2+DZGnnfSLV1Dn+VCrUraeG2hcbyEIfYM2ceruVTWarmnwZLskv3/SaiQ30eI oUD9+HVeQcyumqweClP0WMrLj+oO1DFgRQIQoC7OTq8UcGFaT7oIkK5lZGDCoi8tIsRV AXIo/9TXuHtPqtQ3ZDdh6X6ICRN2Zr/4IXXIk/0RuMQk3Xt7WxfWDPEz44m4DeQb0b5C GY59uFa+jCODMm8J8BlQB+TJHLnZV5XOSuKf/z4hiWrzdrAmqEnk6aUFZbzPjm7LEpWS WsqOLHVz7Uf/m6ieDMdderQVoYAruWEfvIuo9pi+/M76/fE46YUiKNabH3vmToP/sZnI Z6Iw== X-Gm-Message-State: AOAM532w4GIfolobzq4TGVV3lXOW89j8b6GemxUwAlQBVkL9akCS8ENS XIt/D4aH1fv1QGEl8Z44mLt8QJdHQ30= X-Google-Smtp-Source: ABdhPJwuwaCm3XM6r4VUOgx9hVUB0oUvaz4df6WiRrWmPNqYF++nd9HR8/X0Fdb9wj1knjj6vyPOxw== X-Received: by 2002:a17:907:da4:: with SMTP id go36mr9421822ejc.21.1624450473193; Wed, 23 Jun 2021 05:14:33 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id o5sm1680778edt.44.2021.06.23.05.14.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 05:14:32 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 11/12] configure, meson: convert libusbredir detection to meson Date: Wed, 23 Jun 2021 14:14:23 +0200 Message-Id: <20210623121424.1259496-12-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210623121424.1259496-1-pbonzini@redhat.com> References: <20210623121424.1259496-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=paolo.bonzini@gmail.com; helo=mail-ej1-x635.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Daniel P. Berrangé Signed-off-by: Paolo Bonzini --- configure | 28 ++++------------------------ hw/usb/meson.build | 2 +- meson.build | 9 +++++---- meson_options.txt | 2 ++ 4 files changed, 12 insertions(+), 29 deletions(-) diff --git a/configure b/configure index 02b0acc1f5..e799d908a3 100755 --- a/configure +++ b/configure @@ -375,7 +375,7 @@ rbd="auto" smartcard="auto" u2f="auto" libusb="auto" -usb_redir="$default_feature" +usb_redir="auto" opengl="$default_feature" cpuid_h="no" avx2_opt="$default_feature" @@ -1289,9 +1289,9 @@ for opt do ;; --enable-libusb) libusb="enabled" ;; - --disable-usb-redir) usb_redir="no" + --disable-usb-redir) usb_redir="disabled" ;; - --enable-usb-redir) usb_redir="yes" + --enable-usb-redir) usb_redir="enabled" ;; --disable-zlib-test) ;; @@ -3980,20 +3980,6 @@ EOF fi fi -# check for usbredirparser for usb network redirection support -if test "$usb_redir" != "no" ; then - if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then - usb_redir="yes" - usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5) - usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5) - else - if test "$usb_redir" = "yes"; then - feature_not_found "usb-redir" "Install usbredir devel" - fi - usb_redir="no" - fi -fi - ########################################## # check if we have VSS SDK headers for win @@ -5597,12 +5583,6 @@ if test "$spice" = "yes" ; then echo "SPICE_LIBS=$spice_libs" >> $config_host_mak fi -if test "$usb_redir" = "yes" ; then - echo "CONFIG_USB_REDIR=y" >> $config_host_mak - echo "USB_REDIR_CFLAGS=$usb_redir_cflags" >> $config_host_mak - echo "USB_REDIR_LIBS=$usb_redir_libs" >> $config_host_mak -fi - if test "$opengl" = "yes" ; then echo "CONFIG_OPENGL=y" >> $config_host_mak echo "OPENGL_CFLAGS=$opengl_cflags" >> $config_host_mak @@ -6175,7 +6155,7 @@ if test "$skip_meson" = no; then -Dkvm=$kvm -Dhax=$hax -Dwhpx=$whpx -Dhvf=$hvf -Dnvmm=$nvmm \ -Dxen=$xen -Dxen_pci_passthrough=$xen_pci_passthrough -Dtcg=$tcg \ -Dcocoa=$cocoa -Dgtk=$gtk -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \ - -Dlibusb=$libusb -Dsmartcard=$smartcard \ + -Dlibusb=$libusb -Dsmartcard=$smartcard -Dusb_redir=$usb_redir \ -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \ -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f -Dvirtiofsd=$virtiofsd \ -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt -Dbrlapi=$brlapi \ diff --git a/hw/usb/meson.build b/hw/usb/meson.build index df9effbb10..4f24b5274d 100644 --- a/hw/usb/meson.build +++ b/hw/usb/meson.build @@ -64,7 +64,7 @@ if u2f.found() endif # usb redirect -if config_host.has_key('CONFIG_USB_REDIR') +if usbredir.found() usbredir_ss = ss.source_set() usbredir_ss.add(when: 'CONFIG_USB', if_true: [usbredir, files('redirect.c', 'quirks.c')]) diff --git a/meson.build b/meson.build index 3172b7e63d..c8505bb367 100644 --- a/meson.build +++ b/meson.build @@ -987,9 +987,10 @@ if have_system kwargs: static_kwargs) endif usbredir = not_found -if 'CONFIG_USB_REDIR' in config_host - usbredir = declare_dependency(compile_args: config_host['USB_REDIR_CFLAGS'].split(), - link_args: config_host['USB_REDIR_LIBS'].split()) +if not get_option('usb_redir').auto() or have_system + usbredir = dependency('libusbredirparser-0.5', required: get_option('usb_redir'), + version: '>=0.6', method: 'pkg-config', + kwargs: static_kwargs) endif libusb = not_found if not get_option('libusb').auto() or have_system @@ -2784,7 +2785,7 @@ summary_info += {'xfsctl support': config_host.has_key('CONFIG_XFS')} summary_info += {'smartcard support': cacard.found()} summary_info += {'U2F support': u2f.found()} summary_info += {'libusb': libusb.found()} -summary_info += {'usb net redir': config_host.has_key('CONFIG_USB_REDIR')} +summary_info += {'usb net redir': usbredir.found()} summary_info += {'OpenGL support': config_host.has_key('CONFIG_OPENGL')} summary_info += {'GBM': config_host.has_key('CONFIG_GBM')} summary_info += {'libiscsi support': libiscsi.found()} diff --git a/meson_options.txt b/meson_options.txt index cd9374384e..f7ec9bee27 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -108,6 +108,8 @@ option('snappy', type : 'feature', value : 'auto', description: 'snappy compression support') option('u2f', type : 'feature', value : 'auto', description: 'U2F emulation support') +option('usb_redir', type : 'feature', value : 'auto', + description: 'libusbredir support') option('vnc', type : 'feature', value : 'enabled', description: 'VNC server') option('vnc_jpeg', type : 'feature', value : 'auto', From patchwork Wed Jun 23 12:14:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1496093 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=FBDceoT6; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4G92fG1kNGz9sX5 for ; Wed, 23 Jun 2021 22:30:14 +1000 (AEST) Received: from localhost ([::1]:58646 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lw21E-0003J5-0N for incoming@patchwork.ozlabs.org; Wed, 23 Jun 2021 08:30:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46710) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lw1m8-000414-RO for qemu-devel@nongnu.org; Wed, 23 Jun 2021 08:14:36 -0400 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]:41787) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lw1m7-000240-5Z for qemu-devel@nongnu.org; Wed, 23 Jun 2021 08:14:36 -0400 Received: by mail-ej1-x629.google.com with SMTP id ot9so2677019ejb.8 for ; Wed, 23 Jun 2021 05:14:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Q0ZN4n/dtFMRMepbnfjzMN5tAEFeuoYDClHc1sps4os=; b=FBDceoT60Aearx2S/IAUP7YOHu1SYbRveXq5ucHpmpGueyVv/m/UGz1XYo40jZppc2 cgB63l3Ih8GWKUuR59zAMQxhKdg8d/4WMv/alAJ6KKl2p2q4cB4GlqgF+jm7WQiK4qXS KIHow56ASBPmwnUcsvolZKsQyviZH2BoQEykS6IVJyAsqcC9bFb+fdkZqzn/qryOYWW2 3XCYtL7UiH5dywNWONmTzuXZS4CTkjeSMxGrCMbwjIsfPhlxYBf8lf50ZxlPxh2rAzGf 5E7rF0Jq4+1BbBInhAetk4ipmN+uw14zpUayjTf70BHxsHRYxIdMf3PO8+9DVfaUtwx8 KZbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Q0ZN4n/dtFMRMepbnfjzMN5tAEFeuoYDClHc1sps4os=; b=BLkar5gmhkysJVYzVyRw60G2+/bZl844KytCgOTP4YL1tg8YgDwmSxNko0UNLQSCWV p9Kkij1M88epjVGqnTog9K+IXbCImqIDnciDIliD0PRzS0i/WjsaEawh821DFLT1hPe0 4za9DuHxclLgxmjHJsbkyJG5mFFO+sCHHo+2l3GqhqiLFx/VJvFTmkhNXANWP/DW39Je vcxBNCyulsSA7D3EIz//k2OR8dAZTUC2TmprI0sumYRFAGavMvgMszjQk/rLAKxHj22K xTWZoWCv2befMt6w8HJ9wWMbFAB+ItOq6DZmVmT+bHtJlXbXnjX3UbtQWaxSmepD27aC Sd9g== X-Gm-Message-State: AOAM530LgQBNANs8/cnPPZz8AVR2wODo0hFVUObLZjY4QxXeiQtxvZ/X kVU91We+c9CKhUgvV0g+T4BB87vMxK4= X-Google-Smtp-Source: ABdhPJwwvWW7JAoAQg8gBOIX2cATroaYL2QoAtm4z/VDaLWPpjq/wr/gsKQiLIPwJ+kDX9lOGhFUVw== X-Received: by 2002:a17:907:1b11:: with SMTP id mp17mr9794417ejc.1.1624450473874; Wed, 23 Jun 2021 05:14:33 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id o5sm1680778edt.44.2021.06.23.05.14.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 05:14:33 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 12/12] KVM: Fix dirty ring mmap incorrect size due to renaming accident Date: Wed, 23 Jun 2021 14:14:24 +0200 Message-Id: <20210623121424.1259496-13-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210623121424.1259496-1-pbonzini@redhat.com> References: <20210623121424.1259496-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::629; envelope-from=paolo.bonzini@gmail.com; helo=mail-ej1-x629.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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: Hyman Huang , "Dr . David Alan Gilbert" , Peter Xu Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Peter Xu Found this when I wanted to try the per-vcpu dirty rate series out, then I found that it's not really working and it can quickly hang death a guest. I found strange errors (e.g. guest crash after migration) happens even without the per-vcpu dirty rate series. When merging dirty ring, probably no one notice that the trivial renaming diff [1] missed two existing references of kvm_dirty_ring_sizes; they do matter since otherwise we'll mmap() a shorter range of memory after the renaming. I think it didn't SIGBUS for me easily simply because some other stuff within qemu mmap()ed right after the dirty rings (e.g. when testing 4096 slots, it aligned with one small page on x86), so when we access the rings we've been reading/writting to random memory elsewhere of qemu. Fix the two sizes when map/unmap the shared dirty gfn memory. [1] https://lore.kernel.org/qemu-devel/dac5f0c6-1bca-3daf-e5d2-6451dbbaca93@redhat.com/ Cc: Hyman Huang Cc: Paolo Bonzini Cc: Dr. David Alan Gilbert Signed-off-by: Peter Xu Message-Id: <20210609014355.217110-1-peterx@redhat.com> Signed-off-by: Paolo Bonzini --- accel/kvm/kvm-all.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index c7ec538850..e5b10dd129 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -411,7 +411,7 @@ static int do_kvm_destroy_vcpu(CPUState *cpu) } if (cpu->kvm_dirty_gfns) { - ret = munmap(cpu->kvm_dirty_gfns, s->kvm_dirty_ring_size); + ret = munmap(cpu->kvm_dirty_gfns, s->kvm_dirty_ring_bytes); if (ret < 0) { goto err; } @@ -495,7 +495,7 @@ int kvm_init_vcpu(CPUState *cpu, Error **errp) if (s->kvm_dirty_ring_size) { /* Use MAP_SHARED to share pages with the kernel */ - cpu->kvm_dirty_gfns = mmap(NULL, s->kvm_dirty_ring_size, + cpu->kvm_dirty_gfns = mmap(NULL, s->kvm_dirty_ring_bytes, PROT_READ | PROT_WRITE, MAP_SHARED, cpu->kvm_fd, PAGE_SIZE * KVM_DIRTY_LOG_PAGE_OFFSET);