Return-path: Received: from userp2120.oracle.com ([156.151.31.85]) by casper.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1ee427-0004wb-GN for kexec@lists.infradead.org; Tue, 23 Jan 2018 19:15:01 +0000 Subject: Re: [PATCH v1] kexec-tools: Tweak run-time handling of libxenctrl.so References: <1516729169-11871-1-git-send-email-eric.devolder@oracle.com> <20180123181555.GN4675@olila.local.net-space.pl> From: Eric DeVolder Message-ID: <09c52d5d-115c-cc52-8ce4-4e16ff252891@oracle.com> Date: Tue, 23 Jan 2018 13:15:14 -0600 MIME-Version: 1.0 In-Reply-To: <20180123181555.GN4675@olila.local.net-space.pl> Content-Language: en-US List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "kexec" Errors-To: kexec-bounces+dwmw2=infradead.org@lists.infradead.org To: Daniel Kiper Cc: andrew.cooper3@citrix.com, horms@verge.net.au, kexec@lists.infradead.org, konrad.wilk@oracle.com Thanks Daniel, inline responses below. Eric On 01/23/2018 12:15 PM, Daniel Kiper wrote: > Hi Eric, > > On Tue, Jan 23, 2018 at 11:39:29AM -0600, Eric DeVolder wrote: >> This patch is a follow-on to commit 43d3932e "kexec-tools: Perform >> run-time linking of libxenctrl.so". This patch addresses feedback >> from Daniel Kiper concerning the lack of a dlclose() and the desire >> to make xc_dlhandle static, rather than extern. >> >> In the original patch, the call to dlclose() was omitted, in contrast >> to the description in the commit message. This patch inserts the call. >> Note that this dynamic linking feature is dependent upon the proper >> operation of the RTLD_NODELETE flag to dlopen(), which does work as >> advertised on Linux (otherwise the call to dlclose() should be omitted). >> >> This patch also implements Daniel's suggestion to make the >> xc_dlhandle variable static. >> >> This patch has been re-tested per scenarios outlined in the original >> patch commit message. > > Please split this patch into two separate patches. One for dlclose() change > and one for static xc_dlhandle change. This will help people who will be > doing git bisect in the future. In general it is much appreciated to > provide one logical change per patch. Done. I've posted a v2 with these as separate patches. > >> Signed-off-by: Eric DeVolder >> --- >> v1: 23jan2018 >> - Implemented feedback from Daniel Kiper >> --- >> kexec/kexec-xen.c | 13 ++++++++++++- >> kexec/kexec-xen.h | 9 ++++----- >> 2 files changed, 16 insertions(+), 6 deletions(-) >> >> diff --git a/kexec/kexec-xen.c b/kexec/kexec-xen.c >> index d42a45a..03ea4a8 100644 >> --- a/kexec/kexec-xen.c >> +++ b/kexec/kexec-xen.c >> @@ -15,8 +15,18 @@ >> #include "crashdump.h" >> >> #ifdef CONFIG_LIBXENCTRL_DL >> -void *xc_dlhandle; >> +/* The handle from dlopen(), needed by dlsym(), dlclose() */ >> +static void *xc_dlhandle; >> xc_hypercall_buffer_t XC__HYPERCALL_BUFFER_NAME(HYPERCALL_BUFFER_NULL); >> + >> +void *__xc_dlsym(const char *symbol) >> +{ >> + if (xc_dlhandle) >> + return dlsym(xc_dlhandle, symbol); >> + else >> + return NULL; > > I am not sure why you need this "if (xc_dlhandle)...". I think that > "return dlsym(xc_dlhandle, symbol);" alone is sufficient here. I tested and dlsym() can gracefully accept NULL as the handle, and return NULL. The dlclose() segfaults with a NULL handle. I've made the change. > > Daniel > _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec