package/libressl: needs MMU
PATCH 1/1 package/libressl: needs MMU
Fixes
http://autobuild.buildroot.net/results/074/07429d3016c900894fa0ca19b7dad0a928e32e3f/
http://autobuild.buildroot.net/results/1c1/1c1325d1a7a7aa98172d2d93d30322165af62348/
--- package/libressl/Config.in | 1 + 1 file changed, 1 insertion(+)
package/libressl/Config.in +1 -0
@@ -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,
Signature · 1 line
2.11.0
PATCH 1/1 package/libressl: needs MMU
Hello,
Quoted 14 lines · Bernd Kuhls
Fixes
http://autobuild.buildroot.net/results/074/07429d3016c900894fa0ca19b7dad0a928e32e3f/
http://autobuild.buildroot.net/results/1c1/1c1325d1a7a7aa98172d2d93d30322165af62348/Signed-off-by Bernd Kuhls <[email protected]>--- package/libressl/Config.in | 1 + 1 file changed, 1 insertion(+)package/libressl/Config.in +0
-0
package/libressl/Config.in line 7
Quoted 7 lines
package/libressl/Config.in +1
-0@@ -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
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 1/1 package/libressl: needs MMU
Hi,
Thomas Petazzoni wrote,
Quoted 21 lines
Hello,
Quoted 18 lines · Bernd Kuhls
Fixes
http://autobuild.buildroot.net/results/074/07429d3016c900894fa0ca19b7dad0a928e32e3f/
http://autobuild.buildroot.net/results/1c1/1c1325d1a7a7aa98172d2d93d30322165af62348/Signed-off-by Bernd Kuhls <[email protected]>--- package/libressl/Config.in | 1 + 1 file changed, 1 insertion(+)package/libressl/Config.in +1
-0@@ -1,6 +1,7 @@ config BR2_PACKAGE_LIBRESSL bool "libressl" depends on !BR2_PACKAGE_OPENSSL + depends on BR2_USE_MMU # fork()
Quoted 8 lines
package/libressl/Config.in line 7
Quoted 3 lines
package/libressl/Config.in +0
-0help 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.
Quoted 11 lines
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
Quoted 1 line
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
PATCH 1/1 package/libressl: needs MMU
Hello,
Quoted 10 lines · Waldemar Brodkorb
Quoted 4 lines
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.
Quoted 10 lines
It was added in this commit:
https://github.com/libressl-portable/portable/commit/32d9eeeecf4e951e1566d5f4a42b36ea37b60f35But I think the commit log isn't correct, as
pthread_atforkcan 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 topthread_atfork, if it does not exist provide apthread_atforkdummy (noMMU case).
This should be doable without too much effort I believe.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 1/1 package/libressl: needs MMU
Quoted 27 lines · Thomas Petazzoni
Hello,
Quoted 10 lines · Waldemar Brodkorb
Quoted 4 lines
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 thefork()system call. Such a library would be OK for a noMMU platform.Quoted 7 lines
It was added in this commit:
https://github.com/libressl-portable/portable/commit/32d9eeeecf4e951e1566d5f4a42b36ea37b60f35But I think the commit log isn't correct, as
pthread_atforkcan be used for glibc, musl and uClibc-ng. (for glibc -lpthread must be added)
Quoted 5 lines
Quoted 3 lines
One possible solution might be, to check for
__register_atfork, if it does not exist, fallback topthread_atfork, if it does not exist provide apthread_atforkdummy (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
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 1/1 package/libressl: needs MMU
Hello,
Quoted 8 lines · Arnout Vandecappelle
Quoted 8 lines
Quoted 7 lines
But I think the commit log isn't correct, as
pthread_atforkcan 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 topthread_atfork, if it does not exist provide apthread_atforkdummy (noMMU case).
Quoted 6 lines
Quoted 1 line
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
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com