All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/libressl: needs MMU
@ 2017-07-23 20:08 Bernd Kuhls
  2017-07-24 16:07 ` Thomas Petazzoni
  0 siblings, 1 reply; 6+ messages in thread
From: Bernd Kuhls @ 2017-07-23 20:08 UTC (permalink / raw)
  To: buildroot

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,
-- 
2.11.0

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

* [Buildroot] [PATCH 1/1] package/libressl: needs MMU
  2017-07-23 20:08 [Buildroot] [PATCH 1/1] package/libressl: needs MMU Bernd Kuhls
@ 2017-07-24 16:07 ` Thomas Petazzoni
  2017-07-24 21:07   ` Waldemar Brodkorb
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Petazzoni @ 2017-07-24 16:07 UTC (permalink / raw)
  To: buildroot

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
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 1/1] package/libressl: needs MMU
  2017-07-24 16:07 ` Thomas Petazzoni
@ 2017-07-24 21:07   ` Waldemar Brodkorb
  2017-07-25  7:32     ` Thomas Petazzoni
  0 siblings, 1 reply; 6+ messages in thread
From: Waldemar Brodkorb @ 2017-07-24 21:07 UTC (permalink / raw)
  To: buildroot

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

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

* [Buildroot] [PATCH 1/1] package/libressl: needs MMU
  2017-07-24 21:07   ` Waldemar Brodkorb
@ 2017-07-25  7:32     ` Thomas Petazzoni
  2017-11-04 22:25       ` Arnout Vandecappelle
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Petazzoni @ 2017-07-25  7:32 UTC (permalink / raw)
  To: buildroot

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
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 1/1] package/libressl: needs MMU
  2017-07-25  7:32     ` Thomas Petazzoni
@ 2017-11-04 22:25       ` Arnout Vandecappelle
  2017-11-05 14:39         ` Thomas Petazzoni
  0 siblings, 1 reply; 6+ messages in thread
From: Arnout Vandecappelle @ 2017-11-04 22:25 UTC (permalink / raw)
  To: buildroot



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

-- 
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

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

* [Buildroot] [PATCH 1/1] package/libressl: needs MMU
  2017-11-04 22:25       ` Arnout Vandecappelle
@ 2017-11-05 14:39         ` Thomas Petazzoni
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2017-11-05 14:39 UTC (permalink / raw)
  To: buildroot

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
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

end of thread, other threads:[~2017-11-05 14:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-23 20:08 [Buildroot] [PATCH 1/1] package/libressl: needs MMU Bernd Kuhls
2017-07-24 16:07 ` Thomas Petazzoni
2017-07-24 21:07   ` Waldemar Brodkorb
2017-07-25  7:32     ` Thomas Petazzoni
2017-11-04 22:25       ` Arnout Vandecappelle
2017-11-05 14:39         ` Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.