From patchwork Wed Sep 20 22:31:38 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: 9962703 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 C6AC26056A for ; Wed, 20 Sep 2017 22:34:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B96C529258 for ; Wed, 20 Sep 2017 22:34:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE2FB29276; Wed, 20 Sep 2017 22:34:45 +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 54BFE29258 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 1dunXN-0007Dr-12; Wed, 20 Sep 2017 22:32:09 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dunXL-0007DY-OL for xen-devel@lists.xenproject.org; Wed, 20 Sep 2017 22:32:07 +0000 Received: from [85.158.137.68] by server-6.bemta-3.messagelabs.com id 30/02-02225-66CE2C95; Wed, 20 Sep 2017 22:32:06 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrPIsWRWlGSWpSXmKPExsVyMfTGQd20N4c iDT4sY7f4vmUykwOjx+EPV1gCGKNYM/OS8isSWDP2XN3GUnCVs6J7xWG2BsZP7F2MnBxCAjMY JWZfSehi5OJgEfjAIrHzxQU2kISEwDRWidYP3BB2lsTROxdZIOw0ie5Nv9gh7AqJlUsnskIMU pLYMvkxI8ggIYFDTBKfrh5kAkkIC+hJTP52mxHEZhPQl3i69hpzFyMHULObxKdrXCD1IgLtIE f8AhvELGAo0fr2KBtEb6pE26sJYHEWAVWJDU/6wObwClhL/J9/CupQeYmJvdPA4pwCNhL7P3U yQxxkLfFk62m2CYzCCxgZVjFqFKcWlaUW6RqZ6iUVZaZnlOQmZuboGhoY6+WmFhcnpqfmJCYV 6yXn525iBAZoPQMD4w7G1hN+hxglOZiURHmtXx6KFOJLyk+pzEgszogvKs1JLT7EKMPBoSTBm /AaKCdYlJqeWpGWmQOMFZi0BAePkgivB0iat7ggMbc4Mx0idYrRkuPCnUt/mDgO7LkFJDtu3v 3DJMSSl5+XKiXOOwOkQQCkIaM0D24cLJ4vMcpKCfMyMjAwCPEUpBblZpagyr9iFOdgVBLm7QK ZwpOZVwK39RXQQUxAB2VvOAByUEkiQkqqgVFDyFP/oXLboSon5f1FirYKV61LrO8e5uZ6+/HO bCvhA/sbdq70YsjWrPw37eOXuQKrdGyfzv/W68iuvnr1jqogNY6X+YXr2gNESrMmdcc4z5v08 15JPEPgPRbuuvXKx5SqSpqW6sR/Yyw6drOpuML1xKeWqDtbZ/p/aVH5eO57q6XdlOuPXZVYij MSDbWYi4oTASCW3xziAgAA X-Env-Sender: ketuzsezr@gmail.com X-Msg-Ref: server-2.tower-31.messagelabs.com!1505946725!104086539!1 X-Originating-IP: [209.85.216.193] 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 47811 invoked from network); 20 Sep 2017 22:32:06 -0000 Received: from mail-qt0-f193.google.com (HELO mail-qt0-f193.google.com) (209.85.216.193) by server-2.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 20 Sep 2017 22:32:06 -0000 Received: by mail-qt0-f193.google.com with SMTP id l25so2668958qtf.2 for ; Wed, 20 Sep 2017 15:32:05 -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=t4DgUbO+2ULFuoof3SFUYdp6Mnztf6ugjrRYan4q+p0=; b=aJLqs9kufOCAwSwk1mZ9WE/nMiPHj4ZXHYsyotqyOrSzrdd2hRZf8GFzHKtzsqfiVx h+1FaLcIU1iqDoRN1Foa1t1Fgr87ZOobtP9iXoHpIn2+SoK+DCSpp9p3fc7D+f4zVBGk yVQLfRVrRkY/PD+bFvmautZZkNyzP2ridemD9rDHlIrUvt3zuIyKLAkxMb8fCJ74M2Ff 5M0Mc0KkXNKLXO++sWheU608GoxoeuHIw8YwdBmXO5aXInJOB7ZNzo/A1F/QGDuDbzHb UxWxErK6Dsm104RMiVLa09dZ6bZp9uz+aDOj6iNwlBmK7ac8neL45amfP54Wk6pJvLc3 oskw== 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=t4DgUbO+2ULFuoof3SFUYdp6Mnztf6ugjrRYan4q+p0=; b=rb9LQ4k8S9tVA3H8dOGED7w2Sy6zDCrjz150+ClFT4WLVVlHZHBYW2Q7PjIcux+orw 5yrsBa8wU6RPfAGXXS/kSLBW5TRuhRF+R3pPdJEnoZivgR2I7uMz18/pgdCMiMyOaGgb 788H4JsMwdopJTVUx96oCzF4NSD/vWYMiwL8vbdmYRdiN2dsFahsv9Ow5xgkBwqy8B0v ywZPsNE8IaKmLyH1QXn07z7eAQJrm7UsA/WyYNOWwxtZhrLWbJI9KsStk5N+waYatNcq 8Ayo2DZOEW2pl+sRzNzn3e8wPvs/Up1jADpXAaC0OjTtv0PVz5djZ1sO05tiXVRwT97h Z/3g== X-Gm-Message-State: AHPjjUilVsQ6LxTfefxGMcigZZekEFtNKX94TbtVP36u8/joBjDrAzEY m8E2k6y55Yu+aStuiVHgTT2LMQ== X-Google-Smtp-Source: AOwi7QAmWhKCrp5VlGEtkQGerd+IKN03mNDfbMnYEbrAk/vKcNbjiH7T17Y8W+/44+gRdt4iPipJEQ== X-Received: by 10.237.37.14 with SMTP id v14mr377840qtc.116.1505946724776; Wed, 20 Sep 2017 15:32:04 -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.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Sep 2017 15:32:04 -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:38 -0400 Message-Id: <20170920223148.13137-2-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 01/11] 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 Reviewed-by: Ross Lagerwall --- Cc: Ross Lagerwall v3: First posting. --- 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 66167a5573..b0dcd415ba 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);