From patchwork Tue Apr 16 12:22:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wieczorkiewicz, Pawel" X-Patchwork-Id: 10902915 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6407014DB for ; Tue, 16 Apr 2019 12:29:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49C6D1FEBD for ; Tue, 16 Apr 2019 12:29:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3D68421F61; Tue, 16 Apr 2019 12:29:30 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_ADSP_ALL, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E5C7D1FEBD for ; Tue, 16 Apr 2019 12:29:29 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hGNBk-0002Na-4O; Tue, 16 Apr 2019 12:27:48 +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 1hGNBi-0002NC-0J for xen-devel@lists.xen.org; Tue, 16 Apr 2019 12:27:46 +0000 X-Inumbo-ID: 093fb258-6043-11e9-bcd7-ef1c06bc0b69 Received: from smtp-fw-2101.amazon.com (unknown [72.21.196.25]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 093fb258-6043-11e9-bcd7-ef1c06bc0b69; Tue, 16 Apr 2019 12:27:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1555417664; x=1586953664; h=from:to:cc:subject:date:message-id:mime-version; bh=+agKnEgjwVMOxVwdWUlwtG3G74v1cE4E/3qACRL/ABU=; b=IBg7Qd0bXm8ZbslZJqMFQfY4nPt++y+37cFFPqa34qfFa/DVrucRZCbA ti+W/iogQ+XxPaIqNRvg25l62t7icHqraeNgeKZJRkU9ngx0j4m2Vo/P/ z0xqNC+bRlmyvBTtSQ/pwRjNGQ2nh+Sl9XR0VkT+3jR5wIaU1Ip4oZ92K I=; X-IronPort-AV: E=Sophos;i="5.60,357,1549929600"; d="scan'208";a="728350734" Received: from iad6-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-2a-1c1b5cdd.us-west-2.amazon.com) ([10.124.125.2]) by smtp-border-fw-out-2101.iad2.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 16 Apr 2019 12:25:27 +0000 Received: from EX13MTAUEA001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan3.pdx.amazon.com [10.236.137.198]) by email-inbound-relay-2a-1c1b5cdd.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id x3GCMn01060813 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Tue, 16 Apr 2019 12:22:52 GMT Received: from EX13D03EUC002.ant.amazon.com (10.43.164.60) by EX13MTAUEA001.ant.amazon.com (10.43.61.243) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 16 Apr 2019 12:22:52 +0000 Received: from EX13MTAUEB001.ant.amazon.com (10.43.60.96) by EX13D03EUC002.ant.amazon.com (10.43.164.60) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 16 Apr 2019 12:22:51 +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; Tue, 16 Apr 2019 12:22:49 +0000 From: Pawel Wieczorkiewicz To: Date: Tue, 16 Apr 2019 12:22:39 +0000 Message-ID: <20190416122241.28342-1-wipawel@amazon.de> X-Mailer: git-send-email 2.16.5 MIME-Version: 1.0 Precedence: Bulk Subject: [Xen-devel] [livepatch-build-tools part3 1/3] create-diff-object: Do not create empty .livepatch.funcs section 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: mpohlack@amazon.de, ross.lagerwall@citrix.com, Pawel Wieczorkiewicz , konrad.wilk@oracle.com Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP When there is no changed function in the generated payload, do not create an empty .livepatch.funcs section. Hypervisor code considers such payloads as broken and rejects to load them. Such payloads without any changed functions may appear when only hooks are specified. Signed-off-by: Pawel Wieczorkiewicz Reviewed-by: Martin Mazein Reviewed-by: Martin Pohlack CR: https://code.amazon.com/reviews/CR-7368634 Reviewed-by: Ross Lagerwall --- create-diff-object.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/create-diff-object.c b/create-diff-object.c index 82f777e..af2245c 100644 --- a/create-diff-object.c +++ b/create-diff-object.c @@ -1744,6 +1744,11 @@ static void livepatch_create_patches_sections(struct kpatch_elf *kelf, if (sym->type == STT_FUNC && sym->status == CHANGED) nr++; + if (nr == 0) { + log_debug("No changed functions found. Skipping .livepatch.funcs section creation\n"); + return; + } + /* create text/rela section pair */ sec = create_section_pair(kelf, ".livepatch.funcs", sizeof(*funcs), nr); relasec = sec->rela;