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 57FA380726 for ; Tue, 6 Oct 2026 22:14:16 +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 696MD1ps028340; Wed, 7 Oct 2026 01:13:01 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 696MD1ps028340 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="bgPj1o52" 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 696MCxvB028316 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Wed, 7 Oct 2026 01:12:59 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 696MCxvB028316 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-48b02e93a1eso3001318f8f.1 for ; Tue, 06 Oct 2026 15:12:59 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvBwr1Q+rEEXSPMzWyhrNkLa1uhsl2MCDyOZBUSnkbQpOVmz98dQMBW0KNFHYXGGBkJTNcKui0A==@openvz.org X-Gm-Message-State: AFq9FYJM4vGyufo8g86ANwx2GMacCosWNa5XO/gUvoq7ZQIgfS2PBa+X n0kUoUpGO38L8hy7geQPUW4jz/gceSRWlLSBATSVsPPkvTDI53t/bgig8xXvtcekg1dEbV/NAep Qafg0QsXZIni5bK+cIx/Cwr5Qt7XdNccaOCpHVz9aM7UhB2pn7orY+A== X-Gm-Gg: AYBFou0TJEWvt3L8MSMa003JPKVh43ndS2adE6zmyrb+h6frDZJcho1K4WuRZTTlVqT 2XL+XqY2OFtAuRsxY9k9umq9YtboTE004/Lv9aZkWVVCKRAWm64dGJdxyZ2xnDE/PUpGbaeScOR jqVZzsnYtTvkEvW/XsN3wKc4R5E+wTwQvSwfPjoi7N0Ive8p0YSbrPCm6M4P7AMsTBR2Q7ZdYHe pdwWSUeFwhAjDA0U9bAfy9y795g1MtouefVx7kIczkNKy/WrIjeslJnmgT8oeLfvW8qe98xQYEA PZ4xz7NBDQR5/PFsBIlyC/LDxrAzttqagXc94+z/DaCOzC2JAVMV5DTBLhwsDXPgczDUdMtNSIN FdalJWZ1bEURB+9g8CQ== X-Received: by 2002:a5d:5f85:0:b0:48b:e50:714e with SMTP id ffacd0b85a97d-48c7288f2aamr899792f8f.36.1791324779119; Tue, 06 Oct 2026 15:12:59 -0700 (PDT) X-Received: by 2002:a5d:5f85:0:b0:48b:e50:714e with SMTP id ffacd0b85a97d-48c7288f2aamr899773f8f.36.1791324778608; Tue, 06 Oct 2026 15:12:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1791324778; cv=none; d=google.com; s=arc-20260327; b=dNc2N92lZlNyOmE5PR6VPM8Yzknpc9zBfHGy2BYZBF1w6TO8QtVhOqgaECydRyw9z/ 0vWOYTCmdx3AnS31Nm3D7b1z3OEl8BOFlVY4VLJ7gGSTTIIGDpah9Xk/i6YnzC8fmcvg k0EFAzTRVYfQrXxFOOare0gL43au9wfymtWvQb6ocjkHEmhaX0Nd+XztUusOj4zz2jqL No7UKdbZsMreOjryxdwn5R34FUq5Bf0/rGAr4w0vI19rTlav6/EH/NY1qbxGdTk76c7R UHVDkasGScVpQBLlzu1HSQEw7JnMGPsoZ+DOkYNJ28vYDaODuW6FbTRlRK/h60XWnjU6 bA8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:dkim-signature; bh=kTqC5qT/87/qjTSATND4cTTkVV+ENY0utM3shMSAHPY=; fh=bRkZfFa6377EgOVW8zBDri2gGIQqe/ZeiH+ijEM/ROI=; b=YVvqZTIlvd1XAP2Z/wrHOYsKT+w2xdepMBY4qIYQxbmwVz+QUH0zY/WThFfSTL9JBo 0gHy1ad8XE9ovVQaJl6tZiwVUAEEwCNMkZhHn92UHhaoFpRZY3NKowXYIBUcCk1Rlv8Q gdP+RBovzknJ8i2sNEiE8qJXvflAIQ+aNfrp/bajzrun9ELHnBIgso88P9YWAabKwjPe UPeBR/EDdBLw27on2n+/XXH4wyJQCBdh+X5kFE7nNzlbMOIynRkKuMfJm+63pHvVljk/ wu7VsAiYg94KCGwG1q+nBhLKcZ3lKANJ494v0D6tGuevnsn3eOC6mVbsgtVxu037a/Dt P8Gw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=bgPj1o52; 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-48c7247295bsi1345618f8f.153.2026.10.06.15.12.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Oct 2026 15:12:58 -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=bgPj1o52; 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=Content-Type:MIME-Version:Message-Id:Date:Subject :From; bh=kTqC5qT/87/qjTSATND4cTTkVV+ENY0utM3shMSAHPY=; b=bgPj1o52h5X/lrseuNU ADznc3RbSl36kXSyrMtjPyX4SV64i/4Psx213Ai//ihwl3uSd6cqGNXLIGsevBGIO3ElMvunYO0w8 jgY0GomNKjqi1V2g5gblT7Ii6Yzhhs32HbVUjkwdrg4l/s6DWnq9OY4//Wu7YK1C3UyeWQMQ1vpG0 GCGni+tdA79wTTvVljyNZcAv+YzC0lDu5w24Rn5Qmaue3CbGke/ESsfeyYYjHtPRhuVcmH/x9G9KA FHZHLtjPufnICKDWPaIff6dco+3Umj9DWYRiSnPGhs5++UZLQaR/yFq+kXay7uSmnhwthyDZ6H2U7 TcM1LklF/AfTonA==; 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 1xEDLs-004aGG-2Z; Wed, 07 Oct 2026 00:12:47 +0200 From: Konstantin Khorenko Date: Wed, 07 Oct 2026 00:12:50 +0200 Message-Id: <20261007-b4-prep-khorenko-vstor-148656-cpuid-v4-0-bf16c29bea24@virtuozzo.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAGJyxWoC/53OTW6DMBAF4KtEXncij20MZJV7RF2Af8o0KkY2W G0i7l5DdlE3zXI08743d5ZcJJfY6XBn0WVKFMYyqLcDM0M3fjggW2YmuNDIuYZewRTdBNchRDd eA+Q0hwioGl1pMNNCFrrKVG0rHfpGsiKVgKfvveXCBkPQHJG9PxZp6T+dmbeO7XSgjfvZ/8m4B /5VnRE41Ao1b73yXHbnTHFewu0WjiZ87a1ZvOCK4nptEVthaqv5X658wZXFRY0K+8Z0vLbP7rq uv/ifo86lAQAA X-Change-ID: 20261006-b4-prep-khorenko-vstor-148656-cpuid-a5c5993e1f83 To: Pavel Tikhomirov , Vasileios Almpanis X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=6206; i=khorenko@virtuozzo.com; h=from:subject:message-id; bh=CmobnWBfHF4yxILK6YY787WAPAvP7m3yqp0WmIbEl60=; b=owEBbQKS/ZANAwAKAVGWCkf5YVwqAcsmYgBqxXJmBDP37ciyV6ARuK3GsRF2e7I2ksziEL7pS wlfWOod0saJAjMEAAEKAB0WIQRWD23IPcXT0GO9CCxRlgpH+WFcKgUCasVyZgAKCRBRlgpH+WFc KrojEACkDEyFcfcZyzYvx8tqn4CcY36UXzxxS5x18ED0rlaJZNljI7MLiAt26G17vXU6ev+4mPE kXUZm1nye2Hv9sYVZWX2eLVnasQCnit1DPSncDWgXLhFp5ovWLlsjfOAtv5EIKqhnRJPPa78Xj3 +QCV87E6Zsw5mCjQHZtvBLv42PVYPVo2L2uatdl1O5cFb2B1Z50LcCBa/4TEDZnnx8DgKI/kEry tb3boZifMW4HRSRHI+26AwiNKVXDD2bI/uq+EMYPFbDtK1lptx+jPE6RiGGc4VRx1FH4Q5BNW5Y ATynMuJFoJbz1N1bKrE4odpENnrEznMWtIO8ns/8S1jOrXa2DPKqFkwDS85fCqBD9+WzlZ4IjPd p3vHgpfH2eFk7SW+BTW/WfyZhUzswg1wkUGkM52zXSv58fGn5RpEcMOp3kvkc3GQN9Evy28PfZF tTjGAvl5LWbyW6lo/jdKikeM8sjoC97OjLHe/OdSFZfyCPIo5shKA6prgQ847yk0KDaglL0/Uz0 J2ZTduuNq2SikbtfMrJRDDv4IJDP5euO+EcekyosU1OcR22qwkye+iNSiievBy2UkhUb5L/nMPC gQ0ekLxZqci1rW9cc1lvpEJKZBLUUmgRe+hD15Z6J9pEOnjFxjBSbUsLKiu2i7xs86RheCZ9Uqm ybmpGcpR3lhDJHQ== 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 v4 0/5] x86/ve: CPUID override follow-ups: arm at once, prefixes, selftests 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 VSTOR-148656, every Container start dying with SIGSEGV once /proc/vz/cpuid_override is non-empty, is fixed in 22.8 by 07338fbae5a3 ("x86/traps: emulate CPUID faults for user tasks in exc_general_protection()"). Working on it turned up two more defects in the same feature, and the fact that nothing had ever exercised it. This series takes care of those. None of them is a 22.x regression, all have been there since the vz9 port. Patch 2: ve_setup_task() only sets TIF_CPUID_OVERRIDE, the MSR follows at the next context switch. A task entering a VE through unshare() or setns() executes CPUID natively until it is scheduled out and sees the host values. set_cpuid_override() flips the MSR synchronously for the current task, the way disable_cpuid() does. Patch 4: check_cpuid_fault() compares two bytes at ip with 0f a2. A CPUID with a legacy or REX prefix faults the same way, but the handler sees the prefix and the task gets SIGSEGV. Use the instruction decoder, as fixup_umip_exception() does, and advance ip by the decoded length. Patches 1, 3, 5: selftests/ve/ve_cpuid_override_test. Each kernel patch gets its own case. The test saves and restores the table around every case and tears down in the parent, because the kselftest harness skips a child-side teardown after a failed ASSERT. Tested on sqvm2-4060, the node of the failing CI run (Broadwell VM with cpuid_fault, cpupools-features 9.1.7, so the table is armed at every Container start). With only the 22.8 fix, cases 3 and 4 fail the way their patches describe: host values, and a child killed by signal 11. With the whole series all four cases pass, repeatedly and on a non-empty table, and the vzctl-pytest start cases from the original ticket pass as well. https://virtuozzo.atlassian.net/browse/VSTOR-148843 Signed-off-by: Konstantin Khorenko --- Changes in v4: - Patch 1: a child that exits before stopping is reaped by the ready wait, so its pid is cleared there and the teardown cannot kill a reused pid (Sashiko). - Patch 1: spawn leaves the VE cgroup before any ASSERT can fire, so a failed fork() no longer leaves the cgroup behind; a child killed before it stops is logged; the teardown is described as running in whichever process survives the ASSERT, the harness does not run it in the parent on that path (independent review). - Patch 1: use write_file_at() instead of a private copy, renumber the child exit codes, say "at least" in the too-large table message. - Patch 1: record the child pid right after fork(), so a child left stopped by an ASSERT between fork() and the cgroup move is still killed; say that a harness timeout leaves the test table in place and that the second case proves nothing without the first (independent review). - Patch 1: name the fix the tests detect, describe the host-side and fallback checks as the one masked bit they are, log errno when the table read or the cgroup2 mount fails, rename the two table buffers apart, -Wextra clean (independent review). - Link to v3: http://lore.virtuozzo.com/20261006-b4-prep-khorenko-vstor-148656-cpuid-v3-0-16141b8ca07d@virtuozzo.com Changes in v3: - Patch 1: a saved table the kernel cannot take back in one write (a page or more as printed) fails the setup instead of being silently left behind by a failed restore; writes replace the table, so there is no way to restore it in pieces (Sashiko). - Patch 1: the child pid lives in the fixture and the parent-side teardown kills a child that a failed ASSERT left stopped in the VE cgroup, otherwise destroy_ve() fails with EBUSY (Sashiko). - Patch 1: the Makefile keeps ARCH untouched and decides on a private variable, lib.mk picks the clang target by ARCH being empty (Sashiko). - Link to v2: http://lore.virtuozzo.com/20261006-b4-prep-khorenko-vstor-148656-cpuid-v2-0-f6d1192c7d60@virtuozzo.com Changes in v2: - Patch 1: the child stops itself with SIGSTOP after entering the VE and the parent resumes it, so faulting is armed by a real context switch; the pipe handshake, whose read could return without sleeping, is gone (Sashiko). - Patch 1: setup creates the VE cgroup last, so a failed ASSERT in setup leaves nothing behind; a failed restore in teardown is logged (Sashiko). - Patch 1: drop the EAX comparison after the fallback to hardware, the child is not pinned and hybrid CPUs may differ per core (Sashiko). - Patch 1: build the test on x86 only, add the binary to .gitignore (Sashiko). - Patch 3: the no-reschedule case repeats the sequence, a tick can still preempt the child in the window; with the handshake gone a child that dies before reporting is reaped where the result is read and its signal logged (Sashiko). - Retested on sqvm2-2084 with the whole series: all cases pass and the table is restored; on sqvm2-4060 with the stock kernel all cases fail with the expected diagnostics. - Link to v1: http://lore.virtuozzo.com/20261006-b4-prep-khorenko-vstor-148656-cpuid-v1-0-741609f4f03a@virtuozzo.com --- Konstantin Khorenko (5): selftests/ve: check CPUID override emulation for VE tasks x86/ve: enable CPUID faulting at once when the current task enters a VE selftests/ve: check CPUID override right after entering a VE x86/traps: decode the faulting CPUID with the instruction decoder selftests/ve: check CPUID override emulation for a prefixed CPUID arch/x86/kernel/process.c | 12 + arch/x86/kernel/traps.c | 16 +- include/linux/cpuid_override.h | 3 + kernel/ve/ve.c | 2 +- tools/testing/selftests/ve/.gitignore | 1 + tools/testing/selftests/ve/Makefile | 10 + .../testing/selftests/ve/ve_cpuid_override_test.c | 302 +++++++++++++++++++++ 7 files changed, 339 insertions(+), 7 deletions(-) --- base-commit: f5d1fdcfffe101fe2bafa7df09d95d2e811c5c5e change-id: 20261006-b4-prep-khorenko-vstor-148656-cpuid-a5c5993e1f83 Best regards, -- Konstantin Khorenko _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel