Message ID | 20230913093009.83520-7-philmd@linaro.org |
---|---|
State | New |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a5d:4387:0:b0:31d:da82:a3b4 with SMTP id i7csp192724wrq; Wed, 13 Sep 2023 02:32:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHdm6G4+hA71TSSP5C0QnWfCAFQf+nr6CpEWNtB1IzREACiidCQxqgclGSsnwl+WEbjBkK8 X-Received: by 2002:a05:620a:4507:b0:768:2da6:577e with SMTP id t7-20020a05620a450700b007682da6577emr2314541qkp.9.1694597523067; Wed, 13 Sep 2023 02:32:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694597523; cv=none; d=google.com; s=arc-20160816; b=jlWmAANGU4o3lFsAglHVCh1sW9lGWSTgxO4YA4gEA0S9JsgIL789WDTKsXr+cBVAJx kZ+ze1E9rfdFykrH26RNc1tgyOZ5ZZrqUHVqUkkUo11DrmOFyYhhkfc7REQTMJObzRdN vNQ8wgeWS2Xghi0TIiicwqPTCdfMTINuzVJdr91kT3kCDeH3GoguJm813DqDFObkvnFu Oho+vdBmfP7tJZB6IAtCYeuLmaVBBrdZAFzb0clhqt14TFHIOBwCXdVSxoNasFwdidni b83bap3DFLdt2kzcgk5Cy29AJtYwuLxvZUcZoqrQ+kNtZj9zLTr5vXWYB2aRpy+bQr0z /9DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jtT3ML1tHJnWRfmIXQrD6YCHmxZTPOtervgh4drQU7s=; fh=gGU+936hSKyjfCkvw+7ovSo4LbZMBSzYH7C194STwMA=; b=nIyECnFP2ctoHbZcDp/7p8E+NtSI9c/3SU2+iqRWDy8fK5ZCDBeo0sik43nUvvHJ1L Wd2vks4A7dMQfA53LXAYqyag+jxb61arjl1FmBaWjqOJ9eeHtSx0A+skNkWBXdA2G5iQ O1YU2jH6TdzC/RvlQ4szaNQwsjzhUs57hJI15yYBTATfhA3jaHFYyVgvlCXwvP+vQBwy ij+9mNvH/1TTpqTq/wboq/UzoXRFpgV0UjemVK5R2JS90s+Kb+/k9xkQNX4KMODguIwG AhStDtAKzDCphaWtu1WlNyox1bmqTKGOxN06BaOADovVB0C47I9BGT3CF1BNPoGBQZDL A5HQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wyNU+9QI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: <qemu-devel-bounces+patch=linaro.org@nongnu.org> Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ef9-20020a05620a808900b0076f25a73c79si6939361qkb.246.2023.09.13.02.32.02 for <patch@linaro.org> (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Sep 2023 02:32:03 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wyNU+9QI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <qemu-devel-bounces@nongnu.org>) id 1qgMD7-0001JZ-BM; Wed, 13 Sep 2023 05:31:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1qgMD1-0001Iz-D5 for qemu-devel@nongnu.org; Wed, 13 Sep 2023 05:30:55 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1qgMCz-0002ME-5U for qemu-devel@nongnu.org; Wed, 13 Sep 2023 05:30:55 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-40037db2fe7so70558695e9.0 for <qemu-devel@nongnu.org>; Wed, 13 Sep 2023 02:30:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694597450; x=1695202250; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jtT3ML1tHJnWRfmIXQrD6YCHmxZTPOtervgh4drQU7s=; b=wyNU+9QIuqMCKmLMuDVDitnZ9U2QI4gOrUOvDogfi5g/eXEY3JeqLu+i9+ey11C5gj 6Uzzhm02qLc8nq70C7SMk2Kb1oOencxz0rBgbVDtw5C8FpDt1mrVRKs7hZwUTrO+2wxh /Yb4+bJPtwb3SIKlxi2LC8Vm4uLp3SvijNkt3ltsSNWYZO1BpvoCn0+ADbe6EcHsSLsR frU82Q8MPNQUfa6MfzdQ+XFyCkgpX0EcWjPmnWRk02Yxig+t03P/NvGCnKdZqMPl1cZu kPED3u4zfpS1tvXN4M1l3h+Bn/RkJ/vIaC/oEPyyrn0s3HE3LALhyCSGLG7R4XN52cL+ 5kjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694597450; x=1695202250; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jtT3ML1tHJnWRfmIXQrD6YCHmxZTPOtervgh4drQU7s=; b=Ngl/74MDcxPDIb9luUwgdxI/VUkK8CMbsDyd642dHPDsEqojC8CEpKakvVMcdYnT2X Zg58L+KIe0bGFNDU4sbvg4YcEAvgmrfN7rXxQx/F2R/fLogQUDCDxCXOBoqJqVOsgGjf t4Mk73Ky7qWe6/rYSsfGfSa4dO30jy0ir29QsRZHP7SjXxhF4fFT7URpm326SfLPxEtb RGWmRsaGWNvarrX3LWaQe97wAH8iIUAUPyf3qo6513opfCxw3Bv6W95Iv0BaGvi4m/D3 d0HK6935xDYzFZiUi0e4BYkfqCL/7v8EpQXJdYjq40WTdJE2Y39XyMlJH82KqbFVHH5/ sdcA== X-Gm-Message-State: AOJu0Yy3j/eFCMdHItsap4RmuwRHjUQ5zqwXWVCWLmeQtnOrom22A7vy s9HkcJIejuQcPHWypVZrqXeEHuTjBj3C3sk6ad4= X-Received: by 2002:a7b:c397:0:b0:402:ea6f:e88f with SMTP id s23-20020a7bc397000000b00402ea6fe88fmr1496700wmj.5.1694597450118; Wed, 13 Sep 2023 02:30:50 -0700 (PDT) Received: from m1x-phil.lan (176-131-211-241.abo.bbox.fr. [176.131.211.241]) by smtp.gmail.com with ESMTPSA id l14-20020a1c790e000000b003fe4ca8decdsm1465100wme.31.2023.09.13.02.30.48 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 13 Sep 2023 02:30:49 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= <berrange@redhat.com>, kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, Michael Tokarev <mjt@tls.msk.ru>, Kevin Wolf <kwolf@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Daniel Henrique Barboza <dbarboza@ventanamicro.com>, Marcelo Tosatti <mtosatti@redhat.com>, =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= <philmd@linaro.org> Subject: [PATCH v5 6/6] target/i386: Prohibit target specific KVM prototypes on user emulation Date: Wed, 13 Sep 2023 11:30:08 +0200 Message-ID: <20230913093009.83520-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230913093009.83520-1-philmd@linaro.org> References: <20230913093009.83520-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=philmd@linaro.org; helo=mail-wm1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org |
Series |
target/i386: Restrict system-specific features from user emulation
|
expand
|
diff --git a/target/i386/kvm/kvm_i386.h b/target/i386/kvm/kvm_i386.h index 55d4e68c34..5ef73f0a1c 100644 --- a/target/i386/kvm/kvm_i386.h +++ b/target/i386/kvm/kvm_i386.h @@ -13,6 +13,10 @@ #include "sysemu/kvm.h" +#ifdef CONFIG_USER_ONLY +#error Cannot include kvm_i386.h from user emulation +#endif + #ifdef CONFIG_KVM #define kvm_pit_in_kernel() \ diff --git a/target/i386/cpu.c b/target/i386/cpu.c index c201ff26bd..db8ed6284d 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -26,7 +26,7 @@ #include "tcg/helper-tcg.h" #include "sysemu/reset.h" #include "sysemu/hvf.h" -#include "kvm/kvm_i386.h" +#include "sysemu/kvm.h" #include "sev.h" #include "qapi/error.h" #include "qemu/error-report.h" @@ -40,6 +40,7 @@ #include "exec/address-spaces.h" #include "hw/boards.h" #include "hw/i386/sgx-epc.h" +#include "kvm/kvm_i386.h" #endif #include "disas/capstone.h"
None of these target-specific prototypes should be used by user emulation. Remove their declaration there, so we get a compile failure if ever used (instead of having to deal with linker and its possible optimizations, such dead code removal). Suggested-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- target/i386/kvm/kvm_i386.h | 4 ++++ target/i386/cpu.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-)