From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (unknown [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id 18256802A5 for ; Tue, 6 Oct 2026 20:46:13 +0000 (UTC) Received: from mail.openvz.org (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 696Kj01j027858; Tue, 6 Oct 2026 23:45:02 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 696Kj01j027858 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="WVJbnZpJ" Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 696Kid4X027817 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Tue, 6 Oct 2026 23:44:39 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 696Kid4X027817 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-4870142f030so2115722f8f.2 for ; Tue, 06 Oct 2026 13:44:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvBwNKeCIiEjeM6ASbWG7ItyDSiW44KYK2CVQIZAYdPjBi0+gllRyd6ClqMUPNq5sEc67KWwCTw==@openvz.org X-Gm-Message-State: AFq9FYI6y0XSzL56DmYo+IevMyUHCVlM2W4wXzLeEh2av0IVHy0OOgcz dtluGIK1DsRhB1RdTEipffgbGh04xJF2DKWIEDoRGNky/ivbBeXeYCRnkwUiK+Bzpr/Zc/ndkBm MCfJc9SOyKQo5088w7PbZcY23kry48+ME4GOC+7TMiqDvU+KHdEM3xg== X-Gm-Gg: AYBFou0sW3YxuBt0T49LH4Xs3u42oiNKuDKuRWKAZCm7KPV6t9vtG5md+uIswnt/XAg acLfghJJt/P8BWDoDroaMEZYTOchtw6qzcmWX9B8/YBR6Zhtp9TJarUCaKY+dE4/CHVkEc6BTfe 54Hlf/Fam+J0NagJ8s2ew/fb7r6Xuvimq3G732aYjbvjaCvz+AxC8DlQ8LYWTG1WPit1CfT/yOs oK9BUpMkxps5myEd0C3nD9l711XmMSaxe4W+i9kqoTI74Id7aSLbQJuIVekhXPSz8Xd/JkPJFmQ 3FSrBBaOIuYuEKLQkP3s0muI8kMHwVLIljfK69yiTPAfBZP4aUQ+GVdgwU3YEgtHEuZavTIDHqu 5wBs3E35PrzeqbRphMA== X-Received: by 2002:a05:6000:2912:b0:487:1256:ab80 with SMTP id ffacd0b85a97d-48c7288dbbcmr858759f8f.57.1791319478785; Tue, 06 Oct 2026 13:44:38 -0700 (PDT) X-Received: by 2002:a05:6000:2912:b0:487:1256:ab80 with SMTP id ffacd0b85a97d-48c7288dbbcmr858739f8f.57.1791319478237; Tue, 06 Oct 2026 13:44:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1791319478; cv=none; d=google.com; s=arc-20260327; b=KbmLzz2ilWUp17H9PN9IOi5yxzXCZ6MzO89SWnGR7MB2OKvpYjVTuaMP/VoII8n+FN dKc61UCt5SBvGEk36HszS6rQPO/P3lZ1B3M82ao6OXei3I5Zg9gk1tYCZnADXfLZtoji pSk+TBRbHCYeVhItPo6tCsIDS2ZWtqrRRjU176ap74aEjXfGXtU2ox6TtybzLRX4cc77 sLOrUAATXVumDuU/3yRaMDwhVwx8M+voDsBKzDIcLYqfiAAS4bL/OFPR4o0rMsw1Iaiz In8ND/MtZDgV1mjuqikjGCkRPXtxLuUp/EQsCsKQbrgFHHyqVhlHNi1mVyl6xdMN9k4Q 78gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:dkim-signature; bh=QPh+HS3iIuxW9UoppYF7Cfr1VuNyN7Vg/XYXcdw9soY=; fh=bRkZfFa6377EgOVW8zBDri2gGIQqe/ZeiH+ijEM/ROI=; b=btjcYcGBlRkUrXgbzpdcT2T7zRx88KhHnwDYq+10bWo/zsK/CJpUu1HcVc7fzcV3K4 mz/m4mXUBokjyUZrLmilGQFspHnWnG1NvqfHS0Il637Pq6vyDRkqYRHJjfiDmUdD1Vjs QoAdslMdpntBqiR24sp0jFITrNizNxa440YlYNjk7riThN3gcFoktz1O+mid4Lt1YZFk wSH68OtTPOk8GcxbBJdfChp4Jw2zQrYOMTq3Vn1cb1JDUHLd3kjVKrzxyBIpPwLonwW+ LJ+TEV5FjO20f7UpDQWhEic06+J/KbbaHW9fmH3gm6S47A4uqHZJs0Coux3Z5Tgn+m5L i9ZA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=WVJbnZpJ; spf=pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=khorenko@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: from relay.virtuozzo.com (relay.virtuozzo.com. [130.117.225.111]) by mx.google.com with ESMTPS id ffacd0b85a97d-48c724970ecsi1036310f8f.285.2026.10.06.13.44.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Oct 2026 13:44:38 -0700 (PDT) Received-SPF: pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) client-ip=130.117.225.111; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=WVJbnZpJ; spf=pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=khorenko@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=Message-Id:Content-Type:MIME-Version:Subject:Date :From; bh=QPh+HS3iIuxW9UoppYF7Cfr1VuNyN7Vg/XYXcdw9soY=; b=WVJbnZpJvoeoW+yThUZ RBhkKNXB9UFNKdaM43/Em7axbQ9d5bH9EHbZZmOiBZX+01MpB+MP9Uutk6elXNBYwxTD0R4qV6C+1 b4wxGCnKjsL0eDy2Xp+4RBCTaunGkNGxqM6jsOh8lXnnadqlUCubFvVK1719TG01nYXdVERSDk5q5 KlCN3qFeG96wGp7LPMfiN5Rl2aFNvlo2rzGG7QpeVXb98YR7qyfdjQtn7FPbKIfM0jnMgsu8gooyu bdlQEfeD/a5sTrWiqyEjf0O0ZcP45MkXVhNnDwTxdgZGETLbe8rE+EA6VbPgW/Em8JWCVJEDQYh+q QJ6cLDrfvoQm+TQ==; Received: from ch-demo-asa.virtuozzo.com ([130.117.225.8] helo=f0.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1xEByO-002tkg-2K; Tue, 06 Oct 2026 22:44:27 +0200 From: Konstantin Khorenko Date: Tue, 06 Oct 2026 22:44:36 +0200 MIME-Version: 1.0 Message-Id: <20261006-b4-prep-khorenko-vstor-148656-cpuid-v3-5-16141b8ca07d@virtuozzo.com> References: <20261006-b4-prep-khorenko-vstor-148656-cpuid-v3-0-16141b8ca07d@virtuozzo.com> In-Reply-To: <20261006-b4-prep-khorenko-vstor-148656-cpuid-v3-0-16141b8ca07d@virtuozzo.com> To: Pavel Tikhomirov , Vasileios Almpanis X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2349; i=khorenko@virtuozzo.com; h=from:subject:message-id; bh=8gQVn0FUfDNnSJNYx3G7eBWv0GwHbuUAPv8Dvjcfj8Y=; b=owEBbQKS/ZANAwAKAVGWCkf5YVwqAcsmYgBqxV20nOAoCItnJgGGPmiwE7KBnR2A6ZFBW4kMv U3RyVod/DyJAjMEAAEKAB0WIQRWD23IPcXT0GO9CCxRlgpH+WFcKgUCasVdtAAKCRBRlgpH+WFc KrGQD/9NcYGitWUJboOcnip4+TNn0kWpr4U8okOR5XlUuBT8awsSylUrq3ZX3DGsxRtw+HfYlYN 1RPiFQbN4bE8CLKs5eenxrgdk9zxVvJLGbvg9E3AJTzPoGJBL9sdBsVId1mhUA+RINHBUNSH2Zx 5ygavwz7cZOKpzBptU7OT3sNlF4AVR55R3TWg64SFvssOPbmkqHhANVFKvkMWxg7Nt8bhsmIUaW CVpCE46ZBthBfKCJ3m/3IV9uUIZw1E89jHyZZhKz5xAT80tKJP6XpSZKzR96zcFydoBLwPR3LDs vHkQWdFgBbHe3NdLwGm+Q+vtOgNKJJWS/RHuIcbuSET+sw6jabFxJJZzVi0hQHLRJPRcZdqpOEC i1l8Qs8NmNT88inliYvMGo6LhY8GeqyPUg+ZBAhHnviL8RDCJbRyuC4O+xaxyDu740s2r6KyR+q 3ZpsVZPq4foL/drrj5ql5N+WNGLkJOhcDG5CdFshImsto4UC0cqSFaz5pWkCEA1X4YxUaUXYE2W DgxKyFwPmolK0+EdOW5aoXuZOo5D3OQ48BM7uTAFQ0Ux2pxXsqO8ycNHTWRzDGJIgLOEcMrOZY0 /TP8BgUrA8AFGD/DO7S8dTV8TVmz4zg/DijC1xuqTkzhkQMc/0SBzU+K6rnWmj1ql1Z1qAhdlcR b9lyp7/h4MI+/9w== X-Developer-Key: i=khorenko@virtuozzo.com; a=openpgp; fpr=560F6DC83DC5D3D063BD082C51960A47F9615C2A X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.1 v3 5/5] selftests/ve: check CPUID override emulation for a prefixed CPUID X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org Execute CPUID with an operand-size prefix, which the CPU ignores, and expect the table values. Before the kernel change the #GP handler matched only the bare opcode and the child died with SIGSEGV. https://virtuozzo.atlassian.net/browse/VSTOR-148843 Feature: x86: cpu pools (cpuid override) Signed-off-by: Konstantin Khorenko --- .../testing/selftests/ve/ve_cpuid_override_test.c | 29 +++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/ve/ve_cpuid_override_test.c b/tools/testing/selftests/ve/ve_cpuid_override_test.c index 9d2d5ddd32201..6a18a180191c5 100644 --- a/tools/testing/selftests/ve/ve_cpuid_override_test.c +++ b/tools/testing/selftests/ve/ve_cpuid_override_test.c @@ -44,6 +44,14 @@ static void do_cpuid(unsigned int leaf, struct cpuid_regs *r) : "a" (leaf), "c" (0)); } +/* CPUID with an operand-size prefix, which the CPU accepts and ignores. */ +static void do_cpuid_prefixed(unsigned int leaf, struct cpuid_regs *r) +{ + asm volatile(".byte 0x66, 0x0f, 0xa2" + : "=a" (r->eax), "=b" (r->ebx), "=c" (r->ecx), "=d" (r->edx) + : "a" (leaf), "c" (0)); +} + static int write_cpuid_override(const char *table) { int fd, ret; @@ -66,6 +74,7 @@ static int write_cpuid_override(const char *table) struct child_ctx { int result_pipe[2]; int stop; + int prefixed; }; static int cpuid_child(struct child_ctx *ctx) @@ -79,7 +88,10 @@ static int cpuid_child(struct child_ctx *ctx) if (ctx->stop && raise(SIGSTOP)) return 22; - do_cpuid(CPUID_LEAF, &r); + if (ctx->prefixed) + do_cpuid_prefixed(CPUID_LEAF, &r); + else + do_cpuid(CPUID_LEAF, &r); if (write(ctx->result_pipe[1], &r, sizeof(r)) != sizeof(r)) return 24; @@ -270,4 +282,19 @@ TEST_F(ve_cpuid_override, armed_before_first_reschedule) } } +TEST_F(ve_cpuid_override, prefixed_cpuid_is_emulated) +{ + struct child_ctx ctx = { .stop = 1, .prefixed = 1 }; + struct cpuid_regs r; + pid_t pid; + + ASSERT_EQ(write_cpuid_override(self->table), 0); + + pid = spawn_cpuid_child(_metadata, self, &ctx); + resume_cpuid_child(_metadata, pid); + collect_cpuid_child(_metadata, self, &ctx, &r); + + EXPECT_EQ(r.edx, self->host.edx & ~self->bit); +} + TEST_HARNESS_MAIN -- 2.43.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel