From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CFF8C3BD23C for ; Tue, 10 Mar 2026 20:38:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773175084; cv=none; b=NUTL3HNK1CPbYPFJRNxupADeqTNR9E76kOsbysX8mG7c7me5PBv8UTjuHbUqBWP3/r5hp4YJXAoRTAHZ6PuR9U9whX3EqOCp97yoMPZ0lb0mUXD+bwT3f6icwCjXXFRFc2pGnNBDZ6x1ebYVhaKOoUGkJlKt7xf8no78h/dkC2Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773175084; c=relaxed/simple; bh=C4zAf/xeMlhrI5YopqkssrO0w7PF57Rtk0+DXhwhWWM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=Wtnsgh6X1Bz5miTYYW9sC6NckWLfQCbAwhfjT5cnJeNZhVyHlJ4g0bVjW5uo/kfvE2T9pX3JF7fRWJsYuTLWucBTOzgAPpakE4cq8t4QoiamofWVxrxiJQnkG+CvWqi7LvYxUq5ECq1JrYIl3p43bro3BIFsYDPgytO9g9e856s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=TsOjm52s; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="TsOjm52s" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773175081; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4lkbETUzvxrqSaxbWXadNNUWFbkFqI4JG3NKARAyse4=; b=TsOjm52s9Sko3Ig2eIo7dIpZ7voSfA4bhkfhLB7ttEQBJMAgp8T0/Y29QlB5n7VxhZDniu muJVD/hEjCxurMLn8M0H94Lro/QPwd58xVtyDpN/O+Ahztd/zj4+G2LByl3YUnEzpLlmAH 73ZBdJ94VgRnAB0rwLBw1+Ebm/Zm7Qw= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-210-MaaV9dXFNbajEnh4_DY-Ww-1; Tue, 10 Mar 2026 16:37:58 -0400 X-MC-Unique: MaaV9dXFNbajEnh4_DY-Ww-1 X-Mimecast-MFC-AGG-ID: MaaV9dXFNbajEnh4_DY-Ww_1773175077 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 449241956089; Tue, 10 Mar 2026 20:37:57 +0000 (UTC) Received: from jolawren-thinkpadp1gen7.ibmlowe.csb (unknown [10.22.80.5]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CF15C19560A6; Tue, 10 Mar 2026 20:37:55 +0000 (UTC) From: Joe Lawrence To: live-patching@vger.kernel.org Cc: Josh Poimboeuf , Song Liu , Jiri Kosina , Miroslav Benes , Petr Mladek Subject: [PATCH v4 01/12] objtool/klp: fix data alignment in __clone_symbol() Date: Tue, 10 Mar 2026 16:37:40 -0400 Message-ID: <20260310203751.1479229-2-joe.lawrence@redhat.com> In-Reply-To: <20260310203751.1479229-1-joe.lawrence@redhat.com> References: <20260310203751.1479229-1-joe.lawrence@redhat.com> Precedence: bulk X-Mailing-List: live-patching@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Commit 356e4b2f5b80 ("objtool: Fix data alignment in elf_add_data()") corrected the alignment of data within a section (honoring the section's sh_addralign). Apply the same alignment when klp-diff mode clones a symbol, adjusting the new symbol's offset for the output section's sh_addralign. Fixes: dd590d4d57eb ("objtool/klp: Introduce klp diff subcommand for diffing object files") Signed-off-by: Joe Lawrence --- tools/objtool/klp-diff.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/objtool/klp-diff.c b/tools/objtool/klp-diff.c index a3198a63c2f0..c2c4e4968bc2 100644 --- a/tools/objtool/klp-diff.c +++ b/tools/objtool/klp-diff.c @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -560,7 +561,7 @@ static struct symbol *__clone_symbol(struct elf *elf, struct symbol *patched_sym } if (!is_sec_sym(patched_sym)) - offset = sec_size(out_sec); + offset = ALIGN(sec_size(out_sec), out_sec->sh.sh_addralign); if (patched_sym->len || is_sec_sym(patched_sym)) { void *data = NULL; -- 2.53.0