Received: by 2002:ab2:4a89:0:b0:1f4:a8b6:6e69 with SMTP id w9csp219336lqj; Wed, 10 Apr 2024 08:32:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUGhmoAaz6C54pEX+01uJBQe8swYn5f5btnpDFE+DWrNG69PoqppG/l6zYg+GKBMKCBXkJccle57A3zSwDsY+5742veQZ/wlpV44ihMsw== X-Google-Smtp-Source: AGHT+IEyMspj9f61WRoEAzXSG3Pn8kU4+XaRNf2B/WB1+mkbZ07mY85+gDjghoe6jKd1iEcsUvaQ X-Received: by 2002:a05:6214:c82:b0:699:2bb1:f0fe with SMTP id r2-20020a0562140c8200b006992bb1f0femr3431150qvr.5.1712763173630; Wed, 10 Apr 2024 08:32:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712763173; cv=pass; d=google.com; s=arc-20160816; b=wU8Ee+kV76923PwmR5InHoZFaFRDMjwDU1e99BevDZAErDH9DmZu4moCBNYHKHnsK4 q66dx/XtAYiFdgja7KWbdYfYOsyac3sklFxmF4VNwteb+CVBQiS31IOYtjtil0tNqKyh Pj3LAgcN0aNkoygJg+qvfphVjc6IKF/f64SE0XdfmxAHvPjSdXFvVW1v1W8PxOzQCmzm OSL5mbCX9glnYX/9l3KIEXLo0L6OWqeKTJBwKSFGZUiIc+8W0vJsYwLzilDikLlvLFPZ PjfnXIQNruJplzFcz/rQsCLvfZ87dQAzC2YEbWbR5azAelvGy4LAVB8nmWbykoS6lRkc kXYg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:dkim-signature; bh=1OPC8ZgLiEqBr/w4gD9mybwHjbz8PCFyyQkn0bnLdg0=; fh=hUlpAncEmhqlrznVjSh0XvjUvhJLwL+1r1bx5+nrz8o=; b=P7uIdRRI/yU9RDbaSBEQy3t84ZWXcmBVevApGU2g7ipbN1U53g1RrG3/dEUaizNZY0 ITJ70T4oKHKd11cBehyMHbR9lZfhVotDA3V+KZPAjnHfCOZ6CHdOA61/KINmVDRLhGyH 0CsNda6/8GkoQCNc1uPLZW56nOzdlgE6EMjuN/zOvOU5W5b9uGx/9lxdfmJT/fqcT1n8 588lQi0ptc6v78XlU7o623qrT3gZMvCMu2IOJDk+Iy7zQ7OljzFbdjF5gdUlYGitZQSJ zt7fU6f36Pd3/A2iSFbe+LBKx03LbkZHPc7v8yuT7fZ+Fn0vMt1lb7lFoY1ZAG1guXom Pbtw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=srz27ijB; dkim=pass header.i=@suse.com header.s=susede1 header.b=srz27ijB; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-138884-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138884-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id f28-20020ad4559c000000b006993a9e8601si12851049qvx.42.2024.04.10.08.32.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 08:32:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-138884-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=srz27ijB; dkim=pass header.i=@suse.com header.s=susede1 header.b=srz27ijB; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-138884-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138884-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A33431C23503 for ; Wed, 10 Apr 2024 15:32:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6FBF416EC11; Wed, 10 Apr 2024 15:32:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="srz27ijB"; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="srz27ijB" Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F92516E871; Wed, 10 Apr 2024 15:32:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712763149; cv=none; b=fs+D1gBvHpqSXlrLgGYyC4iijrxBqzvl3/n0xo8aLMsNIMKLTb2X1YBQYWTcRTzndlsq2GO9w3PrjTfGBNX6EdXFNqgzmhbnz/6FiZC8p1hp5PUTtusUhGsNrxd0oNo2wf3LtLKiM5+QZ55gdfLgJGPjhUUIWKy+I3PrijPHN4o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712763149; c=relaxed/simple; bh=B0nAhchM37YZ2xM/SSFrLXk96D+WGDIbRzquDnO1f2M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EfUOpnqRhK4hd8GZIM7E/jESsqSHQfS6GoaGPMpKJsOMu/ZPZObsgCtmOUoryH+hle91CAeAYl8R+chl6KkiW3ZKSkis+3tCTYqwcaMFsY6pvB7FwAxgZpY5zkxCqjkmMJP1APUO/CoGGb1eHYtdrgWtPOcE3eJ1dFnAMBP+4SY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=srz27ijB; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=srz27ijB; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 1FCB85D062; Wed, 10 Apr 2024 15:32:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1712763145; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1OPC8ZgLiEqBr/w4gD9mybwHjbz8PCFyyQkn0bnLdg0=; b=srz27ijBb1CaOxMILf0y0BODVBSj6vzbTDLHNv20pFvSo/lwXczWQnkgRDUo7H8Oe3MNuB FNy1t8gf21EM3mV/x+hIv3spGsySh56XqbcCboC0KFCRuJJ6/KfReGp9j531CoQu9s25rw hxpbvUnOLXADLFMETxPHeHt76gPjgp4= Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.com header.s=susede1 header.b=srz27ijB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1712763145; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1OPC8ZgLiEqBr/w4gD9mybwHjbz8PCFyyQkn0bnLdg0=; b=srz27ijBb1CaOxMILf0y0BODVBSj6vzbTDLHNv20pFvSo/lwXczWQnkgRDUo7H8Oe3MNuB FNy1t8gf21EM3mV/x+hIv3spGsySh56XqbcCboC0KFCRuJJ6/KfReGp9j531CoQu9s25rw hxpbvUnOLXADLFMETxPHeHt76gPjgp4= Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 3C4A413691; Wed, 10 Apr 2024 15:32:23 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap1.dmz-prg2.suse.org with ESMTPSA id l2WqNQexFmZTNAAAD6G6ig (envelope-from ); Wed, 10 Apr 2024 15:32:23 +0000 From: Marcos Paulo de Souza To: Lukas Hruska Cc: Petr Mladek , Miroslav Benes , Josh Poimboeuf , Joe Lawrence , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, Marcos Paulo de Souza Subject: Re: [PATCH v1 0/5] livepatch: klp-convert tool - Minimal version Date: Wed, 10 Apr 2024 12:32:18 -0300 Message-ID: <20240410153220.15927-1-mpdesouza@suse.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20231106162513.17556-1-lhruska@suse.cz> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Action: no action X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Level: ***** X-Spamd-Result: default: False [5.39 / 50.00]; BAYES_SPAM(5.10)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; BAD_REP_POLICIES(0.10)[]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.com:dkim,suse.cz:email]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCPT_COUNT_SEVEN(0.00)[9]; R_DKIM_ALLOW(0.00)[suse.com:s=susede1]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; DKIM_TRACE(0.00)[suse.com:+] X-Spam-Score: 5.39 X-Spam-Flag: NO X-Rspamd-Queue-Id: 1FCB85D062 X-Spamd-Bar: +++++ On Mon, 6 Nov 2023 17:25:08 +0100 Lukas Hruska wrote: > Summary > ------- > > This is a significantly simplified version of the original klp-convert tool. > The klp-convert code has never got a proper review and also clean ups > were not easy. The last version was v7, see > https://lore.kernel.org/r/20230306140824.3858543-1-joe.lawrence@redhat.com > > The main change is that the tool does not longer search for the > symbols which would need the livepatch specific relocation entry. > Also klp.symbols file is not longer needed. > > Instead, the needed information is appended to the symbol declaration > via a new macro KLP_RELOC_SYMBOL(). It creates symbol with all needed > metadata. For example: > > extern char *saved_command_line \ > KLP_RELOC_SYMBOL(vmlinux, vmlinux, saved_command_line, 0); > > would create symbol > > $>readelf -r -W : > Relocation section '.rela.text' at offset 0x32e60 contains 10 entries: > Offset Info Type Symbol's Value Symbol's Name + Addend > [...] > 0000000000000068 0000003c00000002 R_X86_64_PC32 0000000000000000 .klp.sym.rela.vmlinux.vmlinux.saved_command_line,0 - 4 > [...] > > > The simplified klp-convert tool just transforms symbols > created by KLP_RELOC_SYMBOL() to object specific rela sections > and rela entries which would later be proceed when the livepatch > or the livepatched object is loaded. > > For example, klp-convert would replace the above symbols with: > > $> readelf -r -W > Relocation section '.klp.rela.vmlinux.text' at offset 0x5cb60 contains 1 entry: > Offset Info Type Symbol's Value Symbol's Name + Addend > 0000000000000068 0000003c00000002 R_X86_64_PC32 0000000000000000 .klp.sym.vmlinux.saved_command_line,0 - 4 > > > Note that similar macro was needed also in the original version > to handle more symbols of the same name (sympos). > > Given the above, add klp-convert tool; integrate klp-convert tool into > kbuild; add data-structure and macros to enable users to annotate > livepatch source code; make modpost stage compatible with livepatches; > update livepatch-sample and update documentation. > > > Testing > ------- > > The patchset selftests build and execute on x86_64, s390x, and ppc64le > for both default config (with added livepatch dependencies) and a larger > SLE-15-ish config. > > > Summary of changes in this minimal version > ------------------------ > > - rebase for v6.5 > - cleaned-up SoB chains (suggested by pmladek) > - klp-convert: remove the symbol map auto-resolving solution > - klp-convert: add macro for flagging variables inside a LP src to be resolved by this tool > - klp-convert: code simplification Do we have anything that blocks klp-convert-mini to be merged, or something that needs to be fixed? Thanks, Marcos > > Previous versions > ----------------- > > RFC: > https://lore.kernel.org/lkml/cover.1477578530.git.jpoimboe@redhat.com/ > v2: > https://lore.kernel.org/lkml/f52d29f7-7d1b-ad3d-050b-a9fa8878faf2@redhat.com/ > v3: > https://lore.kernel.org/lkml/20190410155058.9437-1-joe.lawrence@redhat.com/ > v4: > https://lore.kernel.org/lkml/20190509143859.9050-1-joe.lawrence@redhat.com/ > v5: > (not posted) > https://github.com/joe-lawrence/klp-convert-tree/tree/klp-convert-v5-devel > v6: > https://lore.kernel.org/live-patching/20220216163940.228309-1-joe.lawrence@redhat.com/ > v7: > https://lore.kernel.org/all/20230306140824.3858543-1-joe.lawrence@redhat.com/