- 02 Mar, 2016 1 commit
-
-
Marc Zyngier authored
In order to enable the PMU support on arm64, update the copy of the kernel include files. Signed-off-by:
Marc Zyngier <marc.zyngier@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 01 Feb, 2016 1 commit
-
-
Maciek Borzecki authored
If a static libc is not present in the system the build will fail with make complaining about commands starting before the first target. The patch fixes indentation of a warning about missing static libc, thus fixing the build. Signed-off-by:
Maciek Borzecki <maciek.borzecki@gmail.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 18 Nov, 2015 7 commits
-
-
Andre Przywara authored
For some reasons (probably to have easy access to the command line) the kernel loading for arm and arm64 was located in arm/fdt.c. Move the routines to kvm.c (where other architectures put it) to only have real device tree code in fdt.c. We use the pointer in struct kvm to access the command line string. Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Andre Przywara authored
Use the new read_file() wrapper in our arm/arm64 kernel image loading function instead of the private implementation. Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Andre Przywara authored
Replace the unsafe read-loops in the x86 kernel image loading functions with our safe read_file() and read_in_full() wrappers. This should fix random fails in kernel image loading, especially from pipes and sockets. Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Andre Przywara authored
Replace the unsafe read-loops used in the MIPS kernel image loading with our safe read_file() and read_in_full() wrappers. This should fix random fails in kernel image loading, especially from pipes and sockets. Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Andre Przywara authored
Replace the unsafe read-loops in the powerpc kernel image loading function with our new and safe read_file() wrapper. This should fix random fails in kernel image loading, especially from pipes and sockets. Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Andre Przywara authored
In various parts of kvmtool we simply try to read files into memory, but fail to do so in a safe way. The read(2) syscall can return early having only parts of the file read, or it may return -1 due to being interrupted by a signal (in which case we should simply retry). The ARM code seems to provide the only safe implementation, so take that as an inspiration to provide a generic read_file() function usable by every part of kvmtool. Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Andre Przywara authored
Let's face it: Kernel loading is quite architecture specific. Don't claim otherwise and move the loading routines into each architecture's responsibility. This introduces kvm__arch_load_kernel(), which each architecture can implement accordingly. Provide bzImage loading for x86 and ELF loading for MIPS as special cases for those architectures (removing the arch specific code from the generic kvm.c file on the way) and rename the existing "flat binary" loader functions for the other architectures to the new name. Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 11 Nov, 2015 1 commit
-
-
James Hunt authored
After make lkvm-static & make clean, the dependency files for static objects (.xxx.static.o.d) are not removed. Signed-off-by:
Xiaochen Shen <xiaochen.shen@intel.com> Signed-off-by:
Dimitri John Ledkov <dimitri.j.ledkov@intel.com> Signed-off-by:
James Hunt <james.o.hunt@intel.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 09 Nov, 2015 1 commit
-
-
Andre Przywara authored
Looking back at the HEAD from a few commits ago, it's obvious that using the LDFLAGS variable for linking the guest_init binary was rather pointless, as it was zeroed in the beginning and then never set. As guest_init is a rather special binary that does not cope well with arbitrary linker flags, let's reinstantiate the previous state by removing the LDFLAGS variable from those linking steps. This allows LDFLAGS to be used for linking the actual kvmtool binary only and helps to re-merge commit d0e2772b ("Makefile: allow overriding CFLAGS on the command line"). Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 05 Nov, 2015 1 commit
-
-
Will Deacon authored
lkvm currently suffers from a Segmentation Fault when exiting, which can also lead to the console not being cleaned up correctly after a VM exits. The issue is that (the misnamed) kvm_cpu__reboot function sends a SIGKVMEXIT to each vcpu thread, which causes those vcpu threads to exit once their main loops (kvm_cpu__start) detect that cpu->is_running is now false. The lack of synchronisation in this exit path means that a concurrent pause event (due to the br_write_lock in ioport__unregister) ends up sending SIGKVMPAUSE to an exited thread, resulting in a SEGV. This patch fixes the issue by moving kvm_cpu__reboot into kvm.c (renaming it in the process) where it can hold the pause_lock mutex across the reboot operation. This in turn makes it safe for the pause code to check the is_running field of each CPU before attempting to send a SIGKVMPAUSE signal. Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 04 Nov, 2015 1 commit
-
-
Will Deacon authored
Riku Voipio reports a regression introduced by d0e2772b ("Makefile: allow overriding CFLAGS on the command line"): | This breaks builds of debian packages as dpkg-buildpackage sets LDFLAGS | to something unsuitable for guest init. Revert the problematic patch for the moment, while we rethink how we'd like to support user-provided toolchain flags. This reverts commit d0e2772b . Conflicts: Makefile Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 02 Nov, 2015 3 commits
-
-
Andre Przywara authored
While we have an LDFLAGS variable in kvmtool's Makefile, it's not really used when both doing the feature tests and when finally linking the lkvm executable. Add that variable to all the linking steps to allow the user to specify custom library directories or linker options on the command line. Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Andre Przywara authored
When a Makefile variable is set on the make command line, all Makefile-internal assignments to that very variable are _ignored_. Since we add quite some essential values to CFLAGS internally, specifying some CFLAGS on the command line will usually break the build (and not fix any include file problems you hoped to overcome with that). Somewhat against intuition GNU make provides the "override" directive to change this behavior; with that assignments in the Makefile get _appended_ to the value given on the command line. [1] Change any internal assignments to use that directive, so that a user can use: $ make CFLAGS=/path/to/my/include/dir to teach kvmtool about non-standard header file locations (helpful for cross-compilation) or to tweak other compiler options. Signed-off-by:
Andre Przywara <andre.przywara@arm.com> [1] https://www.gnu.org/software/make/manual/html_node/Override-Directive.html Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
William Dauchy authored
when starting with custom kernel and disk options, kernel_cmdline is NULL; it results in a segfault while trying to look for a string using `strstr`: __strstr_sse2_unaligned () at ../sysdeps/x86_64/multiarch/strstr-sse2-unaligned.S:40 0x00000000004056bf in kvm_cmd_run_init (argc=<optimized out>, argv=<optimized out>) at builtin-run.c:608 0x000000000040639d in kvm_cmd_run (argc=<optimized out>, argv=<optimized out>, prefix=<optimized out>) at builtin-run.c:659 0x0000000000412b8f in handle_command (command=0x62bbc0 <kvm_commands>, argc=5, argv=0x7fffffffe840) at kvm-cmd.c:84 0x00007ffff7211b45 in __libc_start_main (main=0x403540 <main>, argc=6, argv=0x7fffffffe838, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe828) at libc-start.c:287 0x0000000000403962 in _start () this patch suggests to set a minimal cmdline when kernel_cmdline is NULL Fixes: 8a7163f3 ("kvmtool/run: append cfg.kernel_cmdline at the end of real_cmdline") Signed-off-by:
William Dauchy <william@gandi.net> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 28 Oct, 2015 1 commit
-
-
Sasha Levin authored
9p doesn't support writable mmaps by default (when cache=none), set it to loose caching to allow for writable mmaps. Reported-by:
Dmitry Vyukov <dvyukov@google.com> Signed-off-by:
Sasha Levin <sasha.levin@oracle.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 27 Oct, 2015 9 commits
-
-
Oleg Nesterov authored
To me kvm_setup_guest_init() behaviour looks "obviously wrong" and unfriendly because it always overwrites /virt/init. kvm_setup_guest_init() is also called when we are going to use this tree as a rootfs, and without another patch ("kvmtool/run: append cfg.kernel_cmdline at the end of real_cmdline") the user can't use "lkvm run -p init=my_init_path". This simply means that you can not use a customized init unless you patch kvmtool. Change extract_file() to do nothing if the file already exists. This should not affect do_setup() which calls kvm_setup_guest_init() only if make_dir(guestfs_name) creates the new/empty dir. Signed-off-by:
Oleg Nesterov <oleg@redhat.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Oleg Nesterov authored
1. kvm_cmd_run_init() appends "root=/dev/root" to real_cmdline if cfg.using_rootfs == T. This doesn't hurt but makes no sense and looks confusing. We do not need to initialiaze the kernel's saved_root_name[] and "/dev/root" means nothing to name_to_dev_t(). We only need to pass this mount-tag to 9p but the kernel always uses dev_name="/dev/root" in mount_root() path, so we can safely remove this option from the command line. 2. "rw" in rootflags looks confusing too, it is silently ignored by v9fs_parse_options() and has no effect. We need to clear MS_RDONLY from root_mountflags, this is what the "standalone" kernel parameter correctly does. Signed-off-by:
Oleg Nesterov <oleg@redhat.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Oleg Nesterov authored
add lkvm-static to gitignore Signed-off-by:
Oleg Nesterov <oleg@redhat.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Oleg Nesterov authored
Add the tiny x86/init.S which just mounts /host and execs /virt/init. NOTE: of course, the usage of CONFIG_GUEST_PRE_INIT is ugly, we need to cleanup this code. But I'd prefer to do this on top of this minimal/simple change. And I think this needs cleanups in any case, for example I think lkvm shouldn't abuse the "init=" kernel parameter at all. Acked-by:
Pekka Enberg <penberg@kernel.org> Signed-off-by:
Oleg Nesterov <oleg@redhat.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Oleg Nesterov authored
This comes as a separate patch because I do not really understand /usr/bin/make, probably it should be updated. Change the main Makefile so that if an arch defines ARCH_PRE_INIT then we - build $GUEST_INIT without "-static" - add -DCONFIG_GUEST_PRE_INIT to $CFLAGS - build $ARCH_PRE_INIT as guest/guest_pre_init.o and embed it into lkvm the same as we do with guest/guest_init.o This also means that ARCH_PRE_INIT case doesn't depend on glibc-static, we can relax the SOURCE_STATIC check later. Acked-by:
Pekka Enberg <penberg@kernel.org> Signed-off-by:
Oleg Nesterov <oleg@redhat.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Oleg Nesterov authored
Turn kvm_setup_guest_init(guestfs_name) into a more generic helper, extract_file(guestfs_name, filename, data, size) and reimplement kvm_setup_guest_init() as a trivial wrapper. Acked-by:
Pekka Enberg <penberg@kernel.org> Signed-off-by:
Oleg Nesterov <oleg@redhat.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Sasha Levin authored
The vcpu module is a core component which should be removed last, but the destructor was mistakenly marked as something that should be done first. This would cause the vcpu data to be freed up before anything else had the chance to exit, and assuming that that data was still valid - causing use after frees. Reported-by:
Dmitry Vyukov <dvyukov@google.com> Signed-off-by:
Sasha Levin <sasha.levin@oracle.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Oleg Nesterov authored
According to git grep they can be static. term_got_escape can be static too, and we can even move it into term_getc(). "int term_escape_char" doesn't make sense at least until we allow to redefine it, turn it into preprocessor constant. Signed-off-by:
Oleg Nesterov <oleg@redhat.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Oleg Nesterov authored
This allows the user to always override the paramaters set by lkvm. Say, currently 'lkvm run -p ro' doesn't work. To keep the current logic we need to change strstr("root=") to check cfg.kernel_cmdline, not real_cmdline. And perhaps we can even add a simple helper add_param(name, val) to make this all more consistent; it should only append "name=val" to real_cmdline if cfg.kernel_cmdline doesn't include this paramater. Signed-off-by:
Oleg Nesterov <oleg@redhat.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 09 Oct, 2015 1 commit
-
-
Sven Dowideit authored
Signed-off-by:
Sven Dowideit <SvenDowideit@home.org.au> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 15 Sep, 2015 1 commit
-
-
Dimitri John Ledkov authored
If one typically only boots full disk-images, one wouldn't necessaraly want to statically link glibc, for the guest-init feature of the kvmtool. As statically linked glibc triggers haevy security maintainance. Signed-off-by:
Dimitri John Ledkov <dimitri.j.ledkov@intel.com> [will: moved all the guest_init handling into builtin_setup.c] Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 10 Sep, 2015 1 commit
-
-
Riku Voipio authored
Currently Makefile accepts only armv7l.* When building kvmtool under 32bit personality on Aarch64 machines, uname -m reports "armv8l", so build fails. We expect doing 32bit arm builds in Aarch64 to become standard the same way people do i386 builds on x86_64 machines. Make the sed test a little more greedy so armv8l becomes acceptable. Acked-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Riku Voipio <riku.voipio@linaro.org> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 04 Sep, 2015 1 commit
-
-
Mark Rutland authored
When VCPU #0 exits (e.g. due to KVM_EXIT_SYSTEM_EVENT), it sends SIGKVMEXIT to all other VCPUs, waits for them to exit, then tears down any remaining context. The signalling of SIGKVMEXIT is critical to forcing VCPUs to shut down in response to a system event (e.g. PSCI SYSTEM_OFF). VCPUs other that VCPU #0 simply exit in kvm_cpu_thread without forcing other CPUs to shut down. Thus if a system event is taken on a VCPU other than VCPU #0, the remaining CPUs are left online. This results in KVM tool not exiting as expected when a system event is taken on a VCPU other than VCPU #0 (as may happen if the guest panics). Fix this by tearing down all CPUs upon a system event, regardless of the CPU on which the event occurred. While this means the VCPU thread will signal itself, and VCPU #0 will signal all other VCPU threads a second time, these are harmless. Signed-off-by:
Mark Rutland <mark.rutland@arm.com> Cc: Marc Zyngier <marc.zyngier@arm.com> Cc: Suzuki Poulose <suzuki.poulose@arm.com> Cc: Will Deacon <will.deacon@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 07 Aug, 2015 3 commits
-
-
Josh Triplett authored
Signed-off-by:
Josh Triplett <josh@joshtriplett.org> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Josh Triplett authored
If an IO port device has no io_in handler, kvm__emulate_io would fall through and call the io_out handler instead. Fix to only call the handler for the appropriate direction. If no handler exists, kvm__emulate_io will automatically treat it as an IO error (due to the default "ret = false"). Signed-off-by:
Josh Triplett <josh@joshtriplett.org> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Josh Triplett authored
The IO error path in kvm__emulate_io would call br_read_unlock(), then goto error, which would call br_read_unlock() again. Refactor the control flow to have only one exit path and one call to br_read_unlock(). Signed-off-by:
Josh Triplett <josh@joshtriplett.org> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 06 Aug, 2015 1 commit
-
-
Fan Du authored
To detach tap device automatically from bridge when exiting, just like what the reverse of "script" does. Signed-off-by:
Fan Du <fan.du@intel.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 22 Jul, 2015 2 commits
-
-
Andre Przywara authored
PAGE_SIZE may have been defined by the C libary (musl-libc does that). So avoid redefining it here unconditionally, instead only use our definition if none has been provided by the libc. Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Andre Przywara authored
The clang compiler by default dislikes non-literal format strings in *printf functions, so it complains about kvm__set_dir() in kvm.c and about the error reporting functions. Since a fix is not easy and the code itself is fine (just seems that the compiler is not smart enough to see that), let's just disable the warning. Since GCC knows about this option as well (it just doesn't have it enabled with -Wall), we can unconditionally add this to the warning options. Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 20 Jul, 2015 4 commits
-
-
Andre Przywara authored
As we now have the header file in our repository, we can safely follow the recommendation in kvm.c and remove the hack adding the KVM_CAP_MAX_VCPUS macro. Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Andre Przywara authored
The musl-libc library provides implementations of strlcpy and strlcat, so introduce a feature check for it and only use the kvmtool implementation if there is no library support for it. This avoids clashes with the public definition. Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Andre Przywara authored
The manpage of poll(2) states that the prototype of poll is defined in <poll.h>. Use that header file instead of <sys/poll.h> to allow compilation against musl-libc. Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Andre Przywara authored
According to the manpage and the prototype the second argument to connect(2) is a "const struct sockaddr*", so cast our protocol specific type back to the super type. This fixes compilation on musl-libc. Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-