From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (mail.openvz.org [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id 05A4F8002A for ; Thu, 26 Nov 2026 06:08:03 +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 6AQ66gTE005096; Thu, 26 Nov 2026 09:06:43 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AQ66gTE005096 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="onIG4kCa" Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AQ66fb6005082 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Thu, 26 Nov 2026 09:06:41 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AQ66fb6005082 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-c429d9d05f0so604327966b.1 for ; Wed, 25 Nov 2026 22:06:41 -0800 (PST) X-Gm-Message-State: APuU4Z/Oew7WtziuaSm6RtBlcC9KiSDAbGRrHQK8KIl2arHS9LXqVSv3 +vxzamqjKZ1YB0MQai+Oj1L5m7OsR45U9l+k3VEdJflwjnO+een8/WNJraL1TWaRoF91Y2H73gA TJef0LcqnV+40ajIyU6ePfFaIPZuNRRm+GFgCW6Aa4hrlyG8cmLl4ag== X-Gm-Gg: AZFdTZfIlmcE3TyOuf5akdLPeBtC3qBz4du9RFt/MxF+oWooHwRrvC7w+3oXeyfF2MX Bv6V96JrYyH671G9ao2htxe86nw0Ngzxq/J0T5xyXnBZK/uImnyaxyOgLdeK+gCrfqYpctapf+e XmcmdDEg4z0faSAEsZYZayyLdHfQsPgo2U/3m4c8s8N9+IsFSimI4HN9WC1QFBJIbO7NEmeRoCQ hHf2XLG/5DjlZS762743h2WHt4ZFzajEus3hMxR9t/mSYyGgzS+KdnOTMlOkdQ9sqkBuNRoODCh 4P7WuZ3wuBImjgn83+ljNQe4MSTQfXqHK6QzMlp5+WofVQFhtf2dIgevOr8iKM+kWOzy8HOpf0R SUHJ/DWF6zjr+POHxrobQ+//SGQ== X-Received: by 2002:a17:906:1310:b0:c31:8984:7fad with SMTP id a640c23a62f3a-c513a999e32mr1344056566b.15.1795673201306; Wed, 25 Nov 2026 22:06:41 -0800 (PST) X-Received: by 2002:a17:906:1310:b0:c31:8984:7fad with SMTP id a640c23a62f3a-c513a999e32mr1344054966b.15.1795673200767; Wed, 25 Nov 2026 22:06:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1795673200; cv=none; d=google.com; s=arc-20260327; b=BoNPaaXcblvPROoTO4Nq+16xz874LY+pw9VDeDkarOD+abf7T6v8Cw1AziBit2BBUj xQyNuURm68vHBmq6Uiz2KP3/CrY2fPoKTlwth1omo3xS0zij+SnDlR7bTAtq9yPEBLTT pkndFjRwAbRavyuwetgk0kpl1w8TQWll/FaBpChGUNzubXqkjFDRbCuB+evpjEb9hHfT XuYD4dE6DiqXE+8mVNmYZjxlsxQBKhzUcCtJQYtSewtN0is/WXLW2lqpnceJQuVD6itP 987dXomLaN+Q0R/reafSPdklCqVfQuAtfcYZWZRaYFj25+d4Sy8qANl7eE1hMXM0+V+l cATw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=Tkgq1LZtsEhQGQtYqHxGtq/lM6Y5iqBm+2rqk7hC4pI=; fh=/QSWnKFFIPNLStgUoDwCQRaXnWcMIG7fyKJgHY+VEpU=; b=GKhnj3fHjPMaSbLfLTJje0t/5ExtnFEcly8fKTYk8v6/FChyV0Xr3JnNUbKL+OcJMS UH0POyIoopbW1e5etfNRyP+88OGjeSIhzPldYAYRKIwr4I0pfyunGdurdu43QSUiuJtW PPkXCh+GcIKddWK4GksbyPCsDCxJRJpvaE6dJNaKMESfDj3672Srim81J5kc7gPkXc/E 10HP3vxiJqtCtue0vANz2AwZ9jxi7Yd+pFRScnS8F0S7Rs40Q8s+i+adRnNFivPg6DOB cPlbKgb4xaPWLXlbxwE7Gn6imhDMPnzXfOyAvZKy+Sx9mQp+sr9RSepv9hlDLn8UTbGC SL4w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=onIG4kCa; spf=pass (google.com: domain of eva.kurchatova@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=eva.kurchatova@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 a640c23a62f3a-c513b0a7736si1282462966b.306.2026.11.25.22.06.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Nov 2026 22:06:40 -0800 (PST) Received-SPF: pass (google.com: domain of eva.kurchatova@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=onIG4kCa; spf=pass (google.com: domain of eva.kurchatova@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=eva.kurchatova@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=MIME-Version:Message-ID:Date:Subject:From: Content-Type; bh=Tkgq1LZtsEhQGQtYqHxGtq/lM6Y5iqBm+2rqk7hC4pI=; b=onIG4kCa5SgV 06TbnzqgCWQRT8V9V86mllwvee7FaAUBJ9+v4RE5axWTD1Jz8CdcKbbLH5oROnwoo/bcsKHgM5UYD 2dOORgygw1qE1qjz1WNEOCc0CNPkoGTXsi/cFcRwcPPHiflFeAJavEk33M1alv2Lpo3Z8jRs8mR4I cga+heaoUr6DqvT3kumJwTWeXRvbW6NwVSx2Fi+avyGY/TEWug45HEHYzG8bY/DYOztulX0Jmq+Gq zo4y1f+Zoo0miyOaegS11rEgcaCKa2vmRHTCj5rjzPtZKpRZCWpky+0GVe53RtS9zm0BlZzLZfVpA JeiB2gvncjXSggFCmz89zA==; Received: from ch-vpn.virtuozzo.com ([130.117.225.6] helo=LekKit-T14) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1xWScl-00E8nT-2Z; Thu, 26 Nov 2026 07:06:38 +0100 From: Eva Kurchatova To: khorenko@virtuozzo.com, vladimir.riabchun@virtuozzo.com Date: Thu, 26 Nov 2026 07:06:59 +0200 Message-ID: <20261126060620.2126341-2-eva.kurchatova@virtuozzo.com> X-Mailer: git-send-email 2.56.1 MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.2 v2 00/28] ms/objtool: fix silently wrong livepatches by klp-build 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 Patchset for tasks: https://virtuozzo.atlassian.net/browse/VSTOR-128510 https://virtuozzo.atlassian.net/browse/VSTOR-156924 https://virtuozzo.atlassian.net/browse/VSTOR-157091 klp-build in 26.x is the RHEL 10.2 import. Mainline has fixed many bugs in it since, and the objtool in it fails 31 of 48 mainline tests. This series takes only the mainline fixes for bugs that a vz10 build (x86_64, gcc) can hit and that make klp-build produce a livepatch which builds but is broken, or refuse a common patch. Patches 1-19 are for VSTOR-128510, patches 20-28 for VSTOR-156924 (1-19 are prerequisites): - pointers to const data compared against a private copy (13) - klp relocations to exports of another module put in a section the livepatch loader never applies, e.g. jump into garbage (16-18) - static symbols bound to an export of the same name (19) - strings and data cloned at the wrong offset (3, 4) - module static keys not rejected at build time (1, 6) - WARN_ONCE() flags correlated between unrelated call sites (5) - functions using pr_debug() in modules can't be patched (2); objtool crashes on empty sections (8) and corrupts a relocation (10) - symbol positions of the same-named static symbols counted in same order as vmlinux.o, which the final link reorders (22, 23, 25, 28) - match the .cold part of a function by name (20) - fix NULL dereference when printing a code symbol (21) - fix x86 alternative replacement (24, 26) - fix new references to an export of another module (27) Patches 7, 9, 11 and 12 are mainline prerequisites of 13. The picks match mainline line for line, except 22 and 23, which have a rebase note. Since patch 13, a named const object is correlated, and the livepatch references the original. Patches 14 and 15 are original. Patch 15 makes klp diff fail when a correlated const object changes, replacing a much larger upstream correlation rewrite, 6016dd33a10a, too large to take. Patch 14 fixes an existing mainline problem, and fails klp diff if the section would be cloned due to one of its objects, or size-less one. See VSTOR-157091 for details, patch 14 to be sent mainline too. Patch 22 makes klp-build builds emit a .klp.symid table, a section that is not allocated; kernels built without klp-build do not change. Tested with klp-build on rh10-6.12.0-211.75.1.26.4.vz10 in QEMU. Changes in v3: - Merged the VSTOR-156924 proposal as patches 20-28, not posted before. - New patch 14: Check .rodata section labels and prevent object cloning. - Patch 15: Check an object which the patch makes const, compare only the section of a target that no symbol contains, lowercase subject. - Cover letter: Renumber patches, update covered tasks. Link to v2: http://lore.virtuozzo.com/kernel/179560292324.21954.16900360366849940769.b4-review@b4/T/#t Changes in v2: - Patch 14: Fail klp diff when a correlated .rodata object changed. - Cover letter: Reflect the .rodata object handling change. - Reviewed-by: Sashiko on patches 1-12. Link to v1: http://lore.virtuozzo.com/kernel/20261124050655.1853940-1-eva.kurchatova@virtuozzo.com/T/#t Eva Kurchatova (2): objtool/klp: use the section symbol for .rodata labels objtool/klp: reject changed .rodata objects Joe Lawrence (4): ms/objtool/klp: fix data alignment in __clone_symbol() ms/objtool/klp: Fix create_fake_symbols() skipping entsize-based sections ms/objtool/klp: Normalize Module.symvers paths to module names ms/objtool/klp: Allow new references to module exports Josh Poimboeuf (21): ms/objtool/klp: Fix detection of corrupt static branch/call entries ms/objtool/klp: Disable unsupported pr_debug() usage ms/objtool: Fix data alignment in elf_add_data() ms/objtool/klp: Fix .data..once static local non-correlation ms/objtool/klp: Fix handling of zero-length .altinstr_replacement sections ms/objtool/klp: Fix cloning of zero-length section symbols ms/objtool/klp: Fix relocation conversion failures for R_X86_64_NONE ms/objtool/klp: Fix reloc corruption in convert_reloc_sym_to_secsym() ms/objtool/klp: Simplify reloc symbol conversion ms/objtool: Move mark_rodata() to elf.c ms/objtool/klp: Fix pointer comparisons for rodata objects ms/objtool/klp: Fix module name normalization for paths with dots ms/objtool/klp: Fix cross-module klp relocation section naming ms/objtool/klp: Don't match local symbols against exports ms/objtool: Fix .cold function detection for duplicate symbols ms/objtool/klp: Avoid NULL pointer dereference when printing code symbol name ms/objtool/klp: Add .klp.symid for sympos disambiguation ms/objtool/klp: Fix symbol resolution for duplicate data symbols ms/objtool/klp: Fix size of empty special section entries ms/objtool/klp: Fix vmlinux .klp.symid link error for .no_trim_symbol symbols ms/objtool/klp: Ignore replacement offset of empty x86 alternatives Puranjay Mohan (1): ms/objtool/klp: Fix vmlinux .klp.symid link error for .exitcall.exit symbols include/asm-generic/vmlinux.lds.h | 10 +- scripts/Makefile.vmlinux_o | 3 + scripts/livepatch/klp-build | 7 + scripts/mod/modpost.c | 1 + tools/objtool/Build | 4 +- tools/objtool/arch/x86/special.c | 27 ++ tools/objtool/builtin-check.c | 7 + tools/objtool/check.c | 18 +- tools/objtool/elf.c | 69 +++- tools/objtool/include/objtool/builtin.h | 1 + tools/objtool/include/objtool/elf.h | 25 +- tools/objtool/include/objtool/klp.h | 29 +- tools/objtool/include/objtool/special.h | 7 + tools/objtool/klp-diff.c | 471 ++++++++++++++++-------- tools/objtool/klp-post-link.c | 53 +-- tools/objtool/klp-symid.c | 119 ++++++ tools/objtool/klp-sympos.c | 411 +++++++++++++++++++++ 17 files changed, 1073 insertions(+), 189 deletions(-) create mode 100644 tools/objtool/klp-symid.c create mode 100644 tools/objtool/klp-sympos.c -- 2.56.1 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel