Arm + KASAN + syzbot

Dmitry Vyukov dvyukov at google.com
Tue Jan 19 07:05:11 EST 2021


On Tue, Jan 19, 2021 at 12:43 PM Russell King - ARM Linux admin
<linux at armlinux.org.uk> wrote:
>
> On Tue, Jan 19, 2021 at 12:17:37PM +0100, Dmitry Vyukov wrote:
> > On Tue, Jan 19, 2021 at 12:13 PM Russell King - ARM Linux admin
> > <linux at armlinux.org.uk> wrote:
> > >
> > > On Tue, Jan 19, 2021 at 12:05:01PM +0100, Dmitry Vyukov wrote:
> > > > But I also spied this in your makefile:
> > > >
> > > > config-earlydebug: config-base
> > > > $(CURDIR)/scripts/config --file $(config_file) \
> > > > --enable DEBUG_LL \
> > > > --enable EARLY_PRINTK \
> > > > --enable DEBUG_VEXPRESS_UART0_RS1 \
> > > >
> > > > With these configs, qemu prints something more useful:
> > > >
> > > > pulseaudio: set_sink_input_volume() failed
> > > > pulseaudio: Reason: Invalid argument
> > > > pulseaudio: set_sink_input_mute() failed
> > > > pulseaudio: Reason: Invalid argument
> > > > Error: invalid dtb and unrecognized/unsupported machine ID
> > > >   r1=0x000008e0, r2=0x00000000
> > > > Available machine support:
> > > > ID (hex) NAME
> > > > ffffffff Generic DT based system
> > > > ffffffff Samsung Exynos (Flattened Device Tree)
> > > > ffffffff Hisilicon Hi3620 (Flattened Device Tree)
> > > > ffffffff ARM-Versatile Express
> > > > Please check your kernel config and/or bootloader.
> > > >
> > > >
> > > > What does this mean? And is this affected by KASAN?... I do specify
> > > > the ARM-Versatile Express machine...
> > > >
> > > > Can it be too large kernel size which is not supported/properly
> > > > diagnosed by qemu/kernel?
> > >
> > > It means that your kernel only supports DT platforms, but there was
> > > no DT passed to the kernel (r2 is the pointer to DT). Consequently
> > > the kernel has no idea what hardware it is running on.
> > >
> > > I don't use qemu very much, so I can't suggest anything.
> >
> > I do pass DT and it boots fine w/o KASAN, so it seems to be poor
> > diagnostics of something else.
>
> It is the best we can do at that time. Consider yourself lucky that you
> can even get _that_ message since the kernel has no clue what hardware
> is available, and there is no standardised hardware.
>
> All that the kernel knows at this point is that (1) the machine ID in
> r1 does not match anything the kernel knows about (which are all DT
> platforms), and r2 is NULL, meaning no DT was passed to the
> decompressed kernel.
>
> There is no further information that the kernel knows. I suppose we
> could hexdump random bits of memory space through the serial port or
> whatever, but that would be very random.
>
> I'm not sure what else you think the kernel could do at this point.
>
> > It seems to be due to kernel size. I enabled CONFIG_KASAN_OUTLINE=y
> > and CONFIG_CC_OPTIMIZE_FOR_SIZE=y and now it boots...
>
> So, likely the DT was obliterated. How are you passing the DT? If
> you are passing it via qemu, then qemu's placement of DT is too close
> to the kernel.

Yes, I used the qemu -dtb flag.

I tried to use CONFIG_ARM_APPENDED_DTB because it looks like a very
nice option. However, I couldn't make it work.
I enabled:
CONFIG_ARM_APPENDED_DTB=y
CONFIG_ARM_ATAG_DTB_COMPAT=y
# CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER is not set
CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEND=y
and removed qemu -dtb flag and I see:

Error: invalid dtb and unrecognized/unsupported machine ID
  r1=0x000008e0, r2=0x80000100
  r2[]=05 00 00 00 01 00 41 54 01 00 00 00 00 10 00 00
Available machine support:

ID (hex) NAME
ffffffff Generic DT based system
ffffffff Samsung Exynos (Flattened Device Tree)
ffffffff Hisilicon Hi3620 (Flattened Device Tree)
ffffffff ARM-Versatile Express

Please check your kernel config and/or bootloader.



More information about the linux-arm-kernel mailing list