From patchwork Tue Sep 12 00:37:10 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: 9948229 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 2FE5C604D5 for ; Tue, 12 Sep 2017 00:41:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1FDCA28D6F for ; Tue, 12 Sep 2017 00:41:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 12E3E28D9E; Tue, 12 Sep 2017 00:41:10 +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 2B9B628D6F 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 1drZD7-0000dM-IW; Tue, 12 Sep 2017 00:37:53 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1drZD6-0000cP-5U for xen-devel@lists.xenproject.org; Tue, 12 Sep 2017 00:37:52 +0000 Received: from [85.158.139.211] by server-13.bemta-5.messagelabs.com id 13/B3-01754-F5C27B95; Tue, 12 Sep 2017 00:37:51 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrAIsWRWlGSWpSXmKPExsVyMfTOYd0Yne2 RBot+KVh83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBk3f01nLFjAWfHzt2sD4yH2LkYuDiGBGYwS l+8tZgVxWAQ+sEgcuruKBcSREJjGKjGl6yCQwwnkxElM3TaVFcJOk1i1vJcJwq6UWLx0GTOIL SSgJLFl8mNGiLEHmSQefd0B1iAsoCcx+dttRhCbTUBf4unaa0ANHEDNbhKfrnGB1IsItDNKzL 7yC6yeWcBQovXtUTaI3lSJrR9usYPYLAKqEptnTgRbzCtgKfFu02tGiCPkJSb2TgOzOQWsJH7 /mMcKcZClRMeCK0wTGIUXMDKsYtQoTi0qSy3SNTLVSyrKTM8oyU3MzNE1NDDVy00tLk5MT81J TCrWS87P3cQIDNF6BgbGHYy72v0OMUpyMCmJ8v4W3h4pxJeUn1KZkVicEV9UmpNafIhRhoNDS YL3hRZQTrAoNT21Ii0zBxgtMGkJDh4lEd4skDRvcUFibnFmOkTqFKMlx4U7l/4wcRzYcwtIdt y8+4dJiCUvPy9VSpz3N0iDAEhDRmke3DhYRF9ilJUS5mVkYGAQ4ilILcrNLEGVf8UozsGoJMy brA00hSczrwRu6yugg5iADuK5tAXkoJJEhJRUA+OmM8e3+03nEt/+gG3KPNYE+aWin2rLjuVN z8/f+Sxx8sx/86S+9B+Ye87udcD6hIrzh0VMZ6i27jzF5zvBy+2Y+IW0zXEfDPs/q+5pv1Hsb 8O6IE+pQcjo5rkVUeeOdHemP+m8cnPR96x9Wu+VPVK8pmZfjj91IPLG4ybn1SE9s05m9rPeCj BTYinOSDTUYi4qTgQAkmQgQeMCAAA= X-Env-Sender: ketuzsezr@gmail.com X-Msg-Ref: server-16.tower-206.messagelabs.com!1505176667!91032116!1 X-Originating-IP: [209.85.220.195] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 51182 invoked from network); 12 Sep 2017 00:37:48 -0000 Received: from mail-qk0-f195.google.com (HELO mail-qk0-f195.google.com) (209.85.220.195) by server-16.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 12 Sep 2017 00:37:48 -0000 Received: by mail-qk0-f195.google.com with SMTP id d70so6378906qkc.1 for ; Mon, 11 Sep 2017 17:37:48 -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=Jv7ozAWtKgMD2rLbHPiKjk5PUSeEmln4ZkNuY03hGx8=; b=h/LUg+aSVkiUzApVIi7nurdHyRMNLwXPu4vUhvodf+dDJoDjCWL0iYFLdqmOVkfE7K TdcDJa/x4fUHxtrzaZmt5/4/ya0xTp4PiXinQp/2LpL5iYSYSrgDSh0C8pyPH9IExB80 mqEEYojZcCBgpWj0sbe/EkEwLCnxh8X67w2pjxbkGM4yCW2+mdVQ2E3Lk/N4k1AMRh56 IuN+lkb0sZsWdf9mjsPvlAGKVD8kbiRc2aHtvUhaANggqmI8WyRQ9Wob8Uy58NBOitOJ MbJdplO8dqmvSVfgxNR21lERTiwwvbg06w6TytDgmNGB+RfuhClYeo7luNSiQiSrhBTS e8Pg== 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=Jv7ozAWtKgMD2rLbHPiKjk5PUSeEmln4ZkNuY03hGx8=; b=pRu9UC1KOuglY1pGz/dYsC9WVDb5InOTWJrhNVnO/sF6YrwhmPr7kBDcSuLci4p0+c ptLf228n+wAUcS3lBkatYUFi/9Haf4GCUeFsNxdrGhOx58s7JQ/CUsYX52qxEJiZU1xo ILiBCLkaAJCHbUIEB+TzGmJxD1v1yj92IA3uYv6iJPPcydVp4UxudST7bKHmIH8Pfiku /9aO7o35bKDz6mNXGYfMRQe36Wr49nScWWsLfhKBqwbIi7guQqMk03PDBdRFpOZ6xYdH 4JSQ261lgAEAX9w84DppC91EXaL6uHXm9JS7eqeOgh/HSZ0WHE4swLbiSjCF9dpjDMVd LYEw== X-Gm-Message-State: AHPjjUinCJEGYUge9PM2SYsL87B5surmWOmg5gQFolUAwQTGCcvCQzdh osDhpa/IMKBh50VN X-Google-Smtp-Source: AOwi7QD7JxusrkvA13iW2tHZ5oY9OoFPCdEZRkVFjeVF/g4tU6MvaRv4LvmQKnefT+DpeEqwdPNK0Q== X-Received: by 10.55.75.75 with SMTP id y72mr17282216qka.118.1505176667068; Mon, 11 Sep 2017 17:37:47 -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.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Sep 2017 17:37:46 -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:10 -0400 Message-Id: <20170912003726.368-2-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 01/17] livepatch: Expand check for safe_for_reapply if livepatch has only .rodata. 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 livepatch has only .rodata sections then it is OK to also apply/revert/apply the livepatch without having to worry about the unforseen consequences. See commit 98b728a7b235c67e210f67f789db5d9eb38ca00c "livepatch: Disallow applying after an revert" for details. Signed-off-by: Konrad Rzeszutek Wilk --- v3: New patch --- xen/common/livepatch.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c index 66d532db14..a1f54c42d3 100644 --- a/xen/common/livepatch.c +++ b/xen/common/livepatch.c @@ -417,9 +417,12 @@ static int move_payload(struct payload *payload, struct livepatch_elf *elf) } } - /* Only one RW section with non-zero size: .livepatch.funcs */ - if ( rw_buf_cnt == 1 && - !strcmp(elf->sec[rw_buf_sec].name, ELF_LIVEPATCH_FUNC) ) + /* + * Only one RW section with non-zero size: .livepatch.funcs, + * or only RO sections. + */ + if ( !rw_buf_cnt || (rw_buf_cnt == 1 && + !strcmp(elf->sec[rw_buf_sec].name, ELF_LIVEPATCH_FUNC)) ) payload->safe_to_reapply = true; out: xfree(offset);