From patchwork Thu Apr 21 20:27:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Rzeszutek Wilk X-Patchwork-Id: 8903991 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C0D6CBF29F for ; Thu, 21 Apr 2016 20:32:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4692620320 for ; Thu, 21 Apr 2016 20:32:23 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 585B62039C for ; Thu, 21 Apr 2016 20:32:21 +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 1atLCe-0006ee-J9; Thu, 21 Apr 2016 20:27:56 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1atLCc-0006eK-Su for xen-devel@lists.xenproject.org; Thu, 21 Apr 2016 20:27:54 +0000 Received: from [85.158.143.35] by server-1.bemta-6.messagelabs.com id A3/92-18833-AC739175; Thu, 21 Apr 2016 20:27:54 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrCIsWRWlGSWpSXmKPExsVyMfTOEd1j5pL hBoeWG1h83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBlTLhxkKvgvXrF31XrGBsYNwl2MXBxCAjMZ Jf5OfsYG4rAILGOVuNe0kLWLkZNDQuAQq8SpvrguRg4gO0bi2bYciHClxO71WxlBbCEBJYktk x8zQgyaxCQx9dg0NpCEsICexORvtxlBelkEVCX6DrOAhNkE9CWerr3GDGKLCChL9P76DRZnFr jPJHGwXxKiNVXi1aWdYPN5Bawk5h7qZoPYNZtJ4s+CDIi4oMTJmU+gerUkbvx7yQSyillAWmL 5Pw6QMKeAvcSzffNZQMKiAioSrw7WT2AUmYWkeRaS5lkIzQsYmVcxqhenFpWlFuka6yUVZaZn lOQmZuboGhqY6eWmFhcnpqfmJCYV6yXn525iBIY9AxDsYOz453SIUZKDSUmUd62iZLgQX1J+S mVGYnFGfFFpTmrxIUYZDg4lCd5GM6CcYFFqempFWmYOMAJh0hIcPEoivCEgad7igsTc4sx0iN QpRmOOLb+vrWXi2Db13lomIZa8/LxUKXGISQIgpRmleXCDYInhEqOslDAvI9BpQjwFqUW5mSW o8q8YxTkYlYR5o0Cm8GTmlcDtewV0ChPQKfx3RUFOKUlESEk1MJacW3xZNnDXtfyT8sKnT/W0 KNw3LjUwTq2Y0OywNj1Hd3vDp+RT9+fmP3T98iDN2E4xJHfB1YmKzWem6khtE26r2y5wup3FN etUUvhH8Vv8Ye8fOGQ2eu3+9zNn0wqXHLmUiysWyEzuE1om8Jb18hQDv0vl9Wv/ed5xVnbk3f WjzFvFgsVztxJLcUaioRZzUXEiAL8bCCwHAwAA X-Env-Sender: ketuzsezr@gmail.com X-Msg-Ref: server-15.tower-21.messagelabs.com!1461270469!10638587!1 X-Originating-IP: [209.85.220.196] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 8.28; banners=-,-,- X-VirusChecked: Checked Received: (qmail 49639 invoked from network); 21 Apr 2016 20:27:50 -0000 Received: from mail-qk0-f196.google.com (HELO mail-qk0-f196.google.com) (209.85.220.196) by server-15.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 21 Apr 2016 20:27:50 -0000 Received: by mail-qk0-f196.google.com with SMTP id q184so4591971qkf.0 for ; Thu, 21 Apr 2016 13:27:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=vYahHJZfG9gN2BphHAbv8d2MhKXHWkdgkjjyJtR/Yq4=; b=j8FTfbFi5Dt047jPU1GNLr1DXC7SRbFdLWADXdMaD7WclFAXpQioi8roxTkP24SGX6 HLs/tiCzAmeKAbcyvktySbDoRBIoQNNfx6zwofyrl2dUEbTYEOxoUXNgQqRLKlDyXzmh v4/jYUpp1BzOqUCyi5U9tJo2hrg9NooAaslvvGZIw2rluW4dIYJJE6dbJSx2a6akui7b N0K9dtM3BEjY5OKAfwYyGOxzECAiCBW9crl0IksL2WCclOwqKH6KtdA0v8tvXi6kZHDz gbGGgwbKVYIKLsIIsGmgI/H4/Ttf+YazZyuLn7GuQUmkIy3C95uMqfL+F5BVlWIgNR3m 41CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=vYahHJZfG9gN2BphHAbv8d2MhKXHWkdgkjjyJtR/Yq4=; b=K25blhbJIj8L0gTkq35aUWKMQIF9vP5aklXdvbl1frD5UFVxKDCLOerASCSdh8nJqI UOvwh7cW/kE9YB70GTTXiQeOP4SQo6F9Yb7y0wWcpiYo94YRqeZ+J3+Ejp+z4SpOBU9R CUIN8B2SaSSCuqInqwjvnToBVN6eRSKBJxUpuG5lxsBrPf5jd+4bb7L9gdpskr2Z4DYJ CVi1FS36i4S0nXV6HcWmmQ+QBhrBuygERFiZhmDHW6uQktwDWS7G3WyyL9tTFxGamsj/ iYpckWDtL+8W2KT7vlDl+H+Ckm4Ril+dqPPqWrvs0UBtiYLX+eondCe2exwxHTazj4YJ f8Ww== X-Gm-Message-State: AOPr4FUWvK/NCNl1TItsD1VFjfaXDCM7PzwHmCaxcKU0FMCTfTtmF1JqHy8M8npBXbAtlQ== X-Received: by 10.55.130.66 with SMTP id e63mr1802861qkd.128.1461270469625; Thu, 21 Apr 2016 13:27:49 -0700 (PDT) Received: from localhost.localdomain (209-6-196-81.c3-0.smr-ubr2.sbo-smr.ma.cable.rcn.com. [209.6.196.81]) by smtp.gmail.com with ESMTPSA id 9sm1146077qgk.2.2016.04.21.13.27.48 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 21 Apr 2016 13:27:49 -0700 (PDT) Date: Thu, 21 Apr 2016 16:27:43 -0400 From: Konrad Rzeszutek Wilk To: Jan Beulich Message-ID: <20160421202743.GA24122@localhost.localdomain> References: <1460584928-32440-1-git-send-email-konrad.wilk@oracle.com> <1460584928-32440-13-git-send-email-konrad.wilk@oracle.com> <5715DDC702000078000E6CA1@prv-mh.provo.novell.com> <20160421002848.GB14639@localhost.localdomain> <571892F902000078000E435F@prv-mh.provo.novell.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <571892F902000078000E435F@prv-mh.provo.novell.com> User-Agent: Mutt/1.5.24 (2015-08-30) Cc: kevin.tian@intel.com, sstabellini@kernel.org, keir@xen.org, jun.nakajima@intel.com, andrew.cooper3@citrix.com, mpohlack@amazon.com, ross.lagerwall@citrix.com, julien.grall@arm.com, suravee.suthikulpanit@amd.com, sasha.levin@oracle.com, xen-devel@lists.xenproject.org, boris.ostrovsky@oracle.com Subject: Re: [Xen-devel] [PATCH v8.1 12/27] xsplice: Implement support for applying/reverting/replacing patches. 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: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Thu, Apr 21, 2016 at 12:44:41AM -0600, Jan Beulich wrote: > >>> On 21.04.16 at 02:28, wrote: > >> >+ ASSERT(sec); > >> >+ if ( sec->sec->sh_size % sizeof(*payload->funcs) ) > >> >+ { > >> >+ dprintk(XENLOG_ERR, XSPLICE "%s: Wrong size of .xsplice.funcs!\n", > >> >+ elf->name); > >> >+ return -EINVAL; > >> >+ } > >> >+ > >> >+ payload->funcs = sec->load_addr; > >> >+ payload->nfuncs = sec->sec->sh_size / sizeof(*payload->funcs); > >> > >> Following to our discussion yesterday - can't we (ab)use the section merge > >> flag here to report the structure size, along the lines of what relocation > >> sections do for their elements? > > > > > > In other words - the xsplice-tools.git and the test-cases (in > > arch/x86/xen/test) would modify the sec->sh_entsize to have the > > sizeof(xsplice_patch_func) aka 64 (0x40) ? > > > > [Note this could also extend to .xsplice.hooks.load and > > .xsplice.hooks.unload] > > > > The xsplice-tools.git could surely do it, but the built-in test-cases - > > not so much. I would need to do some in-place binary handrolling - unless you > > know of some tool or some __section modifiers? > > Well, that's why I suggest (ab) using the SHF_MERGE flag, i.e. to > see whether we can make gas do what we want. Fiddling with the > binary I would not recommend, i.e. if we can't get gas to do what > we want we should rather stay with what there is. This: Makes the .xsplice.funcs have sh_entsize have the size of 64 bytes: [ 6] .xsplice.funcs PROGBITS 0000000000000000 000000a0 0000000000000040 0000000000000000 WA 0 0 32 vs [ 6] .xsplice.funcs PROGBITS 0000000000000000 000000a0 0000000000000040 0000000000000040 WAM 0 0 32 Unfortunatly the compilation throws this: FC-64 make -j4 tests 1>1 dnsdomainname: Name or service not known {standard input}: Assembler messages: {standard input}:184: Warning: ignoring changed section attributes for .xsplice.funcs This is with: binutils-2.20.51.0.2-15.fc13.x86_64 and with: binutils-2.25-9.fc22.x86_64 Ideas? I could try to wrap the definition of these struct xsplice_patch_func __section(".xsplice.funcs") xsplice_xen_hello_world using an macro - but that did not work very well (I couldn't manage it to take the value of say XSPLICE_PAYLOAD_VERSION). Perhaps skip this? > > Jan > diff --git a/xen/arch/x86/test/xen_hello_world.c b/xen/arch/x86/test/xen_hello_world.c index a3da85d..92f2e97 100644 --- a/xen/arch/x86/test/xen_hello_world.c +++ b/xen/arch/x86/test/xen_hello_world.c @@ -47,6 +47,13 @@ XSPLICE_UNLOAD_HOOK(hi_func); XSPLICE_UNLOAD_HOOK(Z_check_fnc); +#define XSPLICE_FUNC() \ + asm ( \ + ".pushsection .xsplice.funcs, \"awM\", @progbits, 64\n " \ + ".popsection") + +XSPLICE_FUNC(); + struct xsplice_patch_func __section(".xsplice.funcs") xsplice_xen_hello_world = { .version = XSPLICE_PAYLOAD_VERSION, .name = hello_world_patch_this_fnc,