From patchwork Tue Jul 11 16:53:12 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: 9835255 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 6CEE9602A0 for ; Tue, 11 Jul 2017 16:55:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E0CC28577 for ; Tue, 11 Jul 2017 16:55:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5229728599; Tue, 11 Jul 2017 16:55: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.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM,UNPARSEABLE_RELAY 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 CD79B28577 for ; Tue, 11 Jul 2017 16:55: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 1dUyPh-0006ud-UF; Tue, 11 Jul 2017 16:53:29 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dUyPg-0006uA-18 for xen-devel@lists.xenproject.org; Tue, 11 Jul 2017 16:53:28 +0000 Received: from [85.158.143.35] by server-9.bemta-6.messagelabs.com id F6/8E-03406-78205695; Tue, 11 Jul 2017 16:53:27 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprNIsWRWlGSWpSXmKPExsXSO6nOVbeNKTX S4MV6U4vvWyYzOTB6HP5whSWAMYo1My8pvyKBNePduf9sBR+4Kx5tWMbcwNjF2cXIxSEkMJFJ YsHSaawQzjdGibcTpzNDOBsYJZ4fPcAG4XQzSpx9dB+ojBPIKZLoXXsTqIqDg03AROLNKkeQs IiArUT7ohVgk5gF5jFK/D/zggUkISzgIbH86A9mEJtFQFXi8apTjCA2r4C1xLRn28FmSgjISV za9gWshlPARuLvwjZGiF3WEj+7ZkHVGEqcfriNcQIj/wJGhlWMGsWpRWWpRbqGpnpJRZnpGSW 5iZk5uoYGZnq5qcXFiempOYlJxXrJ+bmbGIFBxAAEOxi/LQs4xCjJwaQkyhsUmxIpxJeUn1KZ kVicEV9UmpNafIhRhoNDSYJXgjE1UkiwKDU9tSItMwcYzjBpCQ4eJRHe+L9ArbzFBYm5xZnpE KlTjMYcG1av/8LE8WrC/29MQix5+XmpUuK8FiCTBEBKM0rz4AbB4uwSo6yUMC8j0GlCPAWpRb mZJajyrxjFORiVhHmXgkzhycwrgdv3CugUJqBT1mSDnVKSiJCSamD062ja8Flz6zrVp8VuF1b PL+lT2bCoftV5ybBTbVVleZoXwsr1v25q0ag9dudxZMW1G+LlL2x1dv82W9oT9/i7fPklTgav k3IfbZ8+bjffsfeldxOj07rWV/X96cL/Bf4LvXHk5e9oXxaQL8q0U/esbltPgJBmaMfFPyZze UIPTTls2vRSL1uJpTgj0VCLuag4EQAnMpyurgIAAA== X-Env-Sender: konrad@char.us.oracle.com X-Msg-Ref: server-9.tower-21.messagelabs.com!1499792005!72616225!1 X-Originating-IP: [141.146.126.69] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTQxLjE0Ni4xMjYuNjkgPT4gMjc3MjE4\n X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 54467 invoked from network); 11 Jul 2017 16:53:26 -0000 Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by server-9.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 11 Jul 2017 16:53:26 -0000 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v6BGrHa6025808 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2017 16:53:18 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v6BGrGSi002354 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 11 Jul 2017 16:53:17 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id v6BGrGHK030805; Tue, 11 Jul 2017 16:53:16 GMT Received: from char.us.oracle.com (/10.137.176.158) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 11 Jul 2017 09:53:15 -0700 Received: by char.us.oracle.com (Postfix, from userid 1000) id DFEB86A0142; Tue, 11 Jul 2017 12:53:14 -0400 (EDT) From: Konrad Rzeszutek Wilk To: xen-devel@lists.xenproject.org, ross.lagerwall@citrix.com Date: Tue, 11 Jul 2017 12:53:12 -0400 Message-Id: <20170711165313.26497-3-konrad.wilk@oracle.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170711165313.26497-1-konrad.wilk@oracle.com> References: <20170711165313.26497-1-konrad.wilk@oracle.com> X-Source-IP: userv0021.oracle.com [156.151.31.71] Cc: andrew.cooper3@citrix.com, julien.grall@arm.com, sstabellini@kernel.org, jbeulich@suse.com, Konrad Rzeszutek Wilk Subject: [Xen-devel] [PATCH v1 2/3] livepatch: Include sizes when an mismatch occurs 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 If the .bug.frames.X or .livepatch.funcs sizes are different than what the hypervisor expects - we fail the payload. To help in diagnosing this include the expected and the payload sizes. Signed-off-by: Konrad Rzeszutek Wilk --- xen/common/livepatch.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c index 5d53096..c0eb609 100644 --- a/xen/common/livepatch.c +++ b/xen/common/livepatch.c @@ -520,8 +520,8 @@ static int prepare_payload(struct payload *payload, ASSERT(sec); if ( sec->sec->sh_size % sizeof(*payload->funcs) ) { - dprintk(XENLOG_ERR, LIVEPATCH "%s: Wrong size of "ELF_LIVEPATCH_FUNC"!\n", - elf->name); + dprintk(XENLOG_ERR, LIVEPATCH "%s: Wrong size of "ELF_LIVEPATCH_FUNC"! (exp: %zu vs %"PRIuElfWord")\n", + elf->name, sizeof(*payload->funcs), sec->sec->sh_size); return -EINVAL; } @@ -648,8 +648,9 @@ static int prepare_payload(struct payload *payload, if ( sec->sec->sh_size % sizeof(*region->frame[i].bugs) ) { - dprintk(XENLOG_ERR, LIVEPATCH "%s: Wrong size of .bug_frames.%u!\n", - elf->name, i); + dprintk(XENLOG_ERR, LIVEPATCH "%s: Wrong size of .bug_frames.%u! (exp: %zu vs %"PRIuElfWord")\n", + elf->name, i, sizeof(*region->frame[i].bugs), + sec->sec->sh_size); return -EINVAL; }