linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Potapenko <glider@google.com>
To: James Morse <james.morse@arm.com>
Cc: Dmitry Vyukov <dvyukov@google.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Quentin Casasnovas <quentin.casasnovas@oracle.com>,
	Will Deacon <will.deacon@arm.com>,
	Kostya Serebryany <kcc@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	syzkaller <syzkaller@googlegroups.com>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	marc.zyngier@arm.com,
	Christoffer Dall <christoffer.dall@linaro.org>
Subject: Re: [PATCH v1] arm64: allow building with kcov coverage on ARM64
Date: Wed, 13 Apr 2016 18:35:50 +0200	[thread overview]
Message-ID: <CAG_fn=VbAtmPuzPQPCtSGkkQrGKjciz6AAmNz+VTAdXszWSrLg@mail.gmail.com> (raw)
In-Reply-To: <570E6FF3.5000104@arm.com>

Hi James,

On Wed, Apr 13, 2016 at 6:12 PM, James Morse <james.morse@arm.com> wrote:
> Hi Alex,
>
> On 12/04/16 12:17, Alexander Potapenko wrote:
>> I also wonder if we can, say, land the change to arch/arm64/Kconfig
>> separately from makefile changes that improve the precision or fix
>> certain build configurations.
>
> (I'm not sure what you mean by precision)
>
> It depends which build configurations get broken, for example the first build I
> tried doesn't boot.
>
> I tested the Kconfig change, and added 'KCOV_INSTRUMENT := n' to kvm's two
> Makefiles[0].
>
> defconfig+KCOV boots fine, and I can start a guest, but if I build with
> defconfig+KCOV+STACK_TRACER, I get a kernel that fails to boot. It boils down to
> a loop between ftrace and kcov, I will send a patch.
>
>
> It looks like syzkaller is the only user of this data, and it doesn't appear to
> support arm64:
>> 2016/04/13 15:42:55 failed to create instance: qemu stopped:
>> "kvm" accelerator not found.
>> No accelerator found!
syzcaller is able to work with bare-metal Android devices using ADB,
but those are usually running ancient kernels.
Looks like It's time for me to start cross-compiling and testing an
arm64 kernel on a QEMU, so I'll try that out and update the patch.

> This happens because syzkaller expects to be able to use 'qemu-system-x86_64':
>> [pid  3670] execve("/usr/bin/qemu-system-x86_64", ["qemu-system-x86_64",
>> "-hda", "/foo.img", "-snapshot", "-m", "1024", "-net", "nic", "-net",
>> "user,host=10.0.2.10,hostfwd=tcp:"..., "-nographic", "-enable-kvm", "-numa",
>> "node,nodeid=0,cpus=0-1", "-numa", "node,nodeid=1,cpus=2-3", ...],
>
> qemu-system-x86_64 is installed and works fine, it just doesn't have the
> expected hardware acceleration...
>
> My approximation of your qemu command for arm64 may be useful[1], but I'm not
> able to hack the go source to fix it!
>
>
>
> Thanks,
>
> James
>
>
>
> [0]
> diff --git a/arch/arm64/kvm/Makefile b/arch/arm64/kvm/Makefile
> index 122cff482ac4..7d111f06bbf3 100644
> --- a/arch/arm64/kvm/Makefile
> +++ b/arch/arm64/kvm/Makefile
> @@ -9,6 +9,10 @@ CFLAGS_mmu.o := -I.
>  KVM=../../../virt/kvm
>  ARM=../../../arch/arm/kvm
>
> +# Code built here may run at EL2, in which case __sanitizer_cov_trace_pc() will
> +# not be callable. For now, disable the instrumentation.
> +KCOV_INSTRUMENT := n
> +
>  obj-$(CONFIG_KVM_ARM_HOST) += kvm.o
>  obj-$(CONFIG_KVM_ARM_HOST) += hyp/
>
> diff --git a/arch/arm64/kvm/hyp/Makefile b/arch/arm64/kvm/hyp/Makefile
> index 778d0effa2af..1150f8664c85 100644
> --- a/arch/arm64/kvm/hyp/Makefile
> +++ b/arch/arm64/kvm/hyp/Makefile
> @@ -20,3 +20,4 @@ obj-$(CONFIG_KVM_ARM_HOST) += s2-setup.o
>  GCOV_PROFILE   := n
>  KASAN_SANITIZE := n
>  UBSAN_SANITIZE := n
> +KCOV_INSTRUMENT := n
>
>
> [1]
> qemu-system-aarch64 -enable-kvm
>   -cpu host -m 1024 -M virt -nographic
>   -kernel ./syzkaller/Image
>   -append "console=ttyAMA0,115200 root=/dev/vda"
>   -drive format=raw,file=/foo.img,media=disk,if=none,cache=writeback,id=root
>   -device virtio-blk-device,drive=root
>   -netdev user,host=10.0.2.10,hostfwd=tcp::23505-:22,id=unet
>   -device virtio-net-device,netdev=unet
>
>



-- 
Alexander Potapenko
Software Engineer

Google Germany GmbH
Erika-Mann-Straße, 33
80636 München

Geschäftsführer: Matthew Scott Sucherman, Paul Terence Manicle
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg

  reply	other threads:[~2016-04-13 16:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-31 13:54 [PATCH v1] arm64: allow building with kcov coverage on ARM64 Alexander Potapenko
2016-03-31 14:02 ` Alexander Potapenko
2016-03-31 14:29 ` Mark Rutland
2016-03-31 15:09   ` Alexander Potapenko
2016-03-31 16:00     ` Mark Rutland
2016-03-31 16:33       ` Alexander Potapenko
2016-03-31 16:43         ` Alexander Potapenko
2016-03-31 17:14         ` Mark Rutland
2016-03-31 17:18           ` Alexander Potapenko
2016-04-04 17:30             ` Dmitry Vyukov
2016-04-12 11:17               ` Alexander Potapenko
2016-04-13 16:12                 ` James Morse
2016-04-13 16:35                   ` Alexander Potapenko [this message]
2016-04-13 17:01                 ` Mark Rutland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAG_fn=VbAtmPuzPQPCtSGkkQrGKjciz6AAmNz+VTAdXszWSrLg@mail.gmail.com' \
    --to=glider@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=ard.biesheuvel@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=christoffer.dall@linaro.org \
    --cc=dvyukov@google.com \
    --cc=james.morse@arm.com \
    --cc=kcc@google.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=quentin.casasnovas@oracle.com \
    --cc=syzkaller@googlegroups.com \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).