From patchwork Wed Aug 21 08:20:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wieczorkiewicz, Pawel" X-Patchwork-Id: 11106031 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A28C41395 for ; Wed, 21 Aug 2019 08:22:30 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7ED422339E for ; Wed, 21 Aug 2019 08:22:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amazon.de header.i=@amazon.de header.b="taqzJz5F" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7ED422339E Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amazon.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i0Lrv-0000tA-NC; Wed, 21 Aug 2019 08:21:23 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i0Lrt-0000p2-HY for xen-devel@lists.xen.org; Wed, 21 Aug 2019 08:21:21 +0000 X-Inumbo-ID: a7a0a1cb-c3ec-11e9-adc2-12813bfff9fa Received: from smtp-fw-9102.amazon.com (unknown [207.171.184.29]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id a7a0a1cb-c3ec-11e9-adc2-12813bfff9fa; Wed, 21 Aug 2019 08:21:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1566375680; x=1597911680; h=from:to:cc:subject:date:message-id:mime-version; bh=sF6kIf5DkCz8gKVAOBESnJmWKCHRu5ZKKFUVFcQqWGE=; b=taqzJz5FANpF4A5u1EsFSxJkpvMM+lIk7KK5k+PH3j0C4WBJG4oEg3gK TDwxZmQZ7eBXZ5yfSF9oXrDbP4CVux1wseo9+nk+hWkbPkBoJ1dCBMIBr li7MN4MzpWbpE9OJ3SHw9qfQ+CdV17aJ2/99Q6J+3B3GC0kv2ZPxbZ3Qv o=; X-IronPort-AV: E=Sophos;i="5.64,412,1559520000"; d="scan'208";a="695968492" Received: from sea3-co-svc-lb6-vlan3.sea.amazon.com (HELO email-inbound-relay-2c-168cbb73.us-west-2.amazon.com) ([10.47.22.38]) by smtp-border-fw-out-9102.sea19.amazon.com with ESMTP; 21 Aug 2019 08:21:19 +0000 Received: from EX13MTAUEA001.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan2.pdx.amazon.com [10.170.41.162]) by email-inbound-relay-2c-168cbb73.us-west-2.amazon.com (Postfix) with ESMTPS id 904ABA20B3; Wed, 21 Aug 2019 08:21:19 +0000 (UTC) Received: from EX13D03EUC004.ant.amazon.com (10.43.164.33) by EX13MTAUEA001.ant.amazon.com (10.43.61.243) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 21 Aug 2019 08:21:04 +0000 Received: from EX13MTAUEB001.ant.amazon.com (10.43.60.96) by EX13D03EUC004.ant.amazon.com (10.43.164.33) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 21 Aug 2019 08:21:03 +0000 Received: from dev-dsk-wipawel-1a-0c4e6d58.eu-west-1.amazon.com (10.4.134.33) by mail-relay.amazon.com (10.43.60.129) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Wed, 21 Aug 2019 08:21:02 +0000 From: Pawel Wieczorkiewicz To: , Date: Wed, 21 Aug 2019 08:20:36 +0000 Message-ID: <20190821082056.91090-1-wipawel@amazon.de> X-Mailer: git-send-email 2.16.5 MIME-Version: 1.0 Precedence: Bulk Subject: [Xen-devel] [PATCH 00/20] livepatch-build-tools: new features and fixes X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: wipawel@amazon.com, Konrad Rzeszutek Wilk , Andrew Cooper , Ross Lagerwall , mpohlack@amazon.com, Pawel Wieczorkiewicz Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" This series introduces new features to the livepatch functionality as briefly discussed during Xen Developer Summit 2019: [a] and [b]. It also provides a few fixes and some small improvements. IMPROVEMENTS: 1. Ignore build system object files: [2] 2. Allow using symlink names for hotpatch modules: [3] Some build systems may want to use symlinks' names for resulting hotpatch modules. 3. Include for processing all newly created object files, resulting from building an applied patch: [4] This allows to add new code from within additional, patch-provided files. It's very useful for inline asm hotpatching as well as for introducing new functionality. 4. Add helper functions to unify handling of the common sections: [5], [6], [7], [9] 5. Detect and purge undefined symbols from resulting object files: [12], [13] This prevents the undefined symbols sneak into the resulting modules. It's especially useful when building stacked hotpatch modules, where each consecutive module is based on a previous one. 6. Strip redundant or transient symbols from resulting object files: [19], [20] This change limits the size of resulting modules by dropping unneeded bits. FIXES: 1. Make livepatch-gcc work with various gcc command name: [1] 2. Detect special sections' entry sizes automatically by analyzing xen-syms: [8] Instead of hard-coding group entry sizes, detect them the same way linux kernel's kpatch does. This fixes building hotpatch modules for recent Xen, where one of the special section's entry sizes changed. 3. Filter out redundant strings from .rodata sections: [10] This change limits the size of resulting modules by dropping unneeded bits. FEATURES: For details see cover letter of xen series: [c] 1. independent modules (patches: [14]) 2. pre- and post- apply|revert actions hooks (patches: [15]) 3. apply|revert actions replacement hooks (patches: [11], [16], [17]) 4. inline asm hotpatching expectations (patches: [18]) [a] https://wiki.xenproject.org/wiki/Design_Sessions_2019#LivePatch_improvements_and_features [b] https://lists.xenproject.org/archives/html/xen-devel/2019-07/msg00846.html [c] [PATCH 00/14] livepatch: new features and fixes Pawel Wieczorkiewicz (20): [1] livepatch-gcc: Allow toolchain command with versions [2] livepatch-gcc: Ignore built_in.o and prelink.o object files [3] livepatch-build: Do not follow every symlink for patch file [4] livepatch-build: Handle newly created object files [5] common: Add is_standard_section() helper function [6] common: Add is_referenced_section() helper function [7] create-diff-object: Add is_special_section() helper function [8] livepatch-build: detect special section group sizes [9] create-diff-object: Add new entries to special sections array [10] create-diff-object: Do not include all .rodata sections [11] create-diff-object: Do not create empty .livepatch.funcs section [12] create-diff-object: Extend patchability verification: STN_UNDEF [13] create-diff-object: Strip all undefined entires of known size [14] livepatch-build: Embed hypervisor build id into every hotpatch [15] create-diff-object: Handle extra pre-|post- hooks [16] create-diff-object: Handle optional apply|revert hooks [17] create-diff-object: Add support for applied/reverted marker [18] create-diff-object: Add support for expectations [19] livepatch-build: Strip transient or unneeded symbols [20] livepatch-build: Strip all metadata symbols from hotpatch modules common.c | 35 ++++- common.h | 16 +- create-diff-object.c | 425 ++++++++++++++++++++++++++++++++++++++++++++++----- livepatch-build | 124 ++++++++++++++- livepatch-gcc | 5 +- 5 files changed, 564 insertions(+), 41 deletions(-)