From: Thomas Huth Date: Fri, 10 Mar 2017 09:38:29 +0000 Subject: Re: [kvm-unit-tests PATCH 2/2] powerpc: Add Special Purpose Register persistency test Message-Id: <9fe6718a-a9ae-f8a4-2ef8-8b20d6bb5f01@redhat.com> List-Id: References: <1489080427-27103-1-git-send-email-thuth@redhat.com> <1489080427-27103-3-git-send-email-thuth@redhat.com> <72045e4d-84b7-54d6-4497-803846e495db@kaod.org> <5d28fcc2-8a6d-f975-5f35-d0dc7dc044da@kaod.org> In-Reply-To: <5d28fcc2-8a6d-f975-5f35-d0dc7dc044da@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= , kvm@vger.kernel.org, Laurent Vivier , Drew Jones Cc: kvm-ppc@vger.kernel.org, Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= On 10.03.2017 09:53, Cédric Le Goater wrote: > On 03/10/2017 09:48 AM, Cédric Le Goater wrote: >> On 03/09/2017 06:27 PM, Thomas Huth wrote: >>> This test has two purposes: First, check whether the hypervisor can be >>> destabilized by writing random values into the SPRs of the PowerPC CPU >>> (this indeed revealed a bug last year, see CVE-2016-3044). >>> Second, this test can be used to check whether the SPRs are synchronized >>> properly between the KVM host CPU and QEMU, e.g. when migrating the VM >>> from one QEMU instance to another. >>> The test first fills the various SPRs with some non-zero value, then reads >>> the values back into a first array. It then either sleeps a short period >>> of time (for testing without migration, in the hope that we're rescheduled >>> on another host CPU), or it waits for a key or NMI (with the '-w' option) >>> so that it is possible to migrate the VM before continuing. The test then >>> finally reads the values from the SPRs back into another array and then >>> compares them with the initial values. >>> Currently the test only supports the SPRs from the PowerISA v2.01 >>> (PowerPC 970) and PowerISA v2.07 specification (i.e. POWER8 CPUs), >>> but other versions should be pretty easy to add later. >>> >>> Signed-off-by: Thomas Huth >> >> It looks good to me. I gave it a try and it worked fine with some >> extra tuning in the migration script. >> >> LDFLAGS needs fix for binutils 2.28 but that is another issue. > > An here's the "fix" for it. I haven't studied deeply the question > though. I think this could be an explanation for this issue: https://lists.gnu.org/archive/html/bug-gnu-utils/2002-08/msg00242.html Could you please check whether it works with "-n" instead of "-N", too? If so, I think that would be the better option. Thanks, Thomas > From 820e2d614d63bf1cd911d13396b44a5ff8fb7bdc Mon Sep 17 00:00:00 2001 > From: =?UTF-8?q?Cédric Le Goater?= > Date: Fri, 10 Mar 2017 08:54:26 +0100 > Subject: [PATCH] powerpc: add -N to LDFLAGS > MIME-Version: 1.0 > Content-Type: text/plain; charset=UTF-8 > Content-Transfer-Encoding: 8bit > > ld 2.28 complains with : > > ld -EL -nostdlib -pie -o powerpc/selftest.elf \ > -T powerpc/flat.lds --build-id=none \ > powerpc/selftest.o powerpc/cstart64.o powerpc/reloc64.o lib/libcflat.a lib/libfdt/libfdt.a powerpc/selftest.aux.o > ld: powerpc/selftest.elf: Not enough room for program headers, try linking with -N > ld: final link failed: Bad value > > Signed-off-by: Cédric Le Goater > --- > powerpc/Makefile.common | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/powerpc/Makefile.common b/powerpc/Makefile.common > index 92809a5468ea..6c62ac85311a 100644 > --- a/powerpc/Makefile.common > +++ b/powerpc/Makefile.common > @@ -43,7 +43,7 @@ cflatobjs += lib/powerpc/smp.o > > FLATLIBS = $(libcflat) $(LIBFDT_archive) > %.elf: CFLAGS += $(arch_CFLAGS) > -%.elf: LDFLAGS = $(arch_LDFLAGS) -nostdlib -pie > +%.elf: LDFLAGS = $(arch_LDFLAGS) -nostdlib -pie -N > %.elf: %.o $(FLATLIBS) powerpc/flat.lds $(cstart.o) $(reloc.o) > $(CC) $(CFLAGS) -c -o $(@:.elf=.aux.o) lib/auxinfo.c -DPROGNAME=\"$@\" > $(LD) $(LDFLAGS) -o $@ \ >