Re: SIGFPE in s6-rc-init 3.0.0 etc,...

From: Eric Le Bihan <eric.le.bihan.dev_at_free.fr>
Date: Sun, 17 Dec 2017 18:18:27 +0100

On 17-12-15 00:59:12, Stefan Nilsson wrote:
> Den 2017-12-14 kl. 23:44, skrev Eric Le Bihan:
> > Hi all!
> >
> > On 17-12-14 22:35:52, Stefan Nilsson wrote:
> > > Hey Laurent,
> > <snip>
> > >
> > > So what to do,... I found:
> > > https://skarnet.org/cgi-bin/archive.cgi?1:mss:1099:201711
> > > and decided to update to this version in my buildroot system instead, but
> > > then I got a build error:
> > >
> > > make[1]: Entering directory '/home/stefan/buildroot/output/build/s6-2.6.2.0'
> > > exec /home/stefan/buildroot/output/host/bin/i586-buildroot-linux-gnu-gcc
> > > -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -iquote src/include-local
> > > -Isrc/include -Werror=implicit-function-declaration -Werror=implicit-int
> > > -Werror=pointer-sign -Werror=pointer-arith -I/home/stefan/buildroot/output/host/i586-buildroot-linux-gnu/sysroot/usr/include
> > > -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -pipe -Wall
> > > -std=c99 -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
> > > -Wa,--noexecstack -ffunction-sections -fdata-sections -O2
> > > -fomit-frame-pointer -fno-stack-protector -D_LARGEFILE_SOURCE
> > > -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O1 -c -o
> > > src/daemontools-extras/s6-applyuidgid.o
> > > src/daemontools-extras/s6-applyuidgid.c
> > > src/daemontools-extras/s6-applyuidgid.c: In function 'main':
> > > src/daemontools-extras/s6-applyuidgid.c:57:29: error: implicit declaration
> > > of function 'setgroups_and_gid' [-Werror=implicit-function-declaration]
> > > if (gidn != (size_t)-1 && setgroups_and_gid(gid ? gid : getegid(), gidn,
> > > gids) < 0)
> > > ^~~~~~~~~~~~~~~~~
> > > cc1: some warnings being treated as errors
> >
> > Being the submitter of the s6 patches to Buildroot, maybe I can help.
> >
> > IIUC, setgroups_and_gid() gets compiled only if SKALIBS_HASSETGROUPS is
> > set in the file sysdeps.h generated by ./configure script. So maybe this
> > file has been incorrectly generated for your platform.
> >
> > Could you share your Buildroot defconfig (or at least the toolchain
> > specification) so I can test it on my side?
>
> Absolutely, you can find my buildroot defconfig here:
> http://steffe.net/buildroot_defconfig
>
> Here is the patch I created to update the s6 packages:
> http://steffe.net/0001-Updated-s6-packages.patch

I posted a bump of these packages recently, which is similar to your
patch.

> So basically I had 2017.11 that built OK, applied the patch above, and got
> the build error.

Intriguing. I tested your defconfig and the build went like a charm
using the HEAD of upstream Buildroot. The function setgroup() is
properly detected by the configure script, which compiles and links a
test program using the cross-compiler:

```
+ choose cl setgroups SETGROUPS setgroups()
+ what=cl
+ name=setgroups
+ macro=SETGROUPS
+ echo Checking whether system has setgroups()...
+ IFS=
+ printf %s\n Checking whether system has setgroups()...
Checking whether system has setgroups()...
+ shift 4
+ libs=
+ r=true
+ /home/eric/build/test-s6/x86/host/bin/i586-buildroot-linux-gnu-gcc -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -Isrc/include -Werror=implicit-function-declaration -Werror=implicit-int -Werror=pointer-sign -Werror=pointer-arith -Wno-unused-value -Wno-parentheses -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -pipe -Wall -std=c99 -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -ffunction-sections -fdata-sections -O2 -fomit-frame-pointer -fno-stack-protector -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O1 -o trysetgroups.o -c src/sysdeps/trysetgroups.c
+ true
+ /home/eric/build/test-s6/x86/host/bin/i586-buildroot-linux-gnu-gcc -pipe -Wall -std=c99 -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -ffunction-sections -fdata-sections -O2 -fomit-frame-pointer -fno-stack-protector -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O1 -Wl,--sort-section=alignment -Wl,--sort-common -Wl,--hash-style=both -o trysetgroups trysetgroups.o
+ true
+ rm -f trysetgroups.o trysetgroups
+ true
+ echo setgroups: yes
+ IFS=
+ printf %s\n setgroups: yes
+ echo #define SKALIBS_HASSETGROUPS
+ IFS=
+ printf %s\n #define SKALIBS_HASSETGROUPS
```

The previous trace has been generated by using "sh -x ./configure" in
skalibs.mk. Check how this goes in your case and have a look at the
generated sysdeps.h.

> Btw, do you know when we will have the option to select s6-rc as the primary
> init system in buildroot, as an alternative to busybox, systemV and systemd?
> That would really make my day! :o)

As s6-rc and friends provide a mechanism and do not enforce a policy,
declaring it as an init system alternative in Buildroot would require the
addition of the proper services (disk mounting, network setup, etc).
This is not available yet.

My personal attempt at this topic takes the form of a Buildroot external
customization named br2-ext-skarnet [1], which relies on two packages:
s6-br2-init-skeleton [2] and s6-br2-init-services [3]. Polishing is
needed.

[1] https://github.com/elebihan/br2-ext-skarnet
[2] https://github.com/elebihan/s6-br2-init-skeleton
[3] https://github.com/elebihan/s6-br2-init-services

Regards,

--
ELB
Received on Sun Dec 17 2017 - 17:18:27 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:38:49 UTC