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 89E2A802A7 for ; Tue, 6 Oct 2026 17:20:43 +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 696HJKGa026640; Tue, 6 Oct 2026 20:19:21 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 696HJKGa026640 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="C6ktooaC" 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 696HJJ1a026616 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Tue, 6 Oct 2026 20:19:19 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 696HJJ1a026616 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-487038bc9b8so2109613f8f.2 for ; Tue, 06 Oct 2026 10:19:19 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvBxdcfhbX+dzVNF+2FI3ay7NjLl2yI/u3Pb4unwZnnDPjuI/blS25F9PDNB1IQ6c39DxvPksig==@openvz.org X-Gm-Message-State: AFuF++k0L3o6hxkBUIZYr/hXrF5mkGiJstHzE18lE3Ev0ktYBJjG94WA eJrOqR0kjQDW+mJbgtL/NK2PVY3TbPWjQaYi3map4mSbk9rubbLmmmHpcfYniTv45WQx5ta5QOX wfr1bKVezi20DHKXYM8ky3GW51rtRPGj/vygWOyge02PxHLU77Z3/tA== X-Gm-Gg: AYBFou3kH45hxa6zywyT8RHQ20bu+8KB6sx1pPMsuqRSSSVgGhRKkjRUOs4u3e6UX/W SXEL74RdbEBRyI5oorJRA3xwIxAvBrmYskLRU+zp9KUSk1+N3gC1ZsFFtC1voXMMQo83L2W92vx z81kBZOn0yGYlHjlXt0OgSwHxKfKUX+RsEDqD0+skZ1kRYs8XT5K8qONMm82XJkGmWcJDypChq3 okOWVLtjNoTL2EEt2HeYFiOdfquNDaeVFVv/5QpHRVeBa9BHx4UK4wVOt+bMjrfaqB72oQB46OP rk/u7qj6xMCyR8RcLwfr4FEEdVuxvsuDLnpaby7adPBHbsJkKpJccTVIZmyyY6I7v5Wqm3RK0aX O98ETVAwPydtqw54q X-Received: by 2002:a05:600c:4fc8:b0:4a0:1efa:c74c with SMTP id 5b1f17b1804b1-4a17b537c46mr35356435e9.20.1791307158903; Tue, 06 Oct 2026 10:19:18 -0700 (PDT) X-Received: by 2002:a05:600c:4fc8:b0:4a0:1efa:c74c with SMTP id 5b1f17b1804b1-4a17b537c46mr35356065e9.20.1791307158325; Tue, 06 Oct 2026 10:19:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1791307158; cv=none; d=google.com; s=arc-20260327; b=PQVxzk3JSVA48om7w7G5zUB19vF2vKACEpWYhnWGKX63NiHp2BXXUt0Wmmv4EZ3oad VBxA8lHZGd2oSesArigng1DTzApZH9pO1fjfxTFyum3Qt7GCeGQHJ3EIyzZzIoFKga0U EkQzPXURJYi4mXXlNX12SemGOIHM8B2pKHcp5yGfKdRXoRWeWKYK2OHlU0F5fULDiQBs APzLOjXc82iyZC/+jdM4Kl2tSOm/cd1ukzWg/rv3bHUce/NwwtVTQMyBToRzgipxZiAv rsvOuOBDchoElyFkaOLZN9zDw//VJBu8aX1NDfoRIx5LOqyjHeMtJmhqZnsoGSooVWdF 8epA== 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=IUyiJEAHTjH8+tvR1rGFNNC5Olnk9rUlfErknadan+U=; fh=bRkZfFa6377EgOVW8zBDri2gGIQqe/ZeiH+ijEM/ROI=; b=aH7zYZTNwV9N7Dkg3MW3cGd42GfG+XvQ8Nm9+Ts8xNYpneFwCh3sAwBeel1MBq4/qk Q8Y8k/XfHEoWPImKh7czNnOxnHESeQqmiNrN8mBASi5IS2lGKy6cah7EbK12HW+BV6fx z+/8rUu657Bw3mJ41NocKG1cY2OZHkpXgiKqZlodbFC8VrjJ7X/38a1HkkUySKUsOWnI wqFsZMtHrGUk8510CVXbzfmdS3LCTM9dccesxkpkM4TO1epEgJow7uvHVValiqU5ZV+F xJgG7zjNgDVoArw4eYvTqFbmvS6nviDdPmso0QipCzMkCkYXDgtdm/6bd7ZS8pF9DTdA onjg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=C6ktooaC; 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-48c724bda77si438489f8f.471.2026.10.06.10.19.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Oct 2026 10:19:18 -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=C6ktooaC; 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=IUyiJEAHTjH8+tvR1rGFNNC5Olnk9rUlfErknadan+U=; b=C6ktooaCCjrvLoDV+en EhCXR6ZLmFc9YFB1f6+eYPw+R4v/V1PhYgxJa2DWXOAutIwcqASHmYyhn30wArtW7kBT3KRzYsApK PGQuE8ZCzd1zUUWiPV4kXKTYS0/l4fiLV0q2ECAtjPxnwxCotQCmEEMjolnm0qgb/aowiEnKkn5aU UEIgtxWCsWS2j0Qq1NL+P4VtgcQe2s7QDzHoNZJhUP5sf0gxf/yn5xKUZSmTyErM8diALjBo/drAt qR7T9eeZal7tZXhx9KFl5gZSCSqHDuwXa+5PEFXFFWMG3WGk0aDIjLejhdkolm/2uAFftdpai4lGE jhUhLbhnp8mjOdw==; 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 1xE8lg-00GXnn-2Z; Tue, 06 Oct 2026 19:19:07 +0200 From: Konstantin Khorenko Date: Tue, 06 Oct 2026 19:19:09 +0200 Message-Id: <20261006-b4-prep-khorenko-vstor-148656-cpuid-v2-0-f6d1192c7d60@virtuozzo.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAI0txWoC/5WOTQ6CMBCFr0Jm7ZAWSgVX3sOwgNLKaKSkhUYh3 N2CJ3D58n6+t4LXjrSHS7KC04E82SGK7JSA6pvhrpG6qCFjmeSMSWwFjk6P+Oyt08PTYvCTdch FKQuJapypw6ZQRVXlmpsyh7gUC4beB+UGvSIsUw71z/Bz+9Bq2hl7tKd97nP8Cfwo/IUOHBmeB ZesMsKwvLkGctNsl8Wmyr6g3rbtC/t2Kbf1AAAA 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=4255; i=khorenko@virtuozzo.com; h=from:subject:message-id; bh=jN/xuiv03frQ0EHVZzzSHSlDtvYRO7j4D7RB7QFrm1w=; b=kA0DAAoBUZYKR/lhXCoByyZiAGrFLZOj15CUFreBGW6tLqqZYfKYu8iUbaHQX493hSTx4LR0X IkCMwQAAQoAHRYhBFYPbcg9xdPQY70ILFGWCkf5YVwqBQJqxS2TAAoJEFGWCkf5YVwqHiQP/3t1 xdpxGmfOP0onnkxQEsbT5/Ah+bn0uLD/bMbeepnMfch9trZojsjAognLGRukzs6BU7QB9MGKG39 Nu0pQQN1IVFSMM2+hxZL4pegXt9rJ0QCIE1dLwG3CybCYMPrtT9pgbENQKWb7VCdNemfRITOOOk qVjuK8Pq0rjwiSB/CRm+xa3juKXrVLoogvUrGCdcG1bbCtoBMqmfN/6Yr9fYXL/H/oBZQzQDxOf BlsQcNuqy8n0bKJI4gXKfJ5vx7bPWLtXzaqU2AX86RMoytDKBbClLyARmf31D9Yn6dFyp3uFjx7 FrEbKssJzGnk9suqJlpPGSdFwV7H4xLrMydcKkli8u2o5dUXZIbKLyy9AiiiHJFZgQPJCkzFvZ3 3Wd+GkFvm7HOBZ7WUVvY9QPcAg6U0G/KS0SG4Ud8wMFlnHuLWGHU3jmBF8CEhf5sRaypeyK3eXK tEI2idbhCvDhwDh2RHY6UIYX86CvSRstN/DK4VxZUu6n3FL4/Ci6KMg68fixnf3PDqKO8nnk1nT GgxpB9W7iGn8WeP0lE9swh5leNhuyoE25RQDHp12I539saF6RK9aEd2tb3FKNlsXo30FWujt0DD JUEQ4uqk0cDTApVE924Ndup6Oruy17VKYJBhISe0H7mlF4V5q4E1ZJCTwAZiujxZIORDvoQ71RY dW/Cw 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 v2 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 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; the table snapshot buffer fits the largest table the kernel prints and a truncated read fails the setup; 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 | 7 + .../testing/selftests/ve/ve_cpuid_override_test.c | 291 +++++++++++++++++++++ 7 files changed, 325 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