From: Ranjitsinh Rathod <ranjitsinh.rat...@kpit.com>

Issues seen in boost asio call when used within shared libraries
particularly in aarch64.
The discussion with boost maintainers is on going at
github.com/chriskohlhoff/asio/issues/588 originally reported at
github.com/chriskohlhoff/asio/issues/642. The crash is quite frequent
with no solution in sight at present.
As a workaround this simple patch that checks the nullness of the
call stack seems to avoid the crash.

Typical Crash backtrace:
Thread 1 (LWP 907):
0  boost::asio::detail::scheduler::compensating_work_started 
(this=0x559e174230) at /usr/include/boost/asio/detail/impl/scheduler.ipp:321
1  
boost::asio::detail::epoll_reactor::perform_io_cleanup_on_block_exit::~perform_io_cleanup_on_block_exit
 (this=0x7f861ab348, __in_chrg=<optimized out>)
at /usr/include/boost/asio/detail/impl/epoll_reactor.ipp:712
2  boost::asio::detail::epoll_reactor::descriptor_state::perform_io 
(events=<optimized out>, this=0x7f800023d0) at
/usr/include/boost/asio/detail/impl/epoll_reactor.ipp:730
3  boost::asio::detail::epoll_reactor::descriptor_state::do_complete 
(owner=0x559e174230, base=0x7f800023d0, ec=..., bytes_transferred=<optimized 
out>)
at /usr/include/boost/asio/detail/impl/epoll_reactor.ipp:774
4  0x0000007f894a4398 in boost::asio::detail::scheduler_operation::complete 
(bytes_transferred=17, ec=..., owner=0x559e174230, this=0x7f800023d0)
at /usr/include/boost/asio/detail/scheduler_operation.hpp:40
5  boost::asio::detail::scheduler::do_run_one (ec=..., this_thread=..., 
lock=..., this=0x559e174230) at
/usr/include/boost/asio/detail/impl/scheduler.ipp:447
6  boost::asio::detail::scheduler::run (this=0x559e174230, ec=...) at 
/usr/include/boost/asio/detail/impl/scheduler.ipp:200
7  0x0000007f895e444c in boost::asio::io_context::run (this=0x559e174b70) at 
/usr/include/boost/asio/impl/io_context.ipp:63

Signed-off-by: Ranjitsinh Rathod <ranjitsinh.rat...@kpit.com>
Signed-off-by: Ranjitsinh Rathod <ranjitsinhrathod1...@gmail.com>
---
 ...L-check-for-the-pointer-which-causes.patch | 54 +++++++++++++++++++
 meta/recipes-support/boost/boost_1.72.0.bb    |  1 +
 2 files changed, 55 insertions(+)
 create mode 100644 
meta/recipes-support/boost/boost/0001-boost-Add-a-NULL-check-for-the-pointer-which-causes.patch

diff --git 
a/meta/recipes-support/boost/boost/0001-boost-Add-a-NULL-check-for-the-pointer-which-causes.patch
 
b/meta/recipes-support/boost/boost/0001-boost-Add-a-NULL-check-for-the-pointer-which-causes.patch
new file mode 100644
index 0000000000..5ffea59e29
--- /dev/null
+++ 
b/meta/recipes-support/boost/boost/0001-boost-Add-a-NULL-check-for-the-pointer-which-causes.patch
@@ -0,0 +1,54 @@
+From d5efa47962b0101d9ec305b38a1520e9c13f118e Mon Sep 17 00:00:00 2001
+From: Ranjitsinh Rathod <ranjitsinh.rat...@kpit.com>
+Date: Mon, 31 May 2021 14:40:12 +0100
+Subject: [PATCH] boost: Add a NULL check for the pointer which causes a crash
+
+Issues seen in boost asio call when used within shared libraries
+particularly in aarch64.
+The discussion with boost maintainers is on going at
+github.com/chriskohlhoff/asio/issues/588 originally reported at
+github.com/chriskohlhoff/asio/issues/642. The crash is quite frequent
+with no solution in sight at present.
+As a workaround this simple patch that checks the nullness of the
+call stack seems to avoid the crash.
+
+Typical Crash backtrace:
+Thread 1 (LWP 907):
+0  boost::asio::detail::scheduler::compensating_work_started 
(this=0x559e174230) at /usr/include/boost/asio/detail/impl/scheduler.ipp:321
+1  
boost::asio::detail::epoll_reactor::perform_io_cleanup_on_block_exit::~perform_io_cleanup_on_block_exit
 (this=0x7f861ab348, __in_chrg=<optimized out>)
+at /usr/include/boost/asio/detail/impl/epoll_reactor.ipp:712
+2  boost::asio::detail::epoll_reactor::descriptor_state::perform_io 
(events=<optimized out>, this=0x7f800023d0) at
+/usr/include/boost/asio/detail/impl/epoll_reactor.ipp:730
+3  boost::asio::detail::epoll_reactor::descriptor_state::do_complete 
(owner=0x559e174230, base=0x7f800023d0, ec=..., bytes_transferred=<optimized 
out>)
+at /usr/include/boost/asio/detail/impl/epoll_reactor.ipp:774
+4  0x0000007f894a4398 in boost::asio::detail::scheduler_operation::complete 
(bytes_transferred=17, ec=..., owner=0x559e174230, this=0x7f800023d0)
+at /usr/include/boost/asio/detail/scheduler_operation.hpp:40
+5  boost::asio::detail::scheduler::do_run_one (ec=..., this_thread=..., 
lock=..., this=0x559e174230) at
+/usr/include/boost/asio/detail/impl/scheduler.ipp:447
+6  boost::asio::detail::scheduler::run (this=0x559e174230, ec=...) at 
/usr/include/boost/asio/detail/impl/scheduler.ipp:200
+7  0x0000007f895e444c in boost::asio::io_context::run (this=0x559e174b70) at 
/usr/include/boost/asio/impl/io_context.ipp:63
+
+Upstream-Status: Submitted [https://github.com/chriskohlhoff/asio/pull/330]
+
+Signed-off-by: Mikko Rapeli <mikko.rap...@bmw.de>
+Signed-off-by: Ranjitsinh Rathod <ranjitsinh.rat...@kpit.com>
+
+---
+ boost/asio/detail/impl/scheduler.ipp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/boost/asio/detail/impl/scheduler.ipp 
b/boost/asio/detail/impl/scheduler.ipp
+index 4ef5c8668..02fc0d2e5 100644
+--- a/boost/asio/detail/impl/scheduler.ipp
++++ b/boost/asio/detail/impl/scheduler.ipp
+@@ -317,8 +317,8 @@ void scheduler::restart()
+ 
+ void scheduler::compensating_work_started()
+ {
+-  thread_info_base* this_thread = thread_call_stack::contains(this);
+-  ++static_cast<thread_info*>(this_thread)->private_outstanding_work;
++  if (thread_info_base* this_thread = thread_call_stack::contains(this))
++    ++static_cast<thread_info*>(this_thread)->private_outstanding_work;
+ }
+ 
+ void scheduler::post_immediate_completion(
diff --git a/meta/recipes-support/boost/boost_1.72.0.bb 
b/meta/recipes-support/boost/boost_1.72.0.bb
index df1cc16937..7fb8526b33 100644
--- a/meta/recipes-support/boost/boost_1.72.0.bb
+++ b/meta/recipes-support/boost/boost_1.72.0.bb
@@ -9,4 +9,5 @@ SRC_URI += " \
            file://0001-dont-setup-compiler-flags-m32-m64.patch \
            file://0001-revert-cease-dependence-on-range.patch \
            file://0001-added-typedef-executor_type.patch \
+           
file://0001-boost-Add-a-NULL-check-for-the-pointer-which-causes.patch \
            "
-- 
2.17.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#159821): 
https://lists.openembedded.org/g/openembedded-core/message/159821
Mute This Topic: https://lists.openembedded.org/mt/87787403/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to