From patchwork Tue Sep 12 00:37:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Rzeszutek Wilk X-Patchwork-Id: 9948225 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D749E603F4 for ; Tue, 12 Sep 2017 00:41:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C2B5128DA2 for ; Tue, 12 Sep 2017 00:41:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B59E328DA3; Tue, 12 Sep 2017 00:41:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RCVD_IN_SORBS_SPAM,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2141D28D56 for ; Tue, 12 Sep 2017 00:41:04 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1drZDF-0000j6-DU; Tue, 12 Sep 2017 00:38:01 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1drZDD-0000ha-Tx for xen-devel@lists.xenproject.org; Tue, 12 Sep 2017 00:38:00 +0000 Received: from [85.158.143.35] by server-11.bemta-6.messagelabs.com id 73/0A-03616-76C27B95; Tue, 12 Sep 2017 00:37:59 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrPIsWRWlGSWpSXmKPExsVyMfTOYd1kne2 RBjs6pCy+b5nM5MDocfjDFZYAxijWzLyk/IoE1oz1hyeyFSyVqGiaY97A+Eyki5GLQ0hgBqPE 1U3n2UAcFoEPLBJvdv5kB3EkBKaxStzZPZ+1i5ETyImT+LZlLyOEnSYx88pGNgi7SuLBrWNgc SEBJYktkx8zQow9yCTRffcpWEJYQE9i8rfbYDabgL7E07XXmLsYOYCa3SQ+XeMCqRcRaGeUmH 3lF9gyZgFDida3R9lAaoQFwiUmNyaBhFkEVCXmXjzNBGLzClhKNN6dA3WPvMTE3mlgNqeAlcT vH/NYIe6xlOhYcIVpAqPwAkaGVYwaxalFZalFukbGeklFmekZJbmJmTm6hgZmermpxcWJ6ak5 iUnFesn5uZsYgQHKAAQ7GP/MDzzEKMnBpCTK+1t4e6QQX1J+SmVGYnFGfFFpTmrxIUYZDg4lC V5DbaCcYFFqempFWmYOMFZg0hIcPEoivFlaQGne4oLE3OLMdIjUKUZLjgt3Lv1h4jiw5xaQ7L h59w+TEEtefl6qlDhvEcg8AZCGjNI8uHGweL7EKCslzMsIdKAQT0FqUW5mCar8K0ZxDkYlYd5 kkCk8mXklcFtfAR3EBHQQz6UtIAeVJCKkpBoY5z1yLWFYFjXBPbV++u+2KVf4a/8LS+9ltPGb a9fc/6br98YT7SzdjT8PXvJYZ3Qi41F/T8EL3YMXV9oW7Xrw+8nX4+5TtlUW3fPJfOVqfXNKq 5pmptqRWTOFdJhj2w0+cbyRujVpiWRI8qH1TwRnl+To7HcPTZhcl2bMdFL5eFtYfdW3qVUiSi zFGYmGWsxFxYkA7uQB1+ICAAA= X-Env-Sender: ketuzsezr@gmail.com X-Msg-Ref: server-8.tower-21.messagelabs.com!1505176674!82217238!1 X-Originating-IP: [209.85.220.195] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 63004 invoked from network); 12 Sep 2017 00:37:55 -0000 Received: from mail-qk0-f195.google.com (HELO mail-qk0-f195.google.com) (209.85.220.195) by server-8.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 12 Sep 2017 00:37:55 -0000 Received: by mail-qk0-f195.google.com with SMTP id d70so6379079qkc.1 for ; Mon, 11 Sep 2017 17:37:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=PmgiV95O4AfgbjeW83b4jR/Z+8Mqj8PQ4it0JikpF/U=; b=pzdaOIhkFBoc3q1l0KAbRxaYauENmyTZUEzdDo4VeiEu35xomzOr9QLTOrn0F/0O2R Lh6xOTeEjMc9H1yOg8zdXNxW3RQdjXwHe7wMLRAVL/AeqCK7V17zQplARWE7tVt77mH4 kN5pdtF1HuIK+o/xFle6ro6S/wIT80Hb7KSLjmB8tKH+2r5XTKgcTMKmRM2w3h9LKV0N egOXR6pW0qu0daEuTFzOMNRTN6QFWpaWsIMJYcuNqWtSDN96nzWtl/IHpaXGYoJQhZSn uNJi+SaTMRLNQtvLMn2/iL5v4yTZ+DflHbNLe2OWt3LBP+gcaQvoE3Lvxy3Web2Lvz+k 8dBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=PmgiV95O4AfgbjeW83b4jR/Z+8Mqj8PQ4it0JikpF/U=; b=KzwICHbyjRVCh6dgHWwrD/sjRBNAYMeMet2SKMZLwxPDCM+bt1rQSg2TQaJa5pJwLl nrzUzrerllDVekA7DSllYBa28glk5aL6eNvV1xM4lToaXQpZqgsSud7JYzwmwUueiGLd oyMx5uQEdXDPt7CwfqpjbNr2HaUuOLXHctW4g80Ad3/do2tAxHQDdPUCPxyDd9qysvkZ d7LsgEmKAQKLyvEhqkO4FGLU7qmRMRygh0CN9dU2e2mn1yRnVyA8zVr13Vebvr+QrBeB /dXUWgKwFHHKvPdND7TD9Qj6TDolzakzRFCOmf8I+uh6hEQ54xDYFLyTrE0ed37ypls9 No/g== X-Gm-Message-State: AHPjjUhQbqPl0LEQbDkEVqWMiWWHK2D8NBIiU8xOk2rzuxR1oSt89a5w CTPrGkInkmHcIWrg X-Google-Smtp-Source: AOwi7QDtK4AqOc5CQmqoZsfxGxzTk5WVl4b8+V2GwMmE7TqzHVRIsmT7bpM1+arV1M+RRWvqYbx3Cw== X-Received: by 10.55.175.65 with SMTP id y62mr16521101qke.275.1505176673991; Mon, 11 Sep 2017 17:37:53 -0700 (PDT) Received: from localhost.localdomain (209-6-200-48.s4398.c3-0.smr-ubr2.sbo-smr.ma.cable.rcncustomer.com. [209.6.200.48]) by smtp.gmail.com with ESMTPSA id z75sm6771034qkb.71.2017.09.11.17.37.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Sep 2017 17:37:53 -0700 (PDT) From: Konrad Rzeszutek Wilk X-Google-Original-From: Konrad Rzeszutek Wilk To: xen-devel@lists.xenproject.org, ross.lagerwall@citrix.com, konrad.wilk@oracle.com, julien.grall@arm.com, sstabellini@kernel.org Date: Mon, 11 Sep 2017 20:37:16 -0400 Message-Id: <20170912003726.368-8-konrad.wilk@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170912003726.368-1-konrad.wilk@oracle.com> References: <20170912003726.368-1-konrad.wilk@oracle.com> Cc: andrew.cooper3@citrix.com, jbeulich@suse.com Subject: [Xen-devel] [PATCH v3 07/17] livepatch/arm/x86: Strip note_depends symbol from test-cases. X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP This surfaced due to "xen/livepatch/x86/arm32: Force .livepatch.depends section to be uint32_t aligned." which switched to a different way of including the build-id. Each livepatch ends with a global: 30: 00000000 1 OBJECT GLOBAL HIDDEN 7 note_depends which will cause collision when loading. One attempted solution was to add in the Makefile stanza: @sed -i '/unsigned/static unsinged/' $@ But that resulted in the note_depends being omitted from the livepatch (as it was static and not used) which meant we would not have an .livepatch_depends section which we require. The solution to this is to remove the symbol via the --strip-symbols after generating the livepatch. However that fails as note_depends is in use by .rel.debug_info: Relocation section '.rel.debug_info' at offset 0x151c contains 113 entries: Offset Info Type Sym.Value Sym. Name .. 00000625 00001e02 R_ARM_ABS32 00000000 note_depends And the solution to that is to also slap on --strip-debug which removes various .debug* sections (which livepatch ignores anyhow): .debug_aranges, .debug_info, .debug_abbrev, .debug_line, .debug_frame, .debug_str, and their .rel.* sections. And that will remove that. Alternatively we could also use --localize-symbol so that note_depends is not globally visible. But that won't help as hypervisor treats both local and global symbols as global when resolving them. (This is fixed in "livepatch: Add local and global symbol resolution." but that patch is stuck in limbo). Signed-off-by: Konrad Rzeszutek Wilk --- v3: First version --- xen/test/livepatch/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xen/test/livepatch/Makefile b/xen/test/livepatch/Makefile index 89ad89dfd5..9e73861732 100644 --- a/xen/test/livepatch/Makefile +++ b/xen/test/livepatch/Makefile @@ -53,6 +53,7 @@ xen_hello_world.o: config.h livepatch_depends.h .PHONY: $(LIVEPATCH) $(LIVEPATCH): xen_hello_world_func.o xen_hello_world.o $(LD) $(LDFLAGS) $(build_id_linker) -r -o $(LIVEPATCH) $^ + $(OBJCOPY) --strip-debug --strip-symbol=$(NOTE_SYMBOL) $@ # # This target is only accessible if CONFIG_LIVEPATCH is defined, which @@ -88,18 +89,21 @@ xen_bye_world.o: config.h hello_world_livepatch_depends.h .PHONY: $(LIVEPATCH_BYE) $(LIVEPATCH_BYE): xen_bye_world_func.o xen_bye_world.o $(LD) $(LDFLAGS) $(build_id_linker) -r -o $(LIVEPATCH_BYE) $^ + $(OBJCOPY) --strip-debug --strip-symbol=$(NOTE_SYMBOL) $@ xen_replace_world.o: config.h livepatch_depends.h .PHONY: $(LIVEPATCH_REPLACE) $(LIVEPATCH_REPLACE): xen_replace_world_func.o xen_replace_world.o $(LD) $(LDFLAGS) $(build_id_linker) -r -o $(LIVEPATCH_REPLACE) $^ + $(OBJCOPY) --strip-debug --strip-symbol=$(NOTE_SYMBOL) $@ xen_nop.o: config.h livepatch_depends.h .PHONY: $(LIVEPATCH_NOP) $(LIVEPATCH_NOP): xen_nop.o $(LD) $(LDFLAGS) $(build_id_linker) -r -o $(LIVEPATCH_NOP) $^ + $(OBJCOPY) --strip-debug --strip-symbol=$(NOTE_SYMBOL) $@ .PHONY: livepatch livepatch: $(LIVEPATCH) $(LIVEPATCH_BYE) $(LIVEPATCH_REPLACE) $(LIVEPATCH_NOP)