Project

General

Profile

Bug #4687

simtrace2 dpkg fails to build on Ubuntu 20.04

Added by laforge 4 days ago. Updated 3 days ago.

Status:
Stalled
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
07/30/2020
Due date:
% Done:

10%


Description

https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/simtrace2/xUbuntu_20.04/x86_64

[  207s]              ram:       11664 B        48 KB     23.73/usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: bin/qmod-dfu-flash.elf section `.text' will not fit in region `rom'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: region `rom' overflowed by 180 bytes
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_USBD_HAL.o:(.rodata.cst4+0x0): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_USBD_HAL.o: in function `USBD_IrqHandler':
[  207s] ./firmware/./atmel_softpack_libraries/libchip_sam3s/source/USBD_HAL.c:1229: warning: undefined reference to `__stack_chk_fail'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_flashd.o:(.rodata.cst4+0x0): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_flashd.o:(.rodata.cst4+0x4): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_flashd.o:(.rodata.cst4+0x8): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_flashd.o:(.rodata.cst4+0xc): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_flashd.o:(.rodata.cst4+0x10): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_flashd.o:(.rodata.cst4+0x14): warning: more undefined references to `__stack_chk_guard' follow
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_flashd.o: in function `ComputeLockRange':
[  207s] ./firmware/./atmel_softpack_libraries/libchip_sam3s/source/flashd.c:138: warning: undefined reference to `__stack_chk_fail'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_flashd.o: in function `FLASHD_Write':
[  207s] ./firmware/./atmel_softpack_libraries/libchip_sam3s/source/flashd.c:275: warning: undefined reference to `__stack_chk_fail'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_flashd.o: in function `FLASHD_Unlock':
[  207s] ./firmware/./atmel_softpack_libraries/libchip_sam3s/source/flashd.c:366: warning: undefined reference to `__stack_chk_fail'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_USBDDriver.o:(.rodata.cst4+0x0): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_USBDDriver.o: in function `USBDDriver_RequestHandler':
[  207s] ./firmware/./atmel_softpack_libraries/usb/device/core/USBDDriver.c:672: warning: undefined reference to `__stack_chk_fail'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o:(.rodata.cst4+0x0): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o:(.rodata.cst4+0x4): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o:(.rodata.cst4+0x8): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o:(.rodata.cst4+0xc): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o:(.rodata.cst4+0x10): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o:(.rodata.cst4+0x14): warning: more undefined references to `__stack_chk_guard' follow
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o: in function `snprintf':
[  207s] ./firmware/libcommon/source/stdio.c:408: warning: undefined reference to `__stack_chk_fail'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o: in function `vfprintf':
[  207s] ./firmware/libcommon/source/stdio.c:448: warning: undefined reference to `__stack_chk_fail'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o: in function `vfprintf_sync':
[  207s] ./firmware/libcommon/source/stdio.c:478: warning: undefined reference to `__stack_chk_fail'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o: in function `printf':
[  207s] ./firmware/libcommon/source/stdio.c:539: warning: undefined reference to `__stack_chk_fail'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o: in function `printf_sync':
[  207s] ./firmware/libcommon/source/stdio.c:558: warning: undefined reference to `__stack_chk_fail'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_uart_console.o:(.rodata.cst4+0x0): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_uart_console.o:(.rodata.cst4+0x4): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_uart_console.o: in function `UART_Configure':
[  207s] ./firmware/libboard/common/source/uart_console.c:110: warning: undefined reference to `__stack_chk_fail'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_board_qmod.o:(.rodata.cst4+0x0): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_board_qmod.o:(.rodata.cst4+0x4): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_board_qmod.o: in function `board_override_enter_dfu':
[  207s] ./firmware/libboard/qmod/source/board_qmod.c:408: warning: undefined reference to `__stack_chk_fail'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_main.o:(.rodata.cst4+0x0): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_main.o: in function `USBDFU_handle_dnload':
[  207s] ./firmware/apps/dfu/main.c:150: warning: undefined reference to `__stack_chk_fail'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_dfu_desc.o:(.rodata.cst4+0x0): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_dfu_desc.o: in function `set_usb_serial_str':
[  207s] ./firmware/./atmel_softpack_libraries/usb/device/dfu/dfu_desc.c:211: warning: undefined reference to `__stack_chk_fail'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_dfu_driver.o:(.rodata.cst4+0x0): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_dfu_driver.o: in function `handle_getstate':
[  207s] ./firmware/./atmel_softpack_libraries/usb/device/dfu/dfu_driver.c:91: warning: undefined reference to `__stack_chk_fail'
[  207s] collect2: error: ld returned 1 exit status

Intrestingly, the problem does not appear when manually building inside a ubuntu 20.04 lxc container. So it must somehow be related to which compiler flags are used during dpkg builds

History

#1 Updated by laforge 4 days ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10

#2 Updated by laforge 4 days ago

export DEB_BUILD_MAINT_OPTIONS = hardening=+all,-stackprotector

in debian/rules works around the problem - but then this means even the host binaries are built without stack smashing protection :/

We would want to enable this selectively for the firmware sub-directory

#3 Updated by laforge 4 days ago

laforge wrote:

We would want to enable this selectively for the firmware sub-directory

I did try any combinations of export / variable assignments, but I couldn't get dpkg to build the 'firmware' target with different DEB_BUILD_MAINT_OPTIONS than the host utilitites :/

#4 Updated by laforge 3 days ago

  • Status changed from In Progress to Stalled

I posted the question to the debian-dpkg mailing list

#5 Updated by fixeria 3 days ago

Hi Harald,

why not to simply add the missing symbols?

The '__stack_chk_guard' is basically a magic value (e.g. 0xdeadbeef), and '__stack_chk_fail' is a user-defined function that will be called if the stack is corrupted. It could basically call osmo_panic().

This code should make the linker happy:

uintptr_t __stack_chk_guard = 0xdeadbeef; // adapt to the word width of your architecture

void __stack_chk_fail(void)
{
  osmo_panic("Stack smashing detected!\n");
}

Best regards,
Vadim.

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)