From patchwork Wed Sep 20 22:31:45 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: 9962705 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 4847C601D5 for ; Wed, 20 Sep 2017 22:34:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B00B29258 for ; Wed, 20 Sep 2017 22:34:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2FD2729276; Wed, 20 Sep 2017 22:34:46 +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 26A292926F for ; Wed, 20 Sep 2017 22:34:45 +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 1dunXV-0007KE-GS; Wed, 20 Sep 2017 22:32:17 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dunXU-0007Hn-Kx for xen-devel@lists.xenproject.org; Wed, 20 Sep 2017 22:32:16 +0000 Received: from [85.158.143.35] by server-8.bemta-6.messagelabs.com id 16/96-17770-F6CE2C95; Wed, 20 Sep 2017 22:32:15 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrAIsWRWlGSWpSXmKPExsVyMfTGYd2cN4c iDa4uNbT4vmUykwOjx+EPV1gCGKNYM/OS8isSWDNm7D/NXNAsU9HUe5+9gXGqRBcjF4eQwAxG icfbnzCCOCwCH1gk1nxsZ+1i5OSQEJjGKrH6eiGEnSWxYv0tNgg7TeJL4ypGCLtSYtnKRcwgt pCAksSWyY8ZIaYeYpJ4f3EJC0hCWEBPYvK322ANbAL6Ek/XXgNq4ABqdpP4dI0LpF5EoJ1RYv aVX2CLmQUMJVrfHmWD6I2QeLZiMVgvi4CqxJ2GeWAzeQWsJX7/vw91kLzExN5pYDWcAjYS+z9 1Qh1kLfFk62m2CYzCCxgZVjFqFKcWlaUW6RqZ6yUVZaZnlOQmZuboGhqY6eWmFhcnpqfmJCYV 6yXn525iBIYoAxDsYFy8NvAQoyQHk5Ior/XLQ5FCfEn5KZUZicUZ8UWlOanFhxhlODiUJHgTX gPlBItS01Mr0jJzgNECk5bg4FES4fUASfMWFyTmFmemQ6ROMVpyXLhz6Q8Tx4E9t4Bkx827f5 iEWPLy81KlxHm/vgJqEABpyCjNgxsHi+hLjLJSwryMQAcK8RSkFuVmlqDKv2IU52BUEub1Bln Lk5lXArf1FdBBTEAHZW84AHJQSSJCSqqBcbaNyhIL59cHl/3Y0cjeuGSW85vL/H/u/ljwRWpT 9Y/IPq1Ya85TOWzvnqlM3vmGf0aLz8aPQjfv3P4Q81r0wrErDO1yhqw/b2ZnTxL/9YT1V+T15 uLty5LrC2TiJ32wCdV9EzJ9SodCEgPfpHrH2RZbP6/50zhjj94OlsbQp6+XX7k4+cLTNd1KLM UZiYZazEXFiQC3fFSE4wIAAA== X-Env-Sender: ketuzsezr@gmail.com X-Msg-Ref: server-3.tower-21.messagelabs.com!1505946732!80368652!1 X-Originating-IP: [209.85.216.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 51617 invoked from network); 20 Sep 2017 22:32:12 -0000 Received: from mail-qt0-f195.google.com (HELO mail-qt0-f195.google.com) (209.85.216.195) by server-3.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 20 Sep 2017 22:32:12 -0000 Received: by mail-qt0-f195.google.com with SMTP id l25so2669149qtf.2 for ; Wed, 20 Sep 2017 15:32:12 -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=zCzxD39odmuGYU1FEZVP9yQIySX7wqjyk6moivCx+2I=; b=ov1YqWl7P2zIubdhiEuyLxUS4OfzGS0DUezapZcw0OjomeW4DQa/Mp7Co+3otggfck 0n/yjoHrILa7ABEyfRcyTbS+PTs0NkPuXdnRp6X1qVkeVARyK8hT2DONDp9foRpDYGoX vaDHQTgEQctNadMaT7me/K5uHeU2/cEfkxAx9KkUDMgx6ww7tuj7DzEW95FmDrAen0iT 3qRGXYO06rFcy/4s5IR1iion9kFlY4fCLqYWSWeLBM3C1doJj4LHsb9/l8do4bsiyyHt qZvLZvrIvzzbae7Y9duLKuL7bc4ryba7jJFqCQkZ9cPlOsqt4vUWuEzRqnXHynyz5oNW cAUw== 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=zCzxD39odmuGYU1FEZVP9yQIySX7wqjyk6moivCx+2I=; b=pyFk4/mP1J7gbtpUSu/GEL219gZx8letTgNpJvJQBBOKgxUB0PLXxS/uOZCKCQwpyN eH0PHmfV4IFWQgZGmxY18odhgc9Xa9gipuM8neij6VzQY0Gwkbn6iLMJiwY3mrXYBpcv fo/YL00GYOCptVm3Fd1y86o9VhyNpD+wDiOvq+H6BWY/QJZM4ceoPaZinXc7xB9lp0B6 G+8S2BICZxzuXFbr4A9h8buRQGTa3AaXvqanyLvJ6rJ4zO+b3d0v/Y+CLiw7T0YF8Axt eltMhMA+id7pXcAUPhfzvtcp7e9BrBt2BHjRv+q6kiIzFha25wd/Xa+tn97VWAm2CR1w tDzw== X-Gm-Message-State: AHPjjUh35MPLi2ABikabjCe7GQch9k+D0we5yrewjKQPz5Yw+jeO4ABc sFNRSjnIQcai11CIa1r+CpBAHg== X-Google-Smtp-Source: AOwi7QBxHQ2TIPFL2dUJUW5nWjMZfU9hnR6x5og7Q/+fKjQJEzOXURFKbjrlON1sX2UugIdAG2C+2g== X-Received: by 10.200.52.117 with SMTP id v50mr341878qtb.333.1505946731495; Wed, 20 Sep 2017 15:32:11 -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 z192sm2012656qka.91.2017.09.20.15.32.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Sep 2017 15:32:11 -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: Wed, 20 Sep 2017 18:31:45 -0400 Message-Id: <20170920223148.13137-9-konrad.wilk@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170920223148.13137-1-konrad.wilk@oracle.com> References: <20170920223148.13137-1-konrad.wilk@oracle.com> Cc: andrew.cooper3@citrix.com, jbeulich@suse.com Subject: [Xen-devel] [PATCH v4 08/11] livepatch/arm/x86: Rename 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. One solution 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 patch decides to pick an easier path, just rename the symbol by prefixing it with the name of the livepatch: $ nm *.livepatch | grep depend 0000000000000000 R xen_bye_world.livepatch_note_depends 0000000000000000 R xen_hello_world.livepatch_note_depends 0000000000000000 R xen_local_symbols.livepatch_note_depends 0000000000000000 R xen_nop.livepatch_note_depends 0000000000000000 R xen_replace_world.livepatch_note_depends Signed-off-by: Konrad Rzeszutek Wilk --- Cc: Ross Lagerwall v3: First posting. v4: Instead of stripping the symbol (and also using --strip-debug), just rename the symbol. --- xen/test/livepatch/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xen/test/livepatch/Makefile b/xen/test/livepatch/Makefile index d23833e36f..b48669cc13 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) --redefine-sym $(NOTE_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) --redefine-sym $(NOTE_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) --redefine-sym $(NOTE_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) --redefine-sym $(NOTE_SYMBOL)=$@_$(NOTE_SYMBOL) $@ .PHONY: livepatch livepatch: $(LIVEPATCH) $(LIVEPATCH_BYE) $(LIVEPATCH_REPLACE) $(LIVEPATCH_NOP)