From patchwork Tue Nov 26 12:25:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wieczorkiewicz, Pawel" X-Patchwork-Id: 11262097 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CD84A15AC for ; Tue, 26 Nov 2019 12:26:30 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AAE662068E for ; Tue, 26 Nov 2019 12:26:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amazon.de header.i=@amazon.de header.b="gK679cuC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AAE662068E Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amazon.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iZZuZ-0004Wv-TN; Tue, 26 Nov 2019 12:25:43 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iZZuZ-0004Wg-2v for xen-devel@lists.xenproject.org; Tue, 26 Nov 2019 12:25:43 +0000 X-Inumbo-ID: d7a3849e-1047-11ea-b155-bc764e2007e4 Received: from smtp-fw-6001.amazon.com (unknown [52.95.48.154]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id d7a3849e-1047-11ea-b155-bc764e2007e4; Tue, 26 Nov 2019 12:25:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1574771133; x=1606307133; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=ea7azaT3YO7wOzipAnz9vVarYKbJ0yLWP4KNNBu9TQs=; b=gK679cuCJ4aqPA+azHKgpiWocCoTJd8WIP5JfiOZVq/bS0D/14hzap3Z qhXbnssdvqGYXeagMg91shchXObk5IiFqOpWFsa0Cv1LpPP8O+CFNcVJ4 EYF/bNgMoze9NoZLGGD1GYmVLE2poohJo504hppoSTg2ymcyu41oc49Bc Q=; IronPort-SDR: GeVVOOXk34nt5EtqBYXVtLAJvtJxwzSaY4McGfclNvBEyl9D5QLXxaY0CTEcTSAv7EggYnzOow +dIxvDVknkTA== X-IronPort-AV: E=Sophos;i="5.69,245,1571702400"; d="scan'208";a="6386604" Received: from iad6-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-2c-4e7c8266.us-west-2.amazon.com) ([10.124.125.6]) by smtp-border-fw-out-6001.iad6.amazon.com with ESMTP; 26 Nov 2019 12:25:32 +0000 Received: from EX13MTAUEA001.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan2.pdx.amazon.com [10.170.41.162]) by email-inbound-relay-2c-4e7c8266.us-west-2.amazon.com (Postfix) with ESMTPS id 0D4CFA0006; Tue, 26 Nov 2019 12:25:32 +0000 (UTC) Received: from EX13D03EUA003.ant.amazon.com (10.43.165.89) by EX13MTAUEA001.ant.amazon.com (10.43.61.243) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 26 Nov 2019 12:25:31 +0000 Received: from EX13MTAUWC001.ant.amazon.com (10.43.162.135) by EX13D03EUA003.ant.amazon.com (10.43.165.89) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 26 Nov 2019 12:25:30 +0000 Received: from dev-dsk-wipawel-1a-0c4e6d58.eu-west-1.amazon.com (10.4.134.33) by mail-relay.amazon.com (10.43.162.232) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Tue, 26 Nov 2019 12:25:28 +0000 From: Pawel Wieczorkiewicz To: Date: Tue, 26 Nov 2019 12:25:08 +0000 Message-ID: <20191126122511.7409-5-wipawel@amazon.de> X-Mailer: git-send-email 2.16.5 In-Reply-To: <20191126122511.7409-1-wipawel@amazon.de> References: <20191126122511.7409-1-wipawel@amazon.de> MIME-Version: 1.0 Precedence: Bulk Subject: [Xen-devel] [PATCH v3 4/7] create-diff-object: Add support for applied/reverted marker 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: Pawel Wieczorkiewicz , Ross Lagerwall , mpohlack@amazon.com, Konrad Rzeszutek Wilk Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" With version 2 of a payload structure additional field is supported to track whether given function has been applied or reverted. There also comes additional 8-byte alignment padding to reserve place for future flags and options. The new fields are zero-out upon .livepatch.funcs section creation. Signed-off-by: Pawel Wieczorkiewicz Reviewed-by: Ross Lagerwall --- common.h | 2 ++ create-diff-object.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/common.h b/common.h index 300e508..9f9cb7b 100644 --- a/common.h +++ b/common.h @@ -124,6 +124,8 @@ struct livepatch_patch_func { uint32_t old_size; uint8_t version; unsigned char pad[31]; + uint8_t applied; + uint8_t _pad[7]; }; struct special_section { diff --git a/create-diff-object.c b/create-diff-object.c index fed47cd..e886d4c 100644 --- a/create-diff-object.c +++ b/create-diff-object.c @@ -2013,8 +2013,10 @@ static void livepatch_create_patches_sections(struct kpatch_elf *kelf, funcs[index].old_size = result.size; funcs[index].new_addr = 0; funcs[index].new_size = sym->sym.st_size; - funcs[index].version = 1; + funcs[index].version = 2; memset(funcs[index].pad, 0, sizeof funcs[index].pad); + funcs[index].applied = 0; + memset(funcs[index]._pad, 0, sizeof funcs[index]._pad); /* * Add a relocation that will populate