Message ID | 20170723200844.13004-1-bernd.kuhls@t-online.de |
---|---|
State | Changes Requested |
Headers | show |
Hello, On Sun, 23 Jul 2017 22:08:44 +0200, Bernd Kuhls wrote: > Fixes > http://autobuild.buildroot.net/results/074/07429d3016c900894fa0ca19b7dad0a928e32e3f/ > http://autobuild.buildroot.net/results/1c1/1c1325d1a7a7aa98172d2d93d30322165af62348/ > > Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de> > --- > package/libressl/Config.in | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/package/libressl/Config.in b/package/libressl/Config.in > index 0a1c9e273..d13b2068c 100644 > --- a/package/libressl/Config.in > +++ b/package/libressl/Config.in > @@ -1,6 +1,7 @@ > config BR2_PACKAGE_LIBRESSL > bool "libressl" > depends on !BR2_PACKAGE_OPENSSL > + depends on BR2_USE_MMU # fork() > help > LibreSSL is a version of the TLS/crypto stack forked from > OpenSSL in 2014, with goals of modernizing the codebase, On this one, I'd like to have the feedback from Waldemar. Indeed, libressl is not using fork(), but __register_atfork(), which uClibc does not implement, and I've not found why it doesn't exist for noMMU platforms. In addition, libressl interestingly has a special case for __GLIBC__ (which gets used for uclibc, because uclibc defines __GLIBC__): #ifdef __GLIBC__ extern void *__dso_handle; extern int __register_atfork(void (*)(void), void(*)(void), void (*)(void), void *); #define _ARC4_ATFORK(f) __register_atfork(NULL, NULL, (f), __dso_handle) #else #define _ARC4_ATFORK(f) pthread_atfork(NULL, NULL, (f)) #endif Waldemar, what do you think ? Best regards, Thomas
Hi, Thomas Petazzoni wrote, > Hello, > > On Sun, 23 Jul 2017 22:08:44 +0200, Bernd Kuhls wrote: > > Fixes > > http://autobuild.buildroot.net/results/074/07429d3016c900894fa0ca19b7dad0a928e32e3f/ > > http://autobuild.buildroot.net/results/1c1/1c1325d1a7a7aa98172d2d93d30322165af62348/ > > > > Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de> > > --- > > package/libressl/Config.in | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/package/libressl/Config.in b/package/libressl/Config.in > > index 0a1c9e273..d13b2068c 100644 > > --- a/package/libressl/Config.in > > +++ b/package/libressl/Config.in > > @@ -1,6 +1,7 @@ > > config BR2_PACKAGE_LIBRESSL > > bool "libressl" > > depends on !BR2_PACKAGE_OPENSSL > > + depends on BR2_USE_MMU # fork() > > help > > LibreSSL is a version of the TLS/crypto stack forked from > > OpenSSL in 2014, with goals of modernizing the codebase, > > On this one, I'd like to have the feedback from Waldemar. Indeed, > libressl is not using fork(), but __register_atfork(), which uClibc > does not implement, and I've not found why it doesn't exist for noMMU > platforms. From the comment in the header: "Register handlers to execute before and after `fork'" As this is a feature only available when fork() is there, this isn't available for noMMU platforms. So pthread_fork() is available as described in POSIX here: http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_atfork.html I think we no longer define pthread_atfork for noMMU architectures since Romain reported an issue with Xenomai and Blackfin some time ago. It was then fixed on both sides: https://git.xenomai.org/xenomai-2.6.git/commit/?id=917dcebb26ec492f276cdc3b55867aa90e01fa12 https://cgit.openadk.org/cgi/cgit/uclibc-ng.git/commit/libpthread/linuxthreads?id=79c4017f3518cd30afb59a170717c1e754eedadf Xenomai uses a dummy for pthread_fork: https://git.xenomai.org/xenomai-2.6.git/tree/include/asm-blackfin/syscall.h#n137 __register_atfork() seems a LSB extension to allow to unregister functions when a shared object is unloaded. See: http://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/baselib--register-atfork.html As uClibc inherits NPTL from glibc, it is available for all architectures supporting NPTL. Checked with ARM cross-compilation. > In addition, libressl interestingly has a special case for __GLIBC__ > (which gets used for uclibc, because uclibc defines __GLIBC__): > > #ifdef __GLIBC__ > extern void *__dso_handle; > extern int __register_atfork(void (*)(void), void(*)(void), void (*)(void), void *); > #define _ARC4_ATFORK(f) __register_atfork(NULL, NULL, (f), __dso_handle) > #else > #define _ARC4_ATFORK(f) pthread_atfork(NULL, NULL, (f)) > #endif > > Waldemar, what do you think ? It was added in this commit: https://github.com/libressl-portable/portable/commit/32d9eeeecf4e951e1566d5f4a42b36ea37b60f35 But I think the commit log isn't correct, as pthread_atfork can be used for glibc, musl and uClibc-ng. (for glibc -lpthread must be added) One possible solution might be, to check for __register_atfork, if it does not exist, fallback to pthread_atfork, if it does not exist provide a pthread_atfork dummy (noMMU case). Another solution would be to enhance uClibc-ng included arc4random.c and sync with OpenBSD code and use that instead of the compat code included in libressl. best regards Waldemar
Hello, On Mon, 24 Jul 2017 23:07:03 +0200, Waldemar Brodkorb wrote: > > On this one, I'd like to have the feedback from Waldemar. Indeed, > > libressl is not using fork(), but __register_atfork(), which uClibc > > does not implement, and I've not found why it doesn't exist for noMMU > > platforms. > > From the comment in the header: > "Register handlers to execute before and after `fork'" > > As this is a feature only available when fork() is there, this isn't > available for noMMU platforms. Well, there could have been a dummy __register_atfork(), which does nothing on noMMU. Indeed, you can imagine a library registering a callback using __register_atfork(), but not using itself the fork() system call. Such a library would be OK for a noMMU platform. > It was added in this commit: > https://github.com/libressl-portable/portable/commit/32d9eeeecf4e951e1566d5f4a42b36ea37b60f35 > > But I think the commit log isn't correct, as pthread_atfork can be > used for glibc, musl and uClibc-ng. (for glibc -lpthread must be > added) > > One possible solution might be, to check for __register_atfork, if > it does not exist, fallback to pthread_atfork, if it does not exist > provide a pthread_atfork dummy (noMMU case). This should be doable without too much effort I believe. Best regards, Thomas
On 25-07-17 09:32, Thomas Petazzoni wrote: > Hello, > > On Mon, 24 Jul 2017 23:07:03 +0200, Waldemar Brodkorb wrote: > >>> On this one, I'd like to have the feedback from Waldemar. Indeed, >>> libressl is not using fork(), but __register_atfork(), which uClibc >>> does not implement, and I've not found why it doesn't exist for noMMU >>> platforms. >> >> From the comment in the header: >> "Register handlers to execute before and after `fork'" >> >> As this is a feature only available when fork() is there, this isn't >> available for noMMU platforms. > > Well, there could have been a dummy __register_atfork(), which does > nothing on noMMU. Indeed, you can imagine a library registering a > callback using __register_atfork(), but not using itself the fork() > system call. Such a library would be OK for a noMMU platform. > >> It was added in this commit: >> https://github.com/libressl-portable/portable/commit/32d9eeeecf4e951e1566d5f4a42b36ea37b60f35 >> >> But I think the commit log isn't correct, as pthread_atfork can be >> used for glibc, musl and uClibc-ng. (for glibc -lpthread must be >> added) >> >> One possible solution might be, to check for __register_atfork, if >> it does not exist, fallback to pthread_atfork, if it does not exist >> provide a pthread_atfork dummy (noMMU case). > > This should be doable without too much effort I believe. But someone has to do it :-) Note that the autobuilders no longer complain about this since libressl is now a choice, so it never gets built. But the problem still persists. Anyway, the patch no longer applies as-is, so I've marked as Changes Requested. Regards, Arnout
Hello, On Sat, 4 Nov 2017 23:25:57 +0100, Arnout Vandecappelle wrote: > >> But I think the commit log isn't correct, as pthread_atfork can be > >> used for glibc, musl and uClibc-ng. (for glibc -lpthread must be > >> added) > >> > >> One possible solution might be, to check for __register_atfork, if > >> it does not exist, fallback to pthread_atfork, if it does not exist > >> provide a pthread_atfork dummy (noMMU case). > > > > This should be doable without too much effort I believe. > > But someone has to do it :-) > > Note that the autobuilders no longer complain about this since libressl is now > a choice, so it never gets built. But the problem still persists. We discussed it during the Developers Meeting (remember?) and I have in my notes to mark it as not available on noMMU platforms that use uClibc (because it's really a uClibc limitation). Thomas
diff --git a/package/libressl/Config.in b/package/libressl/Config.in index 0a1c9e273..d13b2068c 100644 --- a/package/libressl/Config.in +++ b/package/libressl/Config.in @@ -1,6 +1,7 @@ config BR2_PACKAGE_LIBRESSL bool "libressl" depends on !BR2_PACKAGE_OPENSSL + depends on BR2_USE_MMU # fork() help LibreSSL is a version of the TLS/crypto stack forked from OpenSSL in 2014, with goals of modernizing the codebase,
Fixes http://autobuild.buildroot.net/results/074/07429d3016c900894fa0ca19b7dad0a928e32e3f/ http://autobuild.buildroot.net/results/1c1/1c1325d1a7a7aa98172d2d93d30322165af62348/ Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de> --- package/libressl/Config.in | 1 + 1 file changed, 1 insertion(+)