Building a Pixel kernel with KASAN+KCOV

1,085 views
Skip to first unread message

Dmitry Vyukov

unread,
Oct 10, 2017, 5:03:43 AM10/10/17
to syzkaller
Just noticed this article on source.android.com:

https://source.android.com/devices/tech/debug/kasan-kcov

Don't know who wrote it, but it goes through configuring, building,
imaging kernel for a Pixel device.

王赛

unread,
Oct 12, 2017, 10:06:43 PM10/12/17
to syzkaller
Hi Dmitry,
I build a pixel xl kernel with KASAN+KCOV enabled, 
but the produced kernel image is too large to flash to pixel boot partition.

KASAN+KCOV config: 
CONFIG_KASAN=y
CONFIG_KASAN_INLINE=y
CONFIG_KCOV=y

prodeuced kernel image size: 29.8 MB
boot.img size: 37 MB

pixel xl boot partition size: 32 MB

Any idea how I can overcome this problem?

Thanks,

Sai

在 2017年10月10日星期二 UTC+8下午5:03:43,Dmitry Vyukov写道:

dar...@gmail.com

unread,
Oct 14, 2017, 9:29:22 AM10/14/17
to syzkaller
Hi Sai, make sure you are using the latest Android NDK, this shrank the generated kernel for me. Also, not mentioned in the article, make sure you have CONFIG_CC_OPTIMIZE_FOR_SIZE=y (this is not enabled by default).

Dmitry Vyukov

unread,
Oct 14, 2017, 10:29:35 AM10/14/17
to MC, syzkaller, Billy Lau
On Sat, Oct 14, 2017 at 3:29 PM, <dar...@gmail.com> wrote:
> Hi Sai, make sure you are using the latest Android NDK, this shrank the
> generated kernel for me. Also, not mentioned in the article, make sure you
> have CONFIG_CC_OPTIMIZE_FOR_SIZE=y (this is not enabled by default).


+Billy, is it something we should mention in the article?


> On Thursday, October 12, 2017 at 10:06:43 PM UTC-4, 王赛 wrote:
>>
>> Hi Dmitry,
>> I build a pixel xl kernel with KASAN+KCOV enabled,
>> but the produced kernel image is too large to flash to pixel boot
>> partition.
>>
>> KASAN+KCOV config:
>> CONFIG_KASAN=y
>> CONFIG_KASAN_INLINE=y
>> CONFIG_KCOV=y
>>
>> prodeuced kernel image size: 29.8 MB
>> boot.img size: 37 MB
>>
>> pixel xl boot partition size: 32 MB
>>
>> Any idea how I can overcome this problem?
>>
>> Thanks,
>>
>> Sai
>>
>> 在 2017年10月10日星期二 UTC+8下午5:03:43,Dmitry Vyukov写道:
>>>
>>> Just noticed this article on source.android.com:
>>>
>>> https://source.android.com/devices/tech/debug/kasan-kcov
>>>
>>> Don't know who wrote it, but it goes through configuring, building,
>>> imaging kernel for a Pixel device.
>
> --
> You received this message because you are subscribed to the Google Groups
> "syzkaller" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to syzkaller+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

王赛

unread,
Oct 15, 2017, 11:37:04 PM10/15/17
to syzkaller
Thanks, according to your instructions, with both KCOV and KASAN enabled, I build a smaller kernel and flash to pixel xl success, 
but I got a failed boot, any suggestions?

Some related infomation:
1. NDK version is r16 beta1
2. With only KCOV enabled, the boot is ok, and syzkaller can get cover info from kernel
3. With KASAN enabled, I got a messge: scripts/Makefile.kasan:25: CONFIG_KASAN: compiler does not support all options. Trying minimal configuration.


在 2017年10月14日星期六 UTC+8下午9:29:22,dar...@gmail.com写道:

yuki

unread,
Oct 16, 2017, 2:18:40 AM10/16/17
to syzkaller
Thanks for the tip, it works nicely on PixelXL.

edward...@gmail.com

unread,
Oct 16, 2017, 2:44:56 AM10/16/17
to syzkaller
seem doesn't work in Pixel(sailfish). :(

Dmitry Vyukov於 2017年10月10日星期二 UTC+8下午5時03分43秒寫道:

Billy Lau

unread,
Oct 16, 2017, 5:24:54 PM10/16/17
to Dmitry Vyukov, MC, syzkaller
Yes, CONFIG_CC_OPTIMIZE_FOR_SIZE=y is something that should have been included in the article. When I was writing and testing it, that flag was still in defconfig. I guess that flag was somehow turned off during one of the commits.

王赛

unread,
Oct 17, 2017, 2:55:16 AM10/17/17
to syzkaller
It's OK now, after I switch android 7.1.2 to android 8.0.

在 2017年10月16日星期一 UTC+8上午11:37:04,王赛写道:

User :D

unread,
Jun 13, 2022, 8:55:59 AM6/13/22
to syzkaller
can you help me create boot.img for pixel 3 i can't find the ramdisk
Reply all
Reply to author
Forward
0 new messages