Build with kasan enabled

817 views
Skip to first unread message

Jimmy

unread,
Dec 16, 2019, 10:07:30 AM12/16/19
to Android Building
Hi, all

I am trying to build an Android kernel (branch android-msm-wahoo-4.4-pie-qpr2) with kasan&kcov enabled using android-llvm toolchain. I modified build.config to:

ARCH=arm64
BRANCH=android-msm-wahoo-4.4
CC=clang
CLANG_TRIPLE=aarch64-linux-gnu-
CROSS_COMPILE=aarch64-linux-android-
CROSS_COMPILE_ARM32=arm-linux-androideabi-
DEFCONFIG=wahoo_defconfig
EXTRA_CMDS=''
KERNEL_DIR=private/msm-google
POST_DEFCONFIG_CMDS="check_defconfig && update_kasan_config"

function update_kasan_config() {
    ${KERNEL_DIR}/scripts/config --file ${OUT_DIR}/.config \
         -e CONFIG_KASAN \
         -e CONFIG_KASAN_INLINE \
         -e CONFIG_TEST_KASAN \
         -e CONFIG_KCOV \
         -e CONFIG_SLUB \
         -e CONFIG_SLUB_DEBUG \
         -e CONFIG_SLUB_DEBUG_ON \
         -d CONFIG_SLUB_DEBUG_PANIC_ON \
         -d CONFIG_KASAN_OUTLINE \
         -d CONFIG_KERNEL_LZ4 \
         -d CONFIG_RANDOMIZE_BASE
    (cd ${OUT_DIR} && \
     make O=${OUT_DIR} $archsubarch CROSS_COMPILE=${CROSS_COMPILE} olddefconfig)
}
CLANG_PREBUILT_BIN=prebuilts-master/clang/host/linux-x86/clang-4691093/bin/
LINUX_GCC_CROSS_COMPILE_PREBUILTS_BIN=prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin
LINUX_GCC_CROSS_COMPILE_ARM32_PREBUILTS_BIN=prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin
LZ4_PREBUILTS_BIN=prebuilts-master/misc/linux-x86/lz4
DTC_PREBUILTS_BIN=prebuilts-master/misc/linux-x86/dtc
LIBUFDT_PREBUILTS_BIN=prebuilts-master/misc/linux-x86/libufdt
FILES="
arch/arm64/boot/dtbo.img
arch/arm64/boot/Image.lz4-dtb
vmlinux
System.map
"
IN_KERNEL_MODULES=1
STOP_SHIP_TRACEPRINTK=1
UNSTRIPPED_MODULES="
wlan.ko
"
However, when I tried to build the kernel using build/build.sh, I got several errors as follows:
aosp-kernel/private/msm-google/drivers/misc/qcom/qdsp6v2/audio_hwacc_effects.c:538:13: error
      stack frame size of 2144 bytes in function 'audio_effects_compat_ioctl'
      [-Werror,-Wframe-larger-than=]

aosp-kernel/private/msm-google/drivers/media/platform/msm/camera_v2/pproc/cpp/msm_cpp.c:4018:13: error
      stack frame size of 3200 bytes in function 'msm_cpp_subdev_fops_compat_ioctl'
      [-Werror,-Wframe-larger-than=]

I have done some searching, but could not find the answer.
Could someone help me with this? Thanks in advance!

Best,
Jimmy

Akshay Mhaske

unread,
Dec 23, 2019, 11:31:23 AM12/23/19
to android-...@googlegroups.com
This warnings comes if the size of a function frame is larger than length byte.
It is recommended to choose 2048 as default warning threshold for 64bit architecture.
Can you please try to increase FRAME_WARN size to 2048 or larger.
CONFIG_FRAME_WARN=2048

Thanks,
Akshay


--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to android-...@googlegroups.com
To unsubscribe from this group, send email to
android-buildi...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-buildi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-building/dcf4556c-69e9-485c-9d4c-a4e8119c3165%40googlegroups.com.

Jimmy

unread,
Dec 26, 2019, 12:13:51 PM12/26/19
to Android Building
Hi Akshay,

Thanks for your reply. I add  KBUILD_CFLAGS += -w flag in Makefile and the compilation is done. However, during the link process, I got some undefined reference errors. I also tried gcc, the building process works fine. But after I flash the new kernel into Pixel2. The touch screen does not respond. Do you have any experience building a Pixel 2 kernel with kasan&kcov enabled? Thanks!

  CC [M]  drivers/staging/qcacld-3.0/core/utils/pktlog/linux_ac.o
  CC [M]  drivers/staging/qcacld-3.0/core/utils/host_diag_log/src/host_diag_log.o
  LD [M]  drivers/staging/qcacld-3.0/wlan.o
  LD      drivers/staging/built-in.o
  LD      drivers/built-in.o
  LINK    vmlinux
  LD      vmlinux.o
  MODPOST vmlinux.o
  GEN     .version
  CHK     include/generated/compile.h
drivers/built-in.o: In function `gpiod_set_array_value_priv':
aosp-kernel/private/msm-google/drivers/gpio/gpiolib.c:1441: undefined reference to `__asan_alloca_poison'
aosp-kernel/private/msm-google/drivers/gpio/gpiolib.c:1441:(.text+0x1b708): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `__asan_alloca_poison'
aosp-kernel/private/msm-google/drivers/gpio/gpiolib.c:1442: undefined reference to `__asan_alloca_poison'
aosp-kernel/private/msm-google/drivers/gpio/gpiolib.c:1442:(.text+0x1b760): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `__asan_alloca_poison'
aosp-kernel/private/msm-google/drivers/gpio/gpiolib.c:1478: undefined reference to `__asan_allocas_unpoison'

Best, 
Jimmy

For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages