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 17344802A5 for ; Tue, 6 Oct 2026 20:46:02 +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 696Kiebk027823; Tue, 6 Oct 2026 23:44:41 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 696Kiebk027823 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="uYj+9ume" 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 696Kic6Z027803 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Tue, 6 Oct 2026 23:44:38 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 696Kic6Z027803 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-48c6a1d4034so873669f8f.0 for ; Tue, 06 Oct 2026 13:44:38 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvBxo+JgGE54WnDyTS5bswY4dtysgw1sQlxNEwJu+/kglU8nxJO+vBsadQE377niki4+1JG5dFA==@openvz.org X-Gm-Message-State: AFq9FYLgnYX7z0NFaba9eGCg95S0ePm10BlLVUKObKxpgYH0lvpj+Ywl 4I70crqUbYeeeFu67b+QySZRcDRVwNayrdwg4cu27zsigwtKdLYKqEiAEjw/redu8Q6sUBGOgH4 adc4/B6A9Yg6XUr5+xL+GNTpRSHsVaq1ehwZ4JBMR7SxanFkJhv/vIg== X-Gm-Gg: AYBFou0rbXM7FfWnVuEhGC2ELhxgAH63LbNYcXr2EgbeI3t8z+XqAFBL8/FxhGt7e2u Ph3yPlpqR3bp5i5HFzC+KGiIMp72ZbTc9omqNUDPDRfEQtqjCmEzBY9COKscPZvkTaoh5ABgtlX Ohoo0AVJlCT9B1d68eSshpJ4jYAmNLRr6ltPw8yFRtzM5IZqoCIG/RPJRtgZUdvVz04SkiGYWq3 8oLcH/91binYzAP4dHLItgibN2+L8K/lniDaP8DnCxZS1rm7T4N95Sv9z5ms55EK2uDwYkMR/ya BoIKL9+0+ObQPT264+BI1VQDvWi7sF9smJdTm9UOb6EQF4pAcCrH4HzY14eqxJyUFNSNKfcmmXO EdR3LYDd4Gc0QrB4d X-Received: by 2002:a05:6000:2489:b0:48b:60d:2b28 with SMTP id ffacd0b85a97d-48c7288f27emr911025f8f.39.1791319478058; Tue, 06 Oct 2026 13:44:38 -0700 (PDT) X-Received: by 2002:a05:6000:2489:b0:48b:60d:2b28 with SMTP id ffacd0b85a97d-48c7288f27emr911005f8f.39.1791319477458; Tue, 06 Oct 2026 13:44:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1791319477; cv=none; d=google.com; s=arc-20260327; b=pzQYox7D8NM66cyYLUnCLFRgNfEptAMyMLnvEv6sE04RI6jnJLtgFSny3RYOQgiTgp /dY5TMVw/d/jv69fCH5MJtNsbZYyp2vyQUzqUD6Sw+THtwmU77eGNNGMkoLSAq/T3JtF 0ciA0LDjcPKbttFskh8BINIsOGw+JFxpQxEeaz9eMQvLNS9rCV3ZQrGsdRfOvCY9sqCx ZpEHrbAzI7P3T73S7EirNfE/j9nAIrj6sgAI10R5RLe9MFvR3Ry9deZWAEjiSRTujigA nQ1n/rTVBinndfVwZ15lR7UlunCRjPrYpjXhTmrQuvSaFp8h9bW3TTD29FILHfOO3fGd 3MQg== 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=qNBk/81+Q2j5TtcZ57BEwsgboqp9xg2kUYtICtxh7N0=; fh=bRkZfFa6377EgOVW8zBDri2gGIQqe/ZeiH+ijEM/ROI=; b=LGwQA2uz7P1qA7wYuZjdYfEa122A9RzWdbpsWyOtAv+grjHHpOvaT3pjtsJa3efTbx F3JQx2dE/jPY8R1rQGr8epgWPk2WvMA3svrqlaeGA2W1ZG+gV/FckPlH6htCdpoW6Pbm vMIgxuBHiTGkF84qfViGq/FCvSAS9OOPwi2WRDHpIhkAILJ3oXlsgUCALcBpZzZ+JABP /bLXhEBiHeIgeB5DG3uxlO9sLumn7B6Uwo4QYMFCC55In31kVNyJj32FlQ84RVzzuPTQ PWV2rizYGbfeCIbJuJvYVBfVaO4RNQC0dq2JtzkI6aIXoiHvPNN//KozWyCETvFw1ilN egKQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=uYj+9ume; 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-48c724b45d4si1167658f8f.423.2026.10.06.13.44.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Oct 2026 13:44:37 -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=uYj+9ume; 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=qNBk/81+Q2j5TtcZ57BEwsgboqp9xg2kUYtICtxh7N0=; b=uYj+9ume6wVbnvxqjme QHPQjIki/URrvhhj4D2zvGVCztc4n0prqWqPCY9PCwHtUDB3/h/vv07ghLDs46BchWhWlXVU0GrDa ZY4fTmqGI9s54LBS50eW9X5y3DQ0rl6A1TJ4yaW8erdwPAz0Gsuq3bRv4WDxedEys+Pk3xKypUd6/ hqXGLU0okZO/9mbUs0uBjrQrHgxMT7Ozy+svw/jYuuRsubrTNn37DHuW60d0C6Znyp0e1ZYeAlU2C /PW5xlUb00RXf5vuNg+wYzF6oACF3kfzP8H+ArjtQyioXIHPFOr5peSDPMf4lmIMYKoE0yXLMNlra Gz9LnmbCqGj5dYg==; 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 1xEByN-002tkg-27; Tue, 06 Oct 2026 22:44:26 +0200 From: Konstantin Khorenko Date: Tue, 06 Oct 2026 22:44:31 +0200 Message-Id: <20261006-b4-prep-khorenko-vstor-148656-cpuid-v3-0-16141b8ca07d@virtuozzo.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAK9dxWoC/52OQQ6CMBBFr2K6dkynhQquvIdxgaWV0UhJC41Cu LsFd+50+fPnvzcTC8aTCeywmZg3kQK5NgW53TDdVO3VANUpM8GFQs4VXDLovOng3jhv2ruDGHr nAbNC5Qp0N1ANVa7zspQGbSFZIqWBpedqObFGExQ7ZOdPEYbLzeh+cSynDS241/pPxHXwkzoic NhnqHhpM8tldYzk+8GNo9tp91itUfzBFYlrVY1YCr2vFf/mzvP8Bs7oIc5NAQAA 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=4886; i=khorenko@virtuozzo.com; h=from:subject:message-id; bh=aLJcC8OEU746NCL12k8Gxqd0671oqsxhzLAdC+R1g6I=; b=owEBbQKS/ZANAwAKAVGWCkf5YVwqAcsmYgBqxV2ybNQKS4KYDLsDgyJ2YmT40XNK3Qusr/m/D diB4RD6pRmJAjMEAAEKAB0WIQRWD23IPcXT0GO9CCxRlgpH+WFcKgUCasVdsgAKCRBRlgpH+WFc KiXTD/9Glgk7/iQ6yHSy1Neiv/fzUkJEIKijavDUFxkwp7nATHJ7eCo8x561+bL+AtoD7N/HuHv ANczRDoF0rpuLrODD//fs9Pw76IkQSc+JCFx+20JGhKy1hapHbVcKXIDqKq5/ucvHMFGSOcSVQF fipyHfPC/0N4dzKvo2ZPwRhzq8mkS/xIxkzGYvq6wkE2iMH5vMRAU70S0u6qEv5HE0bAMHvau8h Z3ysEUbWGfgwPnlmCf5tvAKVAlDbmKbk4QxdTk4EVMRWSDBK4v/ixU4I+Kv/W9JtuvFUmJBFaZo t/nzKXAawpqRtH28sZaJX9945zffo7GQtEkcj+weD/mTapBKZdqX81L+dxI2RSHRL5OCQkrdA93 raNiSP7v72ZrrecOT4q9+aPNgf/6NDzRhOIgD1qQjrpoObW+YIVVz0km1YfzDuitm8TV8/wdfjc cX57FUTaMgiHZfXKeL/AwPKckQDlj9dQe5dNaqnUaOsk+5JgUvYZNTNcOGlMN1MNFHIuPSPlAhA 5h4WyYP6YDgkA4Zm9UmM2UkJz3vbaHV5CEz40d+2vBzT69YN6bbMsPCWFhIgJykP5c8Us2YbhW+ eFyf4D1n//0UipLgtp3uZ9hlcgn0Ou/vim8f5F1OJ0iS2r++H69k77HIuepHLhE6GrzfhsVNglQ t3+l/rHMZDWehEg== 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 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 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 | 300 +++++++++++++++++++++ 7 files changed, 337 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