summaryrefslogtreecommitdiff
path: root/configure.ac
AgeCommit message (Collapse)Author
2018-01-24kexec-tools: Perform run-time linking of libxenctrl.soEric DeVolder
When kexec is utilized in a Xen environment, it has an explicit run-time dependency on libxenctrl.so. This dependency occurs during the configure stage and when building kexec-tools. When kexec is utilized in a non-Xen environment (either bare metal or KVM), the configure and build of kexec-tools omits any reference to libxenctrl.so. Thus today it is not currently possible to configure and build a *single* kexec that will work in *both* Xen and non-Xen environments, unless the libxenctrl.so is *always* present. For example, a kexec configured for Xen in a Xen environment: # ldd build/sbin/kexec linux-vdso.so.1 => (0x00007ffdeba5c000) libxenctrl.so.4.4 => /usr/lib64/libxenctrl.so.4.4 (0x00000038d8000000) libz.so.1 => /lib64/libz.so.1 (0x00000038d6c00000) libc.so.6 => /lib64/libc.so.6 (0x00000038d6000000) libdl.so.2 => /lib64/libdl.so.2 (0x00000038d6400000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00000038d6800000) /lib64/ld-linux-x86-64.so.2 (0x000055e9f8c6c000) # build/sbin/kexec -v kexec-tools 2.0.16 However, the *same* kexec executable fails in a non-Xen environment: # copy xen kexec to . # ldd ./kexec linux-vdso.so.1 => (0x00007fffa9da7000) libxenctrl.so.4.4 => not found liblzma.so.0 => /usr/lib64/liblzma.so.0 (0x0000003014e00000) libz.so.1 => /lib64/libz.so.1 (0x000000300ea00000) libc.so.6 => /lib64/libc.so.6 (0x000000300de00000) libpthread.so.0 => /lib64/libpthread.so.0 (0x000000300e200000) /lib64/ld-linux-x86-64.so.2 (0x0000558cc786c000) # ./kexec -v ./kexec: error while loading shared libraries: libxenctrl.so.4.4: cannot open shared object file: No such file or directory At Oracle we "workaround" this by having two kexec-tools packages, one for Xen and another for non-Xen environments. At Oracle, the desire is to offer a single kexec-tools package that works in either environment. To achieve this, kexec-tools would either have to ship with libxenctrl.so (which we have deemed as unacceptable), or we can make kexec perform run-time linking against libxenctrl.so. This patch is one possible way to alleviate the explicit run-time dependency on libxenctrl.so. This implementation utilizes a set of macros to wrap calls into libxenctrl.so so that the library can instead be dlopen() and obtain the function via dlsym() and then make the call. The advantage of this implementation is that it requires few changes to the existing kexec-tools code. The dis- advantage is that it uses macros to remap libxenctrl functions and do work under the hood. Another possible implementation worth considering is the approach taken by libvmi. Reference the following file: https://github.com/libvmi/libvmi/blob/master/libvmi/driver/xen/libxc_wrapper.h The libxc_wrapper_t structure definition that starts at line ~33 has members that are function pointers into libxenctrl.so. This structure is populated once and then later referenced/dereferenced by the callers of libxenctrl.so members. The advantage of this implementation is it is more explicit in managing the use of libxenctrl.so and its versions, but the disadvantage is it would require touching more of the kexec-tools code. The following is a list libxenctrl members utilized by kexec: Functions: xc_interface_open xc_kexec_get_range xc_interface_close xc_kexec_get_range xc_interface_open xc_get_max_cpus xc_kexec_get_range xc_version xc_kexec_exec xc_kexec_status xc_kexec_unload xc_hypercall_buffer_array_create xc__hypercall_buffer_array_alloc xc_hypercall_buffer_array_destroy xc_kexec_load xc_get_machine_memory_map Data: xc__hypercall_buffer_HYPERCALL_BUFFER_NULL These were identified by configuring and building kexec-tools with Xen support, but omitting the -lxenctrl from the LDFLAGS in the Makefile for an x86_64 build. The above libxenctrl members were referenced via these source files. kexec/crashdump-xen.c kexec/kexec-xen.c kexec/arch/i386/kexec-x86-common.c kexec/arch/i386/crashdump-x86.c This patch provides a wrapper around the calls to the above functions in libxenctrl.so. Every libxenctrl call must pass a xc_interface which it obtains from xc_interface_open(). So the existing code is already structured in a manner that facilitates graceful dlopen()'ing of the libxenctrl.so and the subsequent dlsym() of the required member. The patch creates a wrapper function around xc_interface_open() and xc_interface_close() to perform the dlopen() and dlclose(). For the remaining xc_ functions, this patch defines a macro of the same name which performs the dlsym() and then invokes the function. See the __xc_call() macro for details. There was one data item in libxenctrl.so that presented a unique problem, HYPERCALL_BUFFER_NULL. It was only utilized once, as set_xen_guest_handle(xen_segs[s].buf.h, HYPERCALL_BUFFER_NULL); I tried a variety of techniques but could not find a general macro-type solution without modifying xenctrl.h. So the solution was to declare a local HYPERCALL_BUFFER_NULL, and this appears to work. I admit I am not familiar with libxenctrl to state if this is a satisfactory workaround, so feedback here welcome. I can state that this allows kexec to load/unload/kexec on Xen and non-Xen environments that I've tested without issue. With this patch applied, kexec-tools can be built with Xen support and yet there is no explicit run-time dependency on libxenctrl.so. Thus it can also be deployed in non-Xen environments where libxenctrl.so is not installed. # ldd build/sbin/kexec linux-vdso.so.1 => (0x00007fff7dbcd000) liblzma.so.0 => /usr/lib64/liblzma.so.0 (0x00000038d9000000) libz.so.1 => /lib64/libz.so.1 (0x00000038d6c00000) libdl.so.2 => /lib64/libdl.so.2 (0x00000038d6400000) libc.so.6 => /lib64/libc.so.6 (0x00000038d6000000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00000038d6800000) /lib64/ld-linux-x86-64.so.2 (0x0000562dc0c14000) # build/sbin/kexec -v kexec-tools 2.0.16 This feature/ability is enabled with the following: ./configure --with-xen=dl The previous --with-xen=no and --with-xen=yes still work as before. Not specifying a --with-xen still defaults to --with-xen=yes. As I've introduced a new build and run-time mode, I've done an extensive matrix of both build-time and run-time checks of kexec with this patch applied. The set of build-time scenarios are: 1: configure --with-xen=no and Xen support NOT present 2: configure --with-xen=no and Xen support IS present 3: configure --with-xen=yes and Xen support NOT present 4: configure --with-xen=yes and Xen support IS present 5: configure --with-xen=dl and Xen support NOT present 6: configure --with-xen=dl and Xen support IS present Xen support present requires that configure can find both xenctrl.h and libxenctrl.so. Then for each of the six scenarios above, the corresponding kexec binary was tested on a Xen system (Oracle's OVS dom0) and a non-Xen system (Oracle Linux). There are two build-time checks: did kexec build, and did it contain libxenctrl.so? The presence of libxenctrl.so in kexec was checked via ldd. The results were: Scenario | Build | libxenctrl.so | Result 1 | pass | no | pass - see Note 1 2 | pass | no | pass - see Note 1 3 | pass | no | pass - see Note 2 4 | pass | yes | pass - see Note 3 5 | pass | no | pass - see Note 2 6 | pass | no | pass - see Note 4 Note 1: This passes since due to --with-xen=no, there will be no Xen support in kexec and therefore no libxenctrl.so a in the kexec. Note 2: This passes since while --with-xen=yes, the configure displays a message indicating that Xen support is disabled, and allows kexec to build (this is the same behavior as prior to this patch). And since Xen support is disabled, there is no libxenctrl.so in the kexec. Note 3: This passes since with --with-xen=yes and configure locating the xenctrl.h and libxenctrl.so, support for Xen was built into kexec. Ldd shows an explicit dependency on the library. Note 4: This passes since with --with-xen=dl and configure locating the xenctrl.h and libxencrl.so, support for Xen was built into kexec. However, this uses the new technique introduced by this patch and, as a result, ldd shows that the libxenctrl.so is not a explicit run-time dependency for kexec (rather libdl.so is now an explicit dependency). This is precisely the goal of this patch! The net effect is that there are now three "flavors" of a kexec binary (prior to this patch there were two): a) kexec with no support for Xen [scenarios 1, 2, 3, 5], b) kexec with support for Xen and libxenctrl.so as an explicit dependency [scenario 4], and c) kexec with support for Xen and libxenctrl.so is NOT an explicit dependency [scenario 6]. The run-time checks are to take each of the six scenarios above and run the corresponding kexec binary on both a Xen system and a non-Xen system. The test for each kexec scenario was: % service kdump stop % vi /etc/init.d/kdump change KEXEC= to /sbin/kexec-[123456] % service kdump start # If not FAILED, then below % service kdump status Kdump is operational % rm -fr /var/crash/* % echo c > /proc/sysrq-trigger # after reboot verify vmcore generated % ls -al /var/crash/<tab> The results were: Scenario | Xen environment | non-Xen environment 1 | fail - see Note 5 | pass 2 | fail - see Note 5 | pass 3 | fail - see Note 6 | pass 4 | pass | fail - see Note 7 5 | fail - see Note 6 | pass 6 | pass | pass Note 5: Due to --with-xen=no, kexec lacks support for Xen and will fail in the Xen environment. This behavior is the same as prior to this patch. Note 6: Due to the missing xenctrl.h and libxenctrl.so, kexec was built without support for Xen, and thus will fail in the Xen environment. This behavior is the same as prior to this patch. Note 7: This kexec has the explicit dependency on libxenctrl.so which prevents it from running in a non-Xen environment. This is expected as this is the original issue for which this patch is intended to address. Note that for scenarios 1, 2, 3 and 5 kexec lacks support for Xen, thus these versions are expected to "fail" in a Xen environment. On the flip side, since a non-Xen environment does not need libxenctrl.so, all but scenario 4 are expected to "pass" in a non-Xen environment. The results match these expectations! And, of course, importantly with this patch applied, it did not have an adverse impact on kexec build or run-time. Signed-off-by: Eric DeVolder <eric.devolder@oracle.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2018-01-18kexec-tools 2.0.16.gitSimon Horman
Add .git to version so it doesn't look like a release. This is just so when people build code from git it can be identified as such from the version string. Signed-off-by: Simon Horman <horms@verge.net.au>
2017-11-20kexec-tools 2.0.16Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2017-11-09kexec-tools 2.0.16-rc1Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2017-08-04kexec-tools 2.0.15.gitSimon Horman
Add .git to version so it doesn't look like a release. This is just so when people build code from git it can be identified as such from the version string. Signed-off-by: Simon Horman <horms@verge.net.au>
2017-06-16kexec-tools 2.0.14Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2017-06-09kexec-tools 2.0.15-rc1Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2017-04-08Fix broken Xen support in configure.acEric DeVolder
Commit 2cf7cb9a "kexec: implemented XEN KEXEC STATUS to determine if an image is loaded" added configure-time detection of the kexec_status() call, but in doing so had the unintended side effect of disabling support for Xen altogether due to the missing HAVE_LIBXENCTRL=1. This corrects the broken behavior while still maintaining the original intention of detecting support for kexec_status() call. Reported-and-Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Eric DeVolder <eric.devolder@oracle.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2017-01-26kexec: implemented XEN KEXEC STATUS to determine if an image is loadedEric DeVolder
Instead of the scripts having to poke at various fields we can provide that functionality via the -S parameter. kexec_loaded/kexec_crash_loaded exposes Linux kernel kexec/crash state. It does not say anything about Xen kexec/crash state. So, we need a special approach to get the latter. Though for compatibility we provide similar functionality in kexec-tools for the former. This change enables the --status or -S option to work either with or without Xen. Returns 0 if the payload is loaded. Can be used in combination with -l or -p to get the state of the proper kexec image. Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Eric DeVolder <eric.devolder@oracle.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-12-20kexec-tools 2.0.14.gitSimon Horman
Add .git to version so it doesn't look like a release. This is just so when people build code from git it can be identified as such from the version string. Signed-off-by: Simon Horman <horms@verge.net.au>
2016-12-20kexec-tools 2.0.14Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2016-12-12kexec-tools 2.0.14-rc1Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2016-09-29arm64: Add arm64 kexec supportGeoff Levand
Add kexec reboot support for ARM64 platforms. Signed-off-by: Geoff Levand <geoff@infradead.org> Tested-By: Pratyush Anand <panand@redhat.com> Tested-By: Matthias Brugger <mbrugger@suse.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2016-09-29kexec-tools 2.0.13.gitSimon Horman
Add .git to version so it doesn't look like a release. This is just so when people build code from git it can be identified as such from the version string. Signed-off-by: Simon Horman <horms@verge.net.au>
2016-08-08kexec-tools 2.0.13Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2016-07-29kexec-tools 2.0.13-rc1Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2016-03-24kexec-tools 2.0.12.gitSimon Horman
Add .git to version so it doesn't look like a release. This is just so when people build code from git it can be identified as such from the version string. Signed-off-by: Simon Horman <horms@verge.net.au>
2016-03-22kexec-tools 2.0.12Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2016-03-14kexec-tools 2.0.12-rc1Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2015-11-09kexec-tools 2.0.12.gitSimon Horman
Add .git to version so it doesn't look like a release. This is just so when people build code from git it can be identified as such from the version string. Signed-off-by: Simon Horman <horms@verge.net.au>
2015-11-09kexec-tools 2.0.11Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2015-10-30kexec-tools 2.0.11-rc1Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2015-10-16configure: Set SUBARCH=BE for powerpcGeoff Levand
When building a 32 bit version of kexec-tools for powerpc64 set the default powerpc64 SUBARCH as BE. Fixes build errors like these: powerpc-linux-gnu/bin/ld: unrecognised emulation mode: elf64lppc Signed-off-by: Geoff Levand <geoff@infradead.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-09-02Drop release date from kexec-tools version outputDave Young
kexec --version reports like below: kexec-tools 2.0.7 released 05 February 2015 The date string is generated when one run bootstrap script, thus it is more like a build date instead of release date. Even for distribution like Fedora it will make more sense if it can report something like "kexec-tools 2.0.7-1 released 05 February 2015" In case building from git tree, the date cause more confusion. So let's remove it from version string unless there is better idea to resolve the issue. Signed-off-by: Dave Young <dyoung@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-06-25kexec-tools 2.0.10.gitSimon Horman
Add .git to version so it doesn't look like a release. This is just so when people build code from git it can be identified as such from the version string. Signed-off-by: Simon Horman <horms@verge.net.au>
2015-06-25kexec-tools 2.0.10Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2015-06-11kexec-tools 2.0.10-rc1Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2015-05-01Revert "x86_64: Add support to build kexec-tools with x32 ABI"Simon Horman
This reverts commit 5edcbfd1368e84fce913ceeeca7b712c524dc20d. Yinghai Lu has reported on the kexec mailing list that this causes the following problem when using kexec load with kexec built on openSUSE 13.1 64bit. overflow in relocation type R_X86_64_32 val 21dffc020
2015-04-09configure.ac: Fix failure caused by x32 ABI testAníbal Limón
When try to compile with zlib fails due to configure.ac bad expansion caused by x32 ABI test that needs AC_PROG_CC for use AC_EGREP_CPP. Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-04-07x86_64: Add support to build kexec-tools with x32 ABIAníbal Limón
Summary of changes, configure.ac: Add test for detect x32 ABI. purgatory/arch/x86_64/Makefile: Not use mcmodel large when x32 ABI is set. kexec/arch/x86_64/kexec-elf-rel-x86_64.c: When x32 ABI is set use ELFCLASS32 instead of ELFCLASS64. kexec/kexec-syscall.h: Add correct syscall number for x32 ABI. Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-02-12configure.ac: apply necessary quotes to result of macro expansion.Yousong Zhou
This can fix the following error when searching for lzma support and while at it also apply the practice to other uses of the same pattern. checking for lzma_code in -llzma... ./configure: line 4756: ac_fn_c_try_link: command not found Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2015-02-09kexec-tools 2.0.10.gitSimon Horman
Add .git to version so it doesn't look like a release. This is just so when people build code from git it can be identified as such from the version string. Signed-off-by: Simon Horman <horms@verge.net.au>
2015-02-09kexec-tools 2.0.9Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2015-01-27kexec-tools 2.0.9-rc1Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2014-10-14kexec-tools 2.0.8.gitSimon Horman
Add .git to version so it doesn't look like a release. This is just so when people build code from git it can be identified as such from the version string. Signed-off-by: Simon Horman <horms@verge.net.au>
2014-10-08kexec-tools 2.0.8Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2014-10-01kexec-tools 2.0.8-rc1Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2014-06-17kexec-tools 2.0.7.gitSimon Horman
Add .git to version so it doesn't look like a release. This is just so when people build code from git it can be identified as such from the version string. Signed-off-by: Simon Horman <horms@verge.net.au>
2014-06-09kexec-tools 2.0.7Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2014-05-28kexec-tools 2.0.7-rc1Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2014-03-06kexec-tools 2.0.6Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2014-02-06kexec-tools 2.0.5.gitSimon Horman
Add .git to version so it doesn't look like a release. This is just so when people build code from git it can be identified as such from the version string. Signed-off-by: Simon Horman <horms@verge.net.au>
2014-02-05kexec-tools 2.0.5Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2013-12-13kexec: Add m68k supportGeert Uytterhoeven
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-11-19kexec/xen: require libxc from Xen 4.4David Vrabel
libxc from Xen 4.4 added xc_kexec_load() which will be required to load images into Xen in the future. Remove all the #ifdef'ery for older versions of libxc. Signed-off-by: David Vrabel <david.vrabel@citrix.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-11-19kexec/ppc64: bring up new ppc64le architectureLaurent Dufour
This patch provides support for the new Power PC litte endian (LE) mode. The LE mode only differs in the way the instructions and data are stored in memory thus there is no real need to duplicate the ppc64 code. However some compilation's options, especially for the purgatory, differ between little and big endian mode's support. A new "SUBARCH" build variable is introduced which is currently only used for PPC64 to specify the endianness. Another set of changes in this patch is fixing minor endianess issues in the ppc64 code and fix an alignment issue raised on Power7 little endian mode. Among these fixes, the check on the kernel binary endianess is removed, since we can imagine kexecing a LE kernel from a BE environment, as far as the specified root filesystem and initrd file are containing the right binaries. This patch depends on the patch "kexec/ppc64: use common architecture fs2dt.c file" I sent earlier on the kexec mailing list. Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
2013-03-27kexec-tools 2.0.4.gitSimon Horman
Add .git to version so it doesn't look like a release. This is just so when people build code from git it can be identified as such from the version string. Signed-off-by: Simon Horman <horms@verge.net.au>
2013-03-19kexec-tools 2.0.4Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2012-12-23build: Use cross compiler's strip if availableSimon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
2012-12-04kexec: Teach configure to find the strip binary.Eric W. Biederman
For some reason my version of the Makefile generated by configure included the line STRIP=strp. Rerunning configure from a fresh slate did not regenerate that line so I don't know how it got there. So add the code to Makefile.in and configure.ac to autodetect the strip binary. This is needed so that we can remove from purgatory all of the relocations to sections that are not needed at runtime, by stripping out those sections. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> [horms@verge.net.au: Omitted white-space only change to purgatory/arch/x86_64/Makefile] Signed-off-by: Simon Horman <horms@verge.net.au>