diff mbox series

[uclibc-ng-devel] Re: [Buildroot] [PATCH v1] package/ntpsec: new package

Message ID 20211104213045.1d702c3d@gmx.net
State New
Headers show
Series [uclibc-ng-devel] Re: [Buildroot] [PATCH v1] package/ntpsec: new package | expand

Commit Message

Peter Seiderer Nov. 4, 2021, 8:30 p.m. UTC
Hello Waldemar,

On Sun, 31 Oct 2021 00:56:56 +0200, Waldemar Brodkorb <wbx@openadk.org> wrote:

> Hi Peter,
> Peter Seiderer wrote,
>
> > Hello Waldemar, *,
> >
> > On Mon, 25 Oct 2021 23:25:41 +0200, Peter Seiderer <ps.report@gmx.net> wrote:
> >
> > The resulting ntpd runs fine with the raspberrypi3_defconfig, but segfaults
> > when compiled/used with raspberrypi3_64_defconfig (uclibc, -Os):
> >
> > 	$ /usr/sbin/ntpd -n -d -g
> > 1970-01-01T00:04:18 ntpd[263]: INIT: ntpd ntpsec-1.2.0 2021-10-24T13:39:21Z: Starting
> > 1970-01-01T00:04:18 ntpd[263]: INIT: Command line: /usr/sbin/ntpd -n -d
> > 1970-01-01T00:04:18 ntpd[263]: INIT: precision = 7.291 usec (-17)
> > 1970-01-01T00:04:18 ntpd[263]: INIT: successfully locked into RAM
> > 1970-01-01T00:04:18 ntpd[263]: CONFIG: readconfig: parsing file: /etc/ntp.conf
> > 1970-01-01T00:04:18 ntpd[263]: CONFIG: restrict nopeer ignored
> > 1970-01-01T00:04:18 ntpd[263]: INIT: Using SO_TIMESTAMPNS
> > 1970-01-01T00:04:18 ntpd[263]: IO: Listen and drop on 0 v6wildcard [::]:123
> > 1970-01-01T00:04:18 ntpd[263]: IO: Listen and drop on 1 v4wildcard 0.0.0.0:123
> > 1970-01-01T00:04:18 ntpd[263]: IO: Listen normally on 2 lo 127.0.0.1:123
> > 1970-01-01T00:04:18 ntpd[263]: IO: Listen normally on 3 eth0 172.16.0.30:123
> > 1970-01-01T00:04:18 ntpd[263]: IO: Listen normally on 4 lo [::1]:123
> > 1970-01-01T00:04:18 ntpd[263]: IO: Listen normally on 5 eth0 [fe80::ba27:ebff:fea6:340%2]:123
> > 1970-01-01T00:04:18 ntpd[263]: IO: Listening on routing socket on fd #22 for interface updates
> > 1970-01-01T00:04:19 ntpd[263]: SYNC: Found 10 servers, suggest minsane at least 3
> > 1970-01-01T00:04:19 ntpd[263]: INIT: MRU 10922 entries, 13 hash bits, 65536 bytes
> > 1970-01-01T00:04:20 ntpd[263]: DNS: dns_probe: 0.pool.ntp.org, cast_flags:8, flags:101
> > Segmentation fault (core dumped)
>
> Could you add a small C test program to uClibc-ng-test to trigger
> the bug? That would help to find any regression to targets without
> TLS support.

Did take a first look at the uClibc-ng-test regarding the problem,
there is already one test/inet/tst-res test...


For the raspberrypi3_defconfig case (uclibc unpatched):

	$ sh uclibcng-testrunner.sh
[...]
FAIL tst-ethers-line got 1 expected 0
	Cannot open file /etc/ethers: No such file or directory
FAIL tst-ethers got 1 expected 0
	Either /etc/ethers is missing or it has incorrect contents
[...]
FAIL tst-cancel18 got 1 expected 0
	going to cancel in-time
	Timed out: killed the child process
[...]
FAIL tst-cancelx18 got 1 expected 0
	going to cancel in-time
	Timed out: killed the child process
[...]
Total skipped: 15
Total failed: 4
Total passed: 460



For the raspberrypi3_64_defconfig case (uclibc unpatched):

	$ sh uclibcng-testrunner.sh
[...]
FAIL tst-ethers-line got 1 expected 0
	Cannot open file /etc/ethers: No such file or directory
FAIL tst-ethers got 1 expected 0
	Either /etc/ethers is missing or it has incorrect contents
[...]
FAIL tst-res got 139 expected 0
	Segmentation fault (core dumped)
[...]
FAIL tst-seekdir got 1 expected 0
	.
	..
	tst-seekdir.out
	tst-utmpx
	tst-inotify
	tst-mkostemps.out
	seek.out
	tst-scandir
	tst-seekdir
	tst-statvfs.out
	sem
	stdarg.out
	fdopen.out
	tst-utmp
	tst-preadvwritev.out
	bug-glob2.out
	popen
	dirent64.out
	tst-scandir.out
	tst-hasmntopt.out
	tst-statvfs
	bug-glob2
	popen.out
	Makefile
	opendir-tst1
	sem.out
	tst-inotify.out
	tst-syscall0
	tst-statfs.out
	bug-readdir1
	dirent.out
	tst-statfs
	tst-syscall1.out
	tst-syscall0.out
	stdarg
	tst-preadvwritev
	tst-syscall6.out
	tst-mkostemps
	Makefile.in
	tst-utmp.out
	tst-nftw
	opendir-tst1.out
	tst-syscall1
	bug-readdir1.out
	tst-hasmntopt
	tst-syscall6
	fdopen
	seek
	tst-nftw.out
	dirent64
	tst-fnmatch.input
	tst-utmpx.out
	dirent
	going back past 4-th entry...
	seekdir (d, -1600443765); telldir (d) == -1
[...]
FAIL tst-cancel18 got 1 expected 0
	going to cancel in-time
	Timed out: killed the child process
[...]
FAIL tst-cancelx18 got 1 expected 0
	going to cancel in-time
	Timed out: killed the child process
[...]
FAIL tst-tls3 got 1 expected 0

	/usr/lib/uclibc-ng-test/test/tls/tst-tls3: symbol 'baz': can't handle reloc type 0x404
FAIL tst-tls4 got 1 expected 0

	/usr/lib/uclibc-ng-test/test/tls/tst-tls4: symbol 'foo': can't handle reloc type 0x404
FAIL tst-tls5 got 1 expected 0

	/usr/lib/uclibc-ng-test/test/tls/tst-tls5: symbol 'foo': can't handle reloc type 0x404
FAIL tst-tls6 got 1 expected 0

	/usr/lib/uclibc-ng-test/test/tls/tst-tls6: symbol 'foo': can't handle reloc type 0x404
FAIL tst-tls7 got 1 expected 0

	/usr/lib/uclibc-ng-test/test/tls/tst-tls7: symbol 'foo': can't handle reloc type 0x404
FAIL tst-tls8 got 1 expected 0

	/usr/lib/uclibc-ng-test/test/tls/tst-tls8: symbol 'foo': can't handle reloc type 0x404
[...]
Total skipped: 15
Total failed: 12
Total passed: 454


The tst-res Segmentation fault failure can be fixed by
this additional uclibc patch:



Will take a look at some glibc resolv tests and try to port
them (and, if I find enough time, at some of the other
failures)...

Regards,
Peter

>
> best regards
>  Waldemar

Comments

Waldemar Brodkorb Nov. 11, 2021, 8:58 a.m. UTC | #1
Hi Peter,
Peter Seiderer wrote,

> Hello Waldemar,
> 
> On Sun, 31 Oct 2021 00:56:56 +0200, Waldemar Brodkorb <wbx@openadk.org> wrote:
> 
> > Hi Peter,
> > Peter Seiderer wrote,
> >
> > > Hello Waldemar, *,
> > >
> > > On Mon, 25 Oct 2021 23:25:41 +0200, Peter Seiderer <ps.report@gmx.net> wrote:
> > >
> > > The resulting ntpd runs fine with the raspberrypi3_defconfig, but segfaults
> > > when compiled/used with raspberrypi3_64_defconfig (uclibc, -Os):
> > >
> > > 	$ /usr/sbin/ntpd -n -d -g
> > > 1970-01-01T00:04:18 ntpd[263]: INIT: ntpd ntpsec-1.2.0 2021-10-24T13:39:21Z: Starting
> > > 1970-01-01T00:04:18 ntpd[263]: INIT: Command line: /usr/sbin/ntpd -n -d
> > > 1970-01-01T00:04:18 ntpd[263]: INIT: precision = 7.291 usec (-17)
> > > 1970-01-01T00:04:18 ntpd[263]: INIT: successfully locked into RAM
> > > 1970-01-01T00:04:18 ntpd[263]: CONFIG: readconfig: parsing file: /etc/ntp.conf
> > > 1970-01-01T00:04:18 ntpd[263]: CONFIG: restrict nopeer ignored
> > > 1970-01-01T00:04:18 ntpd[263]: INIT: Using SO_TIMESTAMPNS
> > > 1970-01-01T00:04:18 ntpd[263]: IO: Listen and drop on 0 v6wildcard [::]:123
> > > 1970-01-01T00:04:18 ntpd[263]: IO: Listen and drop on 1 v4wildcard 0.0.0.0:123
> > > 1970-01-01T00:04:18 ntpd[263]: IO: Listen normally on 2 lo 127.0.0.1:123
> > > 1970-01-01T00:04:18 ntpd[263]: IO: Listen normally on 3 eth0 172.16.0.30:123
> > > 1970-01-01T00:04:18 ntpd[263]: IO: Listen normally on 4 lo [::1]:123
> > > 1970-01-01T00:04:18 ntpd[263]: IO: Listen normally on 5 eth0 [fe80::ba27:ebff:fea6:340%2]:123
> > > 1970-01-01T00:04:18 ntpd[263]: IO: Listening on routing socket on fd #22 for interface updates
> > > 1970-01-01T00:04:19 ntpd[263]: SYNC: Found 10 servers, suggest minsane at least 3
> > > 1970-01-01T00:04:19 ntpd[263]: INIT: MRU 10922 entries, 13 hash bits, 65536 bytes
> > > 1970-01-01T00:04:20 ntpd[263]: DNS: dns_probe: 0.pool.ntp.org, cast_flags:8, flags:101
> > > Segmentation fault (core dumped)
> >
> > Could you add a small C test program to uClibc-ng-test to trigger
> > the bug? That would help to find any regression to targets without
> > TLS support.
> 
> Did take a first look at the uClibc-ng-test regarding the problem,
> there is already one test/inet/tst-res test...
> 
> 
> For the raspberrypi3_defconfig case (uclibc unpatched):
> 
> 	$ sh uclibcng-testrunner.sh
> [...]
> FAIL tst-ethers-line got 1 expected 0
> 	Cannot open file /etc/ethers: No such file or directory
> FAIL tst-ethers got 1 expected 0
> 	Either /etc/ethers is missing or it has incorrect contents
> [...]
> FAIL tst-cancel18 got 1 expected 0
> 	going to cancel in-time
> 	Timed out: killed the child process
> [...]
> FAIL tst-cancelx18 got 1 expected 0
> 	going to cancel in-time
> 	Timed out: killed the child process
> [...]
> Total skipped: 15
> Total failed: 4
> Total passed: 460
> 
> 
> 
> For the raspberrypi3_64_defconfig case (uclibc unpatched):
> 
> 	$ sh uclibcng-testrunner.sh
> [...]
> FAIL tst-ethers-line got 1 expected 0
> 	Cannot open file /etc/ethers: No such file or directory
> FAIL tst-ethers got 1 expected 0
> 	Either /etc/ethers is missing or it has incorrect contents
> [...]
> FAIL tst-res got 139 expected 0
> 	Segmentation fault (core dumped)
> [...]
> FAIL tst-seekdir got 1 expected 0
> 	.
> 	..
> 	tst-seekdir.out
> 	tst-utmpx
> 	tst-inotify
> 	tst-mkostemps.out
> 	seek.out
> 	tst-scandir
> 	tst-seekdir
> 	tst-statvfs.out
> 	sem
> 	stdarg.out
> 	fdopen.out
> 	tst-utmp
> 	tst-preadvwritev.out
> 	bug-glob2.out
> 	popen
> 	dirent64.out
> 	tst-scandir.out
> 	tst-hasmntopt.out
> 	tst-statvfs
> 	bug-glob2
> 	popen.out
> 	Makefile
> 	opendir-tst1
> 	sem.out
> 	tst-inotify.out
> 	tst-syscall0
> 	tst-statfs.out
> 	bug-readdir1
> 	dirent.out
> 	tst-statfs
> 	tst-syscall1.out
> 	tst-syscall0.out
> 	stdarg
> 	tst-preadvwritev
> 	tst-syscall6.out
> 	tst-mkostemps
> 	Makefile.in
> 	tst-utmp.out
> 	tst-nftw
> 	opendir-tst1.out
> 	tst-syscall1
> 	bug-readdir1.out
> 	tst-hasmntopt
> 	tst-syscall6
> 	fdopen
> 	seek
> 	tst-nftw.out
> 	dirent64
> 	tst-fnmatch.input
> 	tst-utmpx.out
> 	dirent
> 	going back past 4-th entry...
> 	seekdir (d, -1600443765); telldir (d) == -1
> [...]
> FAIL tst-cancel18 got 1 expected 0
> 	going to cancel in-time
> 	Timed out: killed the child process
> [...]
> FAIL tst-cancelx18 got 1 expected 0
> 	going to cancel in-time
> 	Timed out: killed the child process
> [...]
> FAIL tst-tls3 got 1 expected 0
> 
> 	/usr/lib/uclibc-ng-test/test/tls/tst-tls3: symbol 'baz': can't handle reloc type 0x404
> FAIL tst-tls4 got 1 expected 0
> 
> 	/usr/lib/uclibc-ng-test/test/tls/tst-tls4: symbol 'foo': can't handle reloc type 0x404
> FAIL tst-tls5 got 1 expected 0
> 
> 	/usr/lib/uclibc-ng-test/test/tls/tst-tls5: symbol 'foo': can't handle reloc type 0x404
> FAIL tst-tls6 got 1 expected 0
> 
> 	/usr/lib/uclibc-ng-test/test/tls/tst-tls6: symbol 'foo': can't handle reloc type 0x404
> FAIL tst-tls7 got 1 expected 0
> 
> 	/usr/lib/uclibc-ng-test/test/tls/tst-tls7: symbol 'foo': can't handle reloc type 0x404
> FAIL tst-tls8 got 1 expected 0
> 
> 	/usr/lib/uclibc-ng-test/test/tls/tst-tls8: symbol 'foo': can't handle reloc type 0x404
> [...]
> Total skipped: 15
> Total failed: 12
> Total passed: 454
> 
> 
> The tst-res Segmentation fault failure can be fixed by
> this additional uclibc patch:
> 
> --- a/include/resolv.h
> +++ b/include/resolv.h
> @@ -457,7 +457,7 @@ __END_DECLS
>  #    ifndef NOT_IN_libc
>  #     define __resp __libc_resp
>  #    endif
> -#    define _res (*__resp)
> +#    define _res (*__res_state())
>  extern __thread struct __res_state *__resp attribute_tls_model_ie;
>  #   endif
>  #  else
> 
> 
> Will take a look at some glibc resolv tests and try to port
> them (and, if I find enough time, at some of the other
> failures)...

Can you sent the two existing patches with your SoB Line added?

best regards
 Waldemar
Peter Seiderer Nov. 25, 2021, 8:26 p.m. UTC | #2
Hello Waldemar,

On Thu, 11 Nov 2021 09:58:07 +0100, Waldemar Brodkorb <wbx@openadk.org> wrote:

> Hi Peter,
> Peter Seiderer wrote,
>
> > Hello Waldemar,
> >
> > On Sun, 31 Oct 2021 00:56:56 +0200, Waldemar Brodkorb <wbx@openadk.org> wrote:
> >
> > > Hi Peter,
> > > Peter Seiderer wrote,
> > >
> > > > Hello Waldemar, *,
> > > >
> > > > On Mon, 25 Oct 2021 23:25:41 +0200, Peter Seiderer <ps.report@gmx.net> wrote:
> > > >
> > > > The resulting ntpd runs fine with the raspberrypi3_defconfig, but segfaults
> > > > when compiled/used with raspberrypi3_64_defconfig (uclibc, -Os):
> > > >
> > > > 	$ /usr/sbin/ntpd -n -d -g
> > > > 1970-01-01T00:04:18 ntpd[263]: INIT: ntpd ntpsec-1.2.0 2021-10-24T13:39:21Z: Starting
> > > > 1970-01-01T00:04:18 ntpd[263]: INIT: Command line: /usr/sbin/ntpd -n -d
> > > > 1970-01-01T00:04:18 ntpd[263]: INIT: precision = 7.291 usec (-17)
> > > > 1970-01-01T00:04:18 ntpd[263]: INIT: successfully locked into RAM
> > > > 1970-01-01T00:04:18 ntpd[263]: CONFIG: readconfig: parsing file: /etc/ntp.conf
> > > > 1970-01-01T00:04:18 ntpd[263]: CONFIG: restrict nopeer ignored
> > > > 1970-01-01T00:04:18 ntpd[263]: INIT: Using SO_TIMESTAMPNS
> > > > 1970-01-01T00:04:18 ntpd[263]: IO: Listen and drop on 0 v6wildcard [::]:123
> > > > 1970-01-01T00:04:18 ntpd[263]: IO: Listen and drop on 1 v4wildcard 0.0.0.0:123
> > > > 1970-01-01T00:04:18 ntpd[263]: IO: Listen normally on 2 lo 127.0.0.1:123
> > > > 1970-01-01T00:04:18 ntpd[263]: IO: Listen normally on 3 eth0 172.16.0.30:123
> > > > 1970-01-01T00:04:18 ntpd[263]: IO: Listen normally on 4 lo [::1]:123
> > > > 1970-01-01T00:04:18 ntpd[263]: IO: Listen normally on 5 eth0 [fe80::ba27:ebff:fea6:340%2]:123
> > > > 1970-01-01T00:04:18 ntpd[263]: IO: Listening on routing socket on fd #22 for interface updates
> > > > 1970-01-01T00:04:19 ntpd[263]: SYNC: Found 10 servers, suggest minsane at least 3
> > > > 1970-01-01T00:04:19 ntpd[263]: INIT: MRU 10922 entries, 13 hash bits, 65536 bytes
> > > > 1970-01-01T00:04:20 ntpd[263]: DNS: dns_probe: 0.pool.ntp.org, cast_flags:8, flags:101
> > > > Segmentation fault (core dumped)
> > >
> > > Could you add a small C test program to uClibc-ng-test to trigger
> > > the bug? That would help to find any regression to targets without
> > > TLS support.
> >
> > Did take a first look at the uClibc-ng-test regarding the problem,
> > there is already one test/inet/tst-res test...
> >
> >
> > For the raspberrypi3_defconfig case (uclibc unpatched):
> >
> > 	$ sh uclibcng-testrunner.sh
> > [...]
> > FAIL tst-ethers-line got 1 expected 0
> > 	Cannot open file /etc/ethers: No such file or directory
> > FAIL tst-ethers got 1 expected 0
> > 	Either /etc/ethers is missing or it has incorrect contents
> > [...]
> > FAIL tst-cancel18 got 1 expected 0
> > 	going to cancel in-time
> > 	Timed out: killed the child process
> > [...]
> > FAIL tst-cancelx18 got 1 expected 0
> > 	going to cancel in-time
> > 	Timed out: killed the child process
> > [...]
> > Total skipped: 15
> > Total failed: 4
> > Total passed: 460
> >
> >
> >
> > For the raspberrypi3_64_defconfig case (uclibc unpatched):
> >
> > 	$ sh uclibcng-testrunner.sh
> > [...]
> > FAIL tst-ethers-line got 1 expected 0
> > 	Cannot open file /etc/ethers: No such file or directory
> > FAIL tst-ethers got 1 expected 0
> > 	Either /etc/ethers is missing or it has incorrect contents
> > [...]
> > FAIL tst-res got 139 expected 0
> > 	Segmentation fault (core dumped)
> > [...]
> > FAIL tst-seekdir got 1 expected 0
> > 	.
> > 	..
> > 	tst-seekdir.out
> > 	tst-utmpx
> > 	tst-inotify
> > 	tst-mkostemps.out
> > 	seek.out
> > 	tst-scandir
> > 	tst-seekdir
> > 	tst-statvfs.out
> > 	sem
> > 	stdarg.out
> > 	fdopen.out
> > 	tst-utmp
> > 	tst-preadvwritev.out
> > 	bug-glob2.out
> > 	popen
> > 	dirent64.out
> > 	tst-scandir.out
> > 	tst-hasmntopt.out
> > 	tst-statvfs
> > 	bug-glob2
> > 	popen.out
> > 	Makefile
> > 	opendir-tst1
> > 	sem.out
> > 	tst-inotify.out
> > 	tst-syscall0
> > 	tst-statfs.out
> > 	bug-readdir1
> > 	dirent.out
> > 	tst-statfs
> > 	tst-syscall1.out
> > 	tst-syscall0.out
> > 	stdarg
> > 	tst-preadvwritev
> > 	tst-syscall6.out
> > 	tst-mkostemps
> > 	Makefile.in
> > 	tst-utmp.out
> > 	tst-nftw
> > 	opendir-tst1.out
> > 	tst-syscall1
> > 	bug-readdir1.out
> > 	tst-hasmntopt
> > 	tst-syscall6
> > 	fdopen
> > 	seek
> > 	tst-nftw.out
> > 	dirent64
> > 	tst-fnmatch.input
> > 	tst-utmpx.out
> > 	dirent
> > 	going back past 4-th entry...
> > 	seekdir (d, -1600443765); telldir (d) == -1
> > [...]
> > FAIL tst-cancel18 got 1 expected 0
> > 	going to cancel in-time
> > 	Timed out: killed the child process
> > [...]
> > FAIL tst-cancelx18 got 1 expected 0
> > 	going to cancel in-time
> > 	Timed out: killed the child process
> > [...]
> > FAIL tst-tls3 got 1 expected 0
> >
> > 	/usr/lib/uclibc-ng-test/test/tls/tst-tls3: symbol 'baz': can't handle reloc type 0x404
> > FAIL tst-tls4 got 1 expected 0
> >
> > 	/usr/lib/uclibc-ng-test/test/tls/tst-tls4: symbol 'foo': can't handle reloc type 0x404
> > FAIL tst-tls5 got 1 expected 0
> >
> > 	/usr/lib/uclibc-ng-test/test/tls/tst-tls5: symbol 'foo': can't handle reloc type 0x404
> > FAIL tst-tls6 got 1 expected 0
> >
> > 	/usr/lib/uclibc-ng-test/test/tls/tst-tls6: symbol 'foo': can't handle reloc type 0x404
> > FAIL tst-tls7 got 1 expected 0
> >
> > 	/usr/lib/uclibc-ng-test/test/tls/tst-tls7: symbol 'foo': can't handle reloc type 0x404
> > FAIL tst-tls8 got 1 expected 0
> >
> > 	/usr/lib/uclibc-ng-test/test/tls/tst-tls8: symbol 'foo': can't handle reloc type 0x404
> > [...]
> > Total skipped: 15
> > Total failed: 12
> > Total passed: 454
> >
> >
> > The tst-res Segmentation fault failure can be fixed by
> > this additional uclibc patch:
> >
> > --- a/include/resolv.h
> > +++ b/include/resolv.h
> > @@ -457,7 +457,7 @@ __END_DECLS
> >  #    ifndef NOT_IN_libc
> >  #     define __resp __libc_resp
> >  #    endif
> > -#    define _res (*__resp)
> > +#    define _res (*__res_state())
> >  extern __thread struct __res_state *__resp attribute_tls_model_ie;
> >  #   endif
> >  #  else
> >
> >
> > Will take a look at some glibc resolv tests and try to port
> > them (and, if I find enough time, at some of the other
> > failures)...
>
> Can you sent the two existing patches with your SoB Line added?

And finally done (sorry for the delay):

	https://patchwork.ozlabs.org/project/uclibc-ng/patch/20211125201825.22354-1-ps.report@gmx.net/

Regards,
Peter

>
> best regards
>  Waldemar
>
diff mbox series

Patch

--- a/include/resolv.h
+++ b/include/resolv.h
@@ -457,7 +457,7 @@  __END_DECLS
 #    ifndef NOT_IN_libc
 #     define __resp __libc_resp
 #    endif
-#    define _res (*__resp)
+#    define _res (*__res_state())
 extern __thread struct __res_state *__resp attribute_tls_model_ie;
 #   endif
 #  else