[openssl-dev] [openssl.org #4150] bug: Makefile.shared has race condition with SYMLINK_SO when building in parallel

Ryan Barnett via RT rt at openssl.org
Sat Nov 21 16:34:43 UTC 2015


The build-shared target depends on do_crypto and link-shared, which
will be executed in parallel. do_crypto calls link_a.linux_shared ->
link_a.gnu which does SYMLINK_SO; in parallel, link-shared calls
symlink.linux_shared which also does SYMLINK_SO. Before the symlink is
created, it is rm'ed, but there is a tiny chance that the second one
is created after the rm has been called. Even replacing the rm with an
ln -sf doesn't fix the operation since this isn't atomic operation.
The errors seen are such as:

  ln: failed to create symbolic link 'libssl.so': File exists
  ln: creating symbolic link `libcrypto.so': File exists

The depends need to be fixed up so that SYMLINK_SO isn't executed in
parallel but I'm not able to see an easy solution to this problem.

This was detected while utilizing Gentoo's parallel build patch [1]
within the Buildroot project [2]. This issue occurs when building
Openssl 1.0.2d for any Linux target that has shared library support.
See discussion on the Gentoo's bug tracking as well [3].

[1] - https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-libs/openssl/files/openssl-1.0.2d-parallel-build.patch
[2] - http://lists.busybox.net/pipermail/buildroot/2015-November/144686.html
[3 - https://bugs.gentoo.org/show_bug.cgi?id=566260

Thanks,
-Ryan

_______________________________________________
openssl-bugs-mod mailing list
openssl-bugs-mod at openssl.org
https://mta.openssl.org/mailman/listinfo/openssl-bugs-mod



More information about the openssl-dev mailing list