From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796082654; b=U/51/4NchXBZjqXC17ghXc8SznG0+x/EPUYNqmNGc8ArLfOpySvDavbrFTf1Q45RtdUN URRyQxZHoPfFma5iBaGkZTXbZmQmuXl6ASPd9bpS+Tc3il0/golDa/hararXkgt70rYFO 80n4x4Fhnqkr1dVvxJaPE8pMSDWa3qf7Z9c1kHiAEtnxDPSwhyZoH4GISrvNki18YZx1N Adne0cWxDRbHw3q8MWrk/Y9i5212ndR9EA+kcHp8M2k1IfycjvgktXqUaUrsLbnsm08oh kjpZA9Qv+JTAuGUEitcqOlD4rcnCk9c/bw1tJaadJGHhwC4W+zgOVo7ANtHBkirlXMQ== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796082654; h=Received:DKIM-Signature:Received:From:Subject:Date:Message-Id: MIME-Version:Content-Type:Content-Transfer-Encoding:X-B4-Tracking: X-Change-ID:To:Cc:X-Mailer:X-Developer-Signature:X-Developer-Key: X-Endpoint-Received:X-Original-From:Reply-To; bh=m2jyWdYlcJnLrefCCzSx3Mn7pWxI2ZhMzfvUvOv+BrU=; b=qc0sGZPzcNcme7F4UAd/4XjQ46JqbjbSTDM9k77Zbc2pOp6oJys2hJj741eM5Uonido5 M1sv7DxOCbW6lju7VaiKs4JrzWnBcIwh4egvBxHcku8O/kt2TQvTnPjpRkamuJ1eli1oD +WGfDMr3Im9i2ev3dHpIdl4OC+5VphZNSZR4APPC3Cm03Qef1TFhgOetm/AUj0AZmJgOj R63IC7P28cwJBYaASH7V8ICDoGXqu9j4EHjwMK3ss5mTfhln5N5XrcVeEj2M++2HMLHAc VmeONsTLayLZcKSellTnLVNyXv6jeaoqCrMHlBqs3+Q39V4iQz59xAD1/HenjinEz7Q== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=o2Qz9LlO; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E1979606A31A; Mon, 30 Nov 2026 23:50:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=o2Qz9LlO Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none; t=1796082653; b=YTYmnz2KwQc/KqQjtal8BhPxiFGPiZxzb1lgBVYdWDkO0yUMTFO69balIfvSkz/vwYY2 V8rMXsb316zsnV6CxBTrBryI69kq8rLBCn5A+Nq+ysKm1Tc8KEirMAMeww+WtNWtQIlWG 0QqmEeHaLfDLnaNw8auhNCFYjk9M1wt85uNRCtJSqchsTDUUxmTMcQHDBbldzgZBWJj5u 1GwlE0yTj8Plp66YK74hZAcHznVhk92B8pp6lb9/gKkQlIGJj+3IwpMfLCOzJOgocBmPA yh/tsm8auW6RrR5au6tzw3si384bO2UHDFLdIfnA+VjRGxRT2w/BMhrx7OnIx274y9A== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1796082653; h=DKIM-Signature:Received:From:Subject:Date:Message-Id:MIME-Version: Content-Type:Content-Transfer-Encoding:X-B4-Tracking:X-Change-ID:To: Cc:X-Mailer:X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To; bh=m2jyWdYlcJnLrefCCzSx3Mn7pWxI2ZhMzfvUvOv+BrU=; b=MSTv9v7g1lLFoFM1+NBBh9ugZZtVfu1Mbbfoa2XXD8M7gqcykRizwdolsWeMo6gIQDWW 1wZP7gG7bcnJbdEXH2d2V32Lfzc1fUWgmKUYA7jiDwyq8EN0hAXNBWziW05sLAMFRdwuo IXEKrTX4D5ro/SSgErJGUkggGVfVg7jXacvmqfYyLtVZ+bSTJ1azai8kU4jiFTcnhZj81 8FIVQPTLkT+PafEHKZm7L9arO4k1VUDHKwK9God73I1ePDG5OJwudFo/N1FPd/CVEsU4M F+u5xjIsKOUBNNHniklgPCKRNpZa78mtVk2LZUtQFhzcAB4/8G3F/mwAj3P7/1jZDhQ== ARC-Authentication-Results: i=1; smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id B2A1B1F00897; Mon, 30 Nov 2026 23:50:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796082653; bh=m2jyWdYlcJnLrefCCzSx3Mn7pWxI2ZhMzfvUvOv+BrU=; h=From:Subject:Date:To:Cc:Reply-To; b=o2Qz9LlOIsRHXW79T2y/jrjo8jt7bHZ7BSudFAut8yF+eCi/Ey7e8qU/eGmoKR+wi K0uiS1hOqOrB7oIIb7ITowsqdTnJyXJ57ZEiPbuk9zyvyfqoedRD3TudCLOTn79C/7 F8Y/P6xWn2ezmICen1Okz7as7RRRtaZ29O3NXwvLGRHy/XfH6yWQ7X8BEuU5Z96XUT szLAklkKisKQ/BgZYIR6dAjGD2EZAqy94B5pN6cpFg4blpFYI9PT6jQvTYJ70gtXyg xFUwp3VzCpR8DmONuVUWbU2Ag8kB47eIyDitwSbsrvKSVTcrnmDwrOYPDYjbrKe/6h pbHV+Hmp3+ghA== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id 11B8E4EB09; Mon, 30 Nov 2026 23:50:50 +0000 (UTC) From: Binoy Ravindran via B4 Relay Subject: [PATCH v2 0/2] objtool/klp: Copy constant pool entries for local labels Date: Mon, 30 Nov 2026 18:50:36 -0500 Message-Id: <20261130-objtool-klp-cst-v2-0-2718c17fca37@vt.edu> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAMwLDmsC/3WNwQ6CMBAFf4Xs2TVtxQKe/A/DAcoiRUJJWxoN6 b9L8exxknnzNnBkNTm4ZRtYCtppM+8gThmooZmfhLrbGQQTknNRoGlHb8yEr2lB5TxeL43IWV7 0jCrYV4ulXr+P4qP+sVvbkZRPmWQM2nljP8dl4Mn7Xw8cOXaKVy0rVSkLeQ/+TN0KdYzxCyZrs p+9AAAA X-Change-ID: 20261127-objtool-klp-cst-53a24047f0e9 To: Josh Poimboeuf , Peter Zijlstra , Song Liu , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt Cc: Joe Lawrence , linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Binoy Ravindran X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1796082649; l=1734; i=binoy@vt.edu; s=20261123; h=from:subject:message-id; bh=0dTaL35XT2RiJMusiM4h/MVFWHcDHnjosCK27zIvPAw=; b=VcLjNQgB4Re2+yiE3hIDAyJlQvogcxzVKJJ6AxPbT8LSPCK9skRAtdEBBFMUd7U3ngNpDeo/C sjyz5OwoU3xDPK7iNOTn267C/F6w+ljze30UTRLevKjYOoODoEc4HUx X-Developer-Key: i=binoy@vt.edu; a=ed25519; pk=4cNdKPHP0InmhK/9bb7Tm2ZMUXUvLGfw1pmVt5b98fA= X-Endpoint-Received: by B4 Relay for binoy@vt.edu/20261123 with auth_id=1622 X-Original-From: Binoy Ravindran Reply-To: binoy@vt.edu A small problem in __clone_symbol(): a .LC label in a .rodata.cst* pool has no size, so its constant is never copied into the livepatch module, and the patched function reads whatever bytes follow. Patch 1 fixes it. Details and the three affected modules are in that patch. Patch 2 adds a test to tools/objtool/tests, as Joe suggested. With patch 1's change to klp-diff.c reverted it fails, and with the change in place it passes, under gcc 12.2.0 and clang 14.0.6. The whole suite passes under both compilers. One thing I noticed while running the suite: with a gcc built with --enable-default-pie, as Debian's is, -mnop-mcount is rejected, preflight falls back to objtool's mcount, and every gcc test that needs an ftrace call site fails with "no ftrace call site, can't patch". CC="gcc -fno-PIE -fcf-protection=none" avoids it. The kernel always builds with -fno-PIE, so FIXTURE_CFLAGS might want it as well. I can send a patch for that if it is useful. --- Changes in v2: - Add a test for the fix (Joe). - Add Joe's Acked-by to patch 1. - Link to v1: https://patch.msgid.link/20261127-objtool-klp-cst-v1-1-dc19b08c8676@vt.edu --- Binoy Ravindran (2): objtool/klp: Copy constant pool entries for local labels objtool/klp: Add test for constant pool labels tools/objtool/klp-diff.c | 15 +++- .../objtool/tests/generic/fixtures/constant_pool.c | 31 ++++++++ tools/objtool/tests/generic/test-constant-pool.sh | 91 ++++++++++++++++++++++ 3 files changed, 135 insertions(+), 2 deletions(-) --- base-commit: b99a5337da3c847db216476d645b69acd714c3ba change-id: 20261127-objtool-klp-cst-53a24047f0e9 Best regards, -- Binoy Ravindran