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 41B7F80027 for ; Wed, 25 Nov 2026 06:13:54 +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 6AP6CcKj016055; Wed, 25 Nov 2026 09:12:39 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AP6CcKj016055 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="Qzcstx1J" Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AP6CbpA016051 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Wed, 25 Nov 2026 09:12:37 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AP6CbpA016051 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-c40bbd26f74so412874166b.0 for ; Tue, 24 Nov 2026 22:12:37 -0800 (PST) X-Gm-Message-State: APuU4Z/YowU+jD96OwO+poU4S61Hx/dTBME7EgvLT/G7R1VIg5jwypvN qa9F5jnKHlCa+Y2fBCl7L0K3lPYukj4wuFZSje+IW5KwCOlfUBasVOlmSHJwVlTyHotNsv8XICw lH2kuiWTjA0JrR64oWPY0xWJLTpcbzC1Ftjj97pR/jXnFEFZyEKKXtQ== X-Gm-Gg: AZFdTZcQesAHjMWAIWPI0sahEuu+yAgDqhecFhX7tZFyMTNF5U1RyXddJbThcQqy7OD 21SLATKzH8InbZ2b9itrWJWkPzWVtBgamWkdxJZ+MfWtuNl3Nzjf36UEEGkjka24/PmKPCaIp/z wdbZe+Q+DBqnJbfQP4XETduf9H1tQn4r1ZdWz7VWx7aziUEUA3IGP+dAcpW6+asNjJ1+Icd2/Rg Q/vLFLJZvec+lqYv9+5tOM6i/g4vZgapcTYLMlxPROfxp7jkge9Ri8MuoHTK0WDInOMjD/fkgjJ 7YYTnFzc0YtRh4arwOs1yQzmXxDgeZhsN33au/bIme2IZLqIaHolv+4bX+j/4s6Vf7Ew4KazoKh iCuixjxnJwcmMzIuN0/Ox/mxkMw== X-Received: by 2002:a17:906:c102:b0:c51:373e:d6a9 with SMTP id a640c23a62f3a-c513aace989mr1258483666b.15.1795587156783; Tue, 24 Nov 2026 22:12:36 -0800 (PST) X-Received: by 2002:a17:906:c102:b0:c51:373e:d6a9 with SMTP id a640c23a62f3a-c513aace989mr1258482366b.15.1795587156331; Tue, 24 Nov 2026 22:12:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1795587156; cv=none; d=google.com; s=arc-20260327; b=FoNxVFZcAhYrdsYjkFT082tR5VdE+nDtyBCa06H1oXjqVKIWuQDB87RZHBao/kimQB GHBtMPF1UXIGcbeo52vyH932pUPybYKX5DKcWn4YY+1R4+fR1qHWGtChDdHFLSkGFQzQ Wbwyp2vOGQBXqGjS91/ufwDu6HCvINkiic1zYGnvdi4RIrZhjc5Y8cyadoG3KQf/yf4J dhoAw6mT5oQJIeyH1o9e/BFIleiEXwwtt21TOhtQmM5FqVxyAFtS9BTpJRJeAjayeKpC T41yxoBa8DA52eASXueEJGt/Yh9XUPTxKfZstWJd3AYdG36aEnIChgIUy8Cb5L4H9hY7 IWag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=OTdKTZkXMU8yK3wjo+FyeIoeZ6Ghd6wI9dFo70h0TnM=; fh=/QSWnKFFIPNLStgUoDwCQRaXnWcMIG7fyKJgHY+VEpU=; b=G9YG/7HJsXO0NLIpZPWG4m07DB49lh2Qx4zAcad/o5daX0wCaZTCUwm3DZtgMU7Urp nL5O7U0gbS6/7NWAhmcdfEAAoAujHr7HUPYsgNnnQK5kuMubm6vD8prQhz0Qt99vTX4M gARqcUC3FJega5phiJ2Q12id/PH1sI07BMQUVgrm8Y7yYV3pXdWVKLSdFbgjC9gyJS9j BoJiblnuullHTY/VMrazCq9OTELpQFIeMzFZEWqaC6PJJwmmGTWBERRciKMW8HgJ9dgQ Cu7zuIN2y+dXEe2xKtP0UmhIO8gNdT95weInC+kvfg0spRBbXLXV10rJGgmVTuikJM8b 5kfQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=Qzcstx1J; 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-c513b030f0dsi1069422266b.160.2026.11.24.22.12.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Nov 2026 22:12:36 -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=Qzcstx1J; 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=OTdKTZkXMU8yK3wjo+FyeIoeZ6Ghd6wI9dFo70h0TnM=; b=Qzcstx1JmAdT JT12fraFe22RJRzigzAnOTKKIaFWW14tJKyHOuXEq2RKTHXtToZ3Pt/Hx3QK8sEVDKvwMYDznIaj6 hftFyYrzUsZZURwPGfkZMYUBtStMc5V7OxrvXOwchqrCHk2a0ePXzu0y02vabcq2aPid6B5tb2itm IJ4e9phG/s1fCgRY0ral87wY0qmxt3zfsA9xkhqhXn6PBHWqOBJqD9QtQDHR41rQn5l44TeEiuUEz ZyD5ReMyj3GSyjoXKt/+B0Gg6Dz1ZWJXxdHT1jyqlln8KtFK3xbzBk+WpAugjYEPnkEZbH4U85nGm 1jzsWnPRA4JPADWiJS/dDw==; 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 1xW6E8-006jhw-0I; Wed, 25 Nov 2026 07:11:42 +0100 From: Eva Kurchatova To: khorenko@virtuozzo.com, vladimir.riabchun@virtuozzo.com Date: Wed, 25 Nov 2026 08:03:58 +0200 Message-ID: <20261125061124.1995383-17-eva.kurchatova@virtuozzo.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261125061124.1995383-1-eva.kurchatova@virtuozzo.com> References: <20261125061124.1995383-1-eva.kurchatova@virtuozzo.com> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.2 v2 16/18] ms/objtool/klp: Normalize Module.symvers paths to module names 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 From: Joe Lawrence Module.symvers contains build-tree object paths as module identifiers (e.g., "arch/x86/kvm/kvm") rather than runtime module names ("kvm"). Objtool's clone_reloc_klp() uses this field directly for exported symbols, while unexported symbols correctly go through __find_modname(). This means that exported symbol relocations may land in a .klp.rela section named with the build path rather than the module name. That is a crash waiting to happen: the kernel's livepatch loader silently skips this relocation because it doesn't match the expected klp_object name. The unresolved relocation sits in the newly activated code, crashing when executed. Normalize export->mod at Module.symvers read time using the same logic as __find_modname() (refactored into a shared normalize_modname() helper). Fixes: dd590d4d57eb ("objtool/klp: Introduce klp diff subcommand for diffing object files") Reported-by: Ben Procknow Signed-off-by: Joe Lawrence Signed-off-by: Josh Poimboeuf Signed-off-by: Ingo Molnar Reviewed-by: Miroslav Benes Cc: live-patching@vger.kernel.org Link: https://patch.msgid.link/dbe1b72931bd3c31b751fd0729613d9f2226fff6.1785727106.git.jpoimboe@kernel.org (cherry picked from commit 8668bf91e0508abeb8e98b4edd89032be02228a1) https://virtuozzo.atlassian.net/browse/VSTOR-128510 Feature: klp-build support Signed-off-by: Eva Kurchatova --- tools/objtool/klp-diff.c | 49 ++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/tools/objtool/klp-diff.c b/tools/objtool/klp-diff.c index dae9b5249ed2..bc33683e2bd5 100644 --- a/tools/objtool/klp-diff.c +++ b/tools/objtool/klp-diff.c @@ -83,6 +83,35 @@ static char *escape_str(const char *orig) return new; } +/* + * Convert a build-tree object path to a runtime module name: strip + * directory components, replace '-' with '_', and remove file + * extensions. Examples: + * + * "arch/x86/kvm/kvm" -> "kvm" + * "arch/x86/kvm/kvm-intel" -> "kvm_intel". + * + * Used by read_exports() to normalize Module.symvers entries and by + * __find_modname() as a fallback when .modinfo lacks a "name=" tag. + */ +static char *normalize_modname(char *name) +{ + char *slash = strrchr(name, '/'); + + if (slash) + name = slash + 1; + + for (char *c = name; *c; c++) { + if (*c == '-') + *c = '_'; + else if (*c == '.') { + *c = '\0'; + break; + } + } + return name; +} + static int read_exports(void) { const char *symvers = "Module.symvers"; @@ -150,6 +179,9 @@ static int read_exports(void) return -1; } + if (strcmp(export->mod, "vmlinux")) + export->mod = normalize_modname(export->mod); + export->sym = strdup(sym); if (!export->sym) { ERROR_GLIBC("strdup"); @@ -825,7 +857,7 @@ static struct export *find_export(struct symbol *sym) static const char *__find_modname(struct elfs *e) { struct section *sec; - char *name, *slash; + char *name; sec = find_section_by_name(e->orig, ".modinfo"); if (!sec) { @@ -843,20 +875,7 @@ static const char *__find_modname(struct elfs *e) return NULL; } - slash = strrchr(name, '/'); - if (slash) - name = slash + 1; - - for (char *c = name; *c; c++) { - if (*c == '-') - *c = '_'; - else if (*c == '.') { - *c = '\0'; - break; - } - } - - return name; + return normalize_modname(name); } /* Get the object's module name as defined by the kernel (and klp_object) */ -- 2.56.1 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel