public inbox for [email protected]
 help / color / mirror / Atom feed
* False positives in nolibc check
@ 2023-06-20 13:31 Stefan Hajnoczi
  2023-06-20 14:39 ` Alviro Iskandar Setiawan
  2023-06-20 15:49 ` Ammar Faizi
  0 siblings, 2 replies; 10+ messages in thread
From: Stefan Hajnoczi @ 2023-06-20 13:31 UTC (permalink / raw)
  To: io-uring; +Cc: Ammar Faizi, Jens Axboe, Jeff Moyer, Alviro Iskandar Setiawan

[-- Attachment #1: Type: text/plain, Size: 2195 bytes --]

Hi,
The nolibc build is enabled on x86-64, i686, and aarch64 since commit
bfb432f4cce5 ("configure: Always enable `CONFIG_NOLIBC` if the arch is
supported").

When I build the liburing 2.4 rpm package for Fedora i686, nolibc is
enabled but the following compilation error occurs:

  gcc -fPIC -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m32 -march=i686 -mtune=generic -msse2 -mfpmath=sse -mstackrealign -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection  -Wno-unused-parameter -DLIBURING_INTERNAL  -nostdlib -nodefaultlibs -ffreestanding -fno-builtin -shared -Wl,--version-script=liburing.map -Wl,-soname=liburing.so.2 -o liburing.so.2.4 setup.os queue.os register.os syscall.os version.os nolibc.os -Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes  -nostdlib -nodefaultlibs
  make[1]: Leaving directory '/builddir/build/BUILD/liburing-2.4/src'
  /usr/bin/ld: /tmp/cca16k90.ltrans0.ltrans.o: in function `__io_uring_submit':
  /builddir/build/BUILD/liburing-2.4/src/queue.c:388: undefined reference to `__stack_chk_fail_local'

This is caused by the stack protector compiler options, which depend on
the libc __stack_chk_fail_local symbol.

The compile_prog check in ./configure should use the final
CFLAGS/LDFLAGS (including -ffreestanding) that liburing is compiled with
to avoid false positives. That way it can detect that nolibc won't work
with these compiler options and fall back to using libc.

In general, I'm concerned that nolibc is fragile because the toolchain
and libc sometimes have dependencies that are activated by certain
compiler options. Some users will want libc and others will not. Maybe
make it an explicit option instead of probing?

I've included a downstream patch in the Fedora package that disables
nolibc for the time being.

Thanks,
Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-07-12 15:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-20 13:31 False positives in nolibc check Stefan Hajnoczi
2023-06-20 14:39 ` Alviro Iskandar Setiawan
2023-06-21  9:47   ` Stefan Hajnoczi
2023-06-20 15:49 ` Ammar Faizi
2023-06-20 16:16   ` Alviro Iskandar Setiawan
2023-06-21 10:04   ` Stefan Hajnoczi
2023-06-21 10:19     ` Ammar Faizi
2023-06-21 11:51       ` Guillem Jover
2023-06-21 16:08         ` Ammar Faizi
2023-07-12 15:00       ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox