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 C968780726 for ; Wed, 7 Oct 2026 11:58:44 +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 697BvUnh004379; Wed, 7 Oct 2026 14:57:31 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 697BvUnh004379 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="iLwfQNTa" Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 697Bv98C004339 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Wed, 7 Oct 2026 14:57:09 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 697Bv98C004339 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-486f9d150c3so2271735f8f.3 for ; Wed, 07 Oct 2026 04:57:09 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvBxV0Ti1rc7Qz8zMKb0KnGHuJ5ZNVvrjg6amfEm7lLzZqjiHdFo8poTbM6LHyp/DXqy71823xQ==@openvz.org X-Gm-Message-State: AFq9FYId2wOuilYN1aRCmKFM1c+3fYW8AHR/Bm+hx6QzBFs+Cz46+4dd uFCKWPNPKO4k70hUe6OKf3KkOoygNIBFRPhyREi2+MtxyPF2BYTabTVXm2kT7JvA7hMrTlPoUCT TorFfO2kWu7KzF9nnuS1cKgCrTIH7acIfkeshfps8eSVXBnI+FsnX6Q== X-Gm-Gg: AYBFou1L/rhrN6mRixResgJLFv01cOF3w6SGdyOBmE3FW4U0PiLuCjhvg7Zcrk/+yUH 8WKFtwi7vsAlm2ZXfCewLg0VqJ8tX+7HXnF4g/OYziMzVPkJGrdEJG8qE4/xhXTdYcDYCWAqKJM mGzCegeyiGxvSDFq0fBjIrgj2wOrjsxYpiswr2jIYce3RuVHhsLmrIDyi5+yHyECj1UoiSf+ZdT W7QrhCBdAPb1a8dTNjP8UtPMA34vcZSTJTcNCzs/JYJyqKpIhNX8WA+V57eIIZfvjiFAAwAaGPS 9xQ+X/sbpr/TAy7Xn6MIfGL0KO8RF+Kg6cDSsq+mj2jX2ljjx3v+gaU0AsWBilF66rSql6brjMk sYIRPXX9OH8KoHSoorw== X-Received: by 2002:a05:6000:178f:b0:48c:4f83:f42f with SMTP id ffacd0b85a97d-48c72703262mr3475486f8f.8.1791374229344; Wed, 07 Oct 2026 04:57:09 -0700 (PDT) X-Received: by 2002:a05:6000:178f:b0:48c:4f83:f42f with SMTP id ffacd0b85a97d-48c72703262mr3475440f8f.8.1791374228530; Wed, 07 Oct 2026 04:57:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1791374228; cv=none; d=google.com; s=arc-20260327; b=rjqbsHaGBO2DP/soP7kFFCGp6ydwm/0KHCrEqiHokNKJo+au42AN9ihWjfEGMUbi/y 86bzyB9KozdSLnUAvcMnJvzFcmB7Bemj57HuhcFYcBsNfceEfsJ3gxFedYDJrVuzAQ1X tgBk7dkNrXFF8QhICLcPQyOvEtovKzp8e3eeN9ZRLfqgbsB5tWlG9TJk46RIaTCcxQsi xOKTUB0M5CqZousLWke6t1v1AWt446xV8JyhLqc6xMyTs/+bwwej7Zhl4oQA1SkQqlrk eWZH0yxXJgUDxfPrZGDqilcPaQlfTB4YjHg40JM79Y8LQ0IYRlGqNpIjtZbDiW4dwNcb rIMA== 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=SdC1QWT4pxSwkzGluqUt5eIgjMju98FGS5JLIG8E1q4=; fh=bRkZfFa6377EgOVW8zBDri2gGIQqe/ZeiH+ijEM/ROI=; b=GIAVazrspps0OB8bsq42fg2z4CdDeIudA/iUQvXie4UPkij3EeoaW/DUmHJx0gK0Zo oGAstaAlTNvmjFFpfuOLzBrUWiMgUjtfQ1kyFmLl85mREzBcoaPI43qCAq7sDZx8bw6a f/Bsvm+EG+QpEFViMhBd4Q19FhldJKNPrBPYQPLonp6WeXii35hvJpnzQvy8SMreNuPs aoT+VnNC6j3UL8MjVHFi3GRaRD5zUIiaPe+t+qYpZv4cYPVRDhWOc4zuC323kCFqvVYn aBRKhhY6rlCEYCxc1CQh44us6Ws8P258wH/dsEWN85ERTAhUUav76JCo0Xx1rgedwxpH rnTA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=iLwfQNTa; 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-48c721338c8si4331213f8f.6.2026.10.07.04.57.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Oct 2026 04:57:08 -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=iLwfQNTa; 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=SdC1QWT4pxSwkzGluqUt5eIgjMju98FGS5JLIG8E1q4=; b=iLwfQNTaan4z8oESPrf d38wZnpRgp7g7KS7/NkLNfAMX1Lp5Uo+3p3Mh7WHN7N4XwJlfEExfugkXOVEtjDrgq3JRCw/5FaBx y46jKMT+HbUhCbW/f1WgbB/k+VSLcAq8TqksyB/VyTHNr+MoZwwfwYaBILTIae2i4/9mG4IwNIxHT YCsPEVQlkrDOnDhf2qyRWFNXiam978mM7ZgJrzF+QM9IyI7UpApiJT/Y62nbci/51Iy27TGZE5jE/ RdGlIbbZhAiZ3J43TS9HScvfBvzKTo1MmPOdHFcIVM7wk5Cr0aSFSt4zmW2S1RjvJNuYhAWaS1vkf LG+1wDm5MuJK4vw==; 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 1xEQDS-002m3X-0D; Wed, 07 Oct 2026 13:57:07 +0200 From: Konstantin Khorenko Date: Wed, 07 Oct 2026 13:57:06 +0200 MIME-Version: 1.0 Message-Id: <20261007-b4-prep-khorenko-vstor-148656-cpuid-v6-5-a8eb906e69b8@virtuozzo.com> References: <20261007-b4-prep-khorenko-vstor-148656-cpuid-v6-0-a8eb906e69b8@virtuozzo.com> In-Reply-To: <20261007-b4-prep-khorenko-vstor-148656-cpuid-v6-0-a8eb906e69b8@virtuozzo.com> To: Pavel Tikhomirov , Vasileios Almpanis X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2485; i=khorenko@virtuozzo.com; h=from:subject:message-id; bh=Rj3RnjgyF6asnkpLKXvdM2Nor2aoFYgJC6RAnIBPkyM=; b=owEBbQKS/ZANAwAKAVGWCkf5YVwqAcsmYgBqxjOSE1kyplrqa8XAMAdA8OYB5dPsatzRgpXeh V+0M4/R0oyJAjMEAAEKAB0WIQRWD23IPcXT0GO9CCxRlgpH+WFcKgUCasYzkgAKCRBRlgpH+WFc KpPZEACLEUhwhLf9QNtkicRgXQSduHYJJ9XdDwn5c6uFpSdP2PzO/cRdJ3Ig2NBB/+Oj4XkPKlc xxGf4lbX18fwEaF2SiJS5+vcE3A+4+mYG0bWw0O9tGQPIpxmTR43WpGBnTiwrqY6jCgtxgSC/fP BrUmBw8b/Di2J/5ng/e17zOwvkKe1fL+f7/vfutOZHcOdMvkTLJ4AkZzege7YU3AZC4+toll51Q ggqRAX53qrs3OqaMfn3gDeIySduZKxdsXkVBIBi9fYat7Md2yxbIn7z1DCDNPR70OHBXDmdYtTZ GwB0pKoGZ2f2MpZzRtgx6v0n8B/KGDu8dG9QGat9fzcdL64HPQSCmPt+1Va02YBd7Im9qTsRqmT fdJF1l2fg9fY62FinE/uaxuL/v8LVw0Qzx8cydv+Y1UAPZ1iDN85bOafN0/pX6MSYQ5n8gIOE0T 0650HVuW1mZZ+F43NkxJ8HH3kfngMSZ/H7uprgS8Lz3TAfLjk8OnYyfz7GUNCY0u7MM+gaCuqlW cdpLhHA9dIUAuLNgT9fVPFV03xTvTlr9pb3nOK7i5YZ8gWocccaxNXeA7/V/2d7fAheWw5VzCfy 4gciT619qFmZVvs1qkad59EczgfWOmko5dSpnwYaF5Q58YV+R1eLc4gaZ1qZYjRJJmiKm1x5zES eR6RwvAJ4RodGlw== 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 v6 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 | 30 +++++++++++++++++++++- 1 file changed, 29 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 f6a6325e4b42d..b9f5e49d6c437 100644 --- a/tools/testing/selftests/ve/ve_cpuid_override_test.c +++ b/tools/testing/selftests/ve/ve_cpuid_override_test.c @@ -47,6 +47,15 @@ static void do_cpuid(unsigned int leaf, struct cpuid_regs *r) __cpuid_count(leaf, 0, r->eax, r->ebx, r->ecx, r->edx); } +/* CPUID with an operand-size prefix, which the CPU accepts and ignores. */ +static void do_cpuid_prefixed(unsigned int leaf, struct cpuid_regs *r) +{ + /* An x86-64 only build, see the Makefile: ebx is not the PIC base. */ + asm volatile(".byte 0x66, 0x0f, 0xa2" + : "=a" (r->eax), "=b" (r->ebx), "=c" (r->ecx), "=d" (r->edx) + : "a" (leaf), "c" (0)); +} + /* Voluntary context switches of a task, from its /proc status file. */ static int read_nvcsw(const char *status, unsigned long *nvcsw) { @@ -63,6 +72,7 @@ static int read_nvcsw(const char *status, unsigned long *nvcsw) struct child_ctx { int result_pipe[2]; int stop; + int prefixed; }; /* @@ -92,7 +102,10 @@ static int cpuid_child(struct child_ctx *ctx) return 24; } - 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 25; @@ -326,4 +339,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_file_at(AT_FDCWD, CPUID_OVERRIDE_PATH, 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