Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2 01/14] package/boost: fix asio.hpp compile errors with gcc >= 15
@ 2026-10-27 16:39 Adam Duskett
  2026-10-27 16:39 ` [Buildroot] [PATCH v2 02/14] package/mender-connect: bump to version 3.1.0 Adam Duskett
                   ` (13 more replies)
  0 siblings, 14 replies; 29+ messages in thread
From: Adam Duskett @ 2026-10-27 16:39 UTC (permalink / raw)
  To: buildroot; +Cc: Adam Duskett, Angelo Compagnucci

This commit unintentionally fixed a compile error when programs
include the asio.hpp header with gcc versions >= 15.

```
In function ‘void* memcpy(void*, const void*, size_t)’,

inlined from ‘static boost::asio::ip::basic_resolver_results<InternetProtocol>
    boost::asio::ip::basic_resolver_results<InternetProtocol>::create(boost::asio::detail::addrinfo_type*,
    const std::string&, const std::string&) [with InternetProtocol = boost::asio::ip::tcp]’
    at /usr/include/boost/asio/ip/basic_resolver_results.hpp:147:15:

/usr/include/bits/string_fortified.h:29:33:
    error: ‘void* __builtin___memcpy_chk(void*, const void*, unsigned int, unsigned int)’
    forming offset [28, 128] is out of the bounds [0, 28] of object ‘endpoint’ with type
    ‘boost::asio::ip::tcp::endpoint’ {aka ‘boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>’}
    [-Werror=array-bounds=]
```

Backport URL: https://github.com/boostorg/asio/commit/b2478a9ba9ed76d7c858419e3f677cc454591d45

Fixes: None reported
Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
---
 ...002-remove-FORTIFY_SOURCE-workaround.patch | 75 +++++++++++++++++++
 1 file changed, 75 insertions(+)
 create mode 100644 package/boost/0002-remove-FORTIFY_SOURCE-workaround.patch

diff --git a/package/boost/0002-remove-FORTIFY_SOURCE-workaround.patch b/package/boost/0002-remove-FORTIFY_SOURCE-workaround.patch
new file mode 100644
index 0000000000..d044b62676
--- /dev/null
+++ b/package/boost/0002-remove-FORTIFY_SOURCE-workaround.patch
@@ -0,0 +1,75 @@
+From b3d87da5f87e2907ed004edf1c72ad3942ff1165 Mon Sep 17 00:00:00 2001
+From: Christopher Kohlhoff <chris@kohlhoff.com>
+Date: Wed, 5 Aug 2026 16:07:19 +0200
+Subject: [PATCH] Remove _FORTIFY_SOURCE workaround.
+
+This commit unintentionally fixed a compile error when programs
+include the asio.hpp header with gcc versions >= 15.
+
+```
+In function ‘void* memcpy(void*, const void*, size_t)’,
+
+inlined from ‘static boost::asio::ip::basic_resolver_results<InternetProtocol>
+    boost::asio::ip::basic_resolver_results<InternetProtocol>::create(boost::asio::detail::addrinfo_type*,
+    const std::string&, const std::string&) [with InternetProtocol = boost::asio::ip::tcp]’
+    at /usr/include/boost/asio/ip/basic_resolver_results.hpp:147:15:
+
+/usr/include/bits/string_fortified.h:29:33:
+    error: ‘void* __builtin___memcpy_chk(void*, const void*, unsigned int, unsigned int)’
+    forming offset [28, 128] is out of the bounds [0, 28] of object ‘endpoint’ with type
+    ‘boost::asio::ip::tcp::endpoint’ {aka ‘boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>’}
+    [-Werror=array-bounds=]
+```
+
+
+Original patch commit message:
+```
+The previous workaround for _FORTIFY_SOURCE warnings increased the size
+of all IP endpoint objects. Instead, try fixing the warning at the point
+where it occurs, by limiting the length memcpy-ed while processing the
+addrinfo results from getaddrinfo.
+```
+
+Upstream: Backport [https://github.com/boostorg/asio/commit/b2478a9ba9ed76d7c858419e3f677cc454591d45]
+Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
+Signed-off-by: Christopher Kohlhoff <chris@kohlhoff.com>
+---
+ boost/asio/ip/basic_resolver_results.hpp | 22 ++++++++++++++--------
+ 1 file changed, 14 insertions(+), 8 deletions(-)
+
+diff --git a/boost/asio/ip/basic_resolver_results.hpp b/boost/asio/ip/basic_resolver_results.hpp
+index 0127473e2..87fa3fadf 100644
+--- a/boost/asio/ip/basic_resolver_results.hpp
++++ b/boost/asio/ip/basic_resolver_results.hpp
+@@ -141,14 +141,20 @@ public:
+       if (address_info->ai_family == BOOST_ASIO_OS_DEF(AF_INET)
+           || address_info->ai_family == BOOST_ASIO_OS_DEF(AF_INET6))
+       {
+-        using namespace std; // For memcpy.
+-        typename InternetProtocol::endpoint endpoint;
+-        endpoint.resize(static_cast<std::size_t>(address_info->ai_addrlen));
+-        memcpy(endpoint.data(), address_info->ai_addr,
+-            address_info->ai_addrlen);
+-        results.values_->push_back(
+-            basic_resolver_entry<InternetProtocol>(endpoint,
+-              actual_host_name, service_name));
++        const std::size_t expected_size =
++          address_info->ai_family == BOOST_ASIO_OS_DEF(AF_INET)
++            ? sizeof(boost::asio::detail::sockaddr_in4_type)
++            : sizeof(boost::asio::detail::sockaddr_in6_type);
++        if (address_info->ai_addrlen >= expected_size)
++        {
++          using namespace std; // For memcpy.
++          typename InternetProtocol::endpoint endpoint;
++          endpoint.resize(expected_size);
++          memcpy(endpoint.data(), address_info->ai_addr, expected_size);
++          results.values_->push_back(
++              basic_resolver_entry<InternetProtocol>(endpoint,
++                actual_host_name, service_name));
++        }
+       }
+       address_info = address_info->ai_next;
+     }
+-- 
+2.55.0
+
-- 
2.56.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2026-10-27 21:00 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-27 16:39 [Buildroot] [PATCH v2 01/14] package/boost: fix asio.hpp compile errors with gcc >= 15 Adam Duskett
2026-10-27 16:39 ` [Buildroot] [PATCH v2 02/14] package/mender-connect: bump to version 3.1.0 Adam Duskett
2026-10-27 19:45   ` Thomas Petazzoni via buildroot
2026-10-27 16:40 ` [Buildroot] [PATCH v2 03/14] package/mender-artifact: bump version to 4.4.2 Adam Duskett
2026-10-27 19:54   ` Thomas Petazzoni via buildroot
2026-10-27 16:40 ` [Buildroot] [PATCH v2 04/14] package/mender-grubenv: bump to version 32e10c0b Adam Duskett
2026-10-27 19:55   ` Thomas Petazzoni via buildroot
2026-10-27 16:40 ` [Buildroot] [PATCH v2 05/14] package/mender-update-modules: bump to version 3745bbea3 Adam Duskett
2026-10-27 19:56   ` Thomas Petazzoni via buildroot
2026-10-27 16:40 ` [Buildroot] [PATCH v2 06/14] package/mender-update-modules: add banner module Adam Duskett
2026-10-27 19:58   ` Thomas Petazzoni via buildroot
2026-10-27 16:40 ` [Buildroot] [PATCH v2 07/14] package/mender-update-modules: add persistent-app module Adam Duskett
2026-10-27 20:00   ` Thomas Petazzoni via buildroot
2026-10-27 16:40 ` [Buildroot] [PATCH v2 08/14] configs/mender_x86_64_efi_defconfig: bump kernel version to 6.18.59 Adam Duskett
2026-10-27 20:00   ` Thomas Petazzoni via buildroot
2026-10-27 16:40 ` [Buildroot] [PATCH v2 09/14] board/mender: change device type to compatible-types Adam Duskett
2026-10-27 20:03   ` Thomas Petazzoni via buildroot
2026-10-27 16:40 ` [Buildroot] [PATCH v2 10/14] board/mender/x86_64/post-image-efi.sh: do not prepend artifact name to mender image Adam Duskett
2026-10-27 20:15   ` Thomas Petazzoni via buildroot
2026-10-27 20:46   ` Thomas Petazzoni via buildroot
2026-10-27 16:40 ` [Buildroot] [PATCH v2 11/14] board/mender/x86_64: add a udev rule to create /dev/root Adam Duskett
2026-10-27 20:44   ` Thomas Petazzoni via buildroot
2026-10-27 16:40 ` [Buildroot] [PATCH v2 12/14] test_mender/post-build.sh: add rootfs image checksum for bootstrap artifact Adam Duskett
2026-10-27 20:45   ` Thomas Petazzoni via buildroot
2026-10-27 16:40 ` [Buildroot] [PATCH v2 13/14] test_mender/post-build.sh: use /etc/mender/device_type Adam Duskett
2026-10-27 20:47   ` Thomas Petazzoni via buildroot
2026-10-27 16:40 ` [Buildroot] [PATCH v2 14/14] package/mender: bump to version 5.2.0 Adam Duskett
2026-10-27 20:59   ` Thomas Petazzoni via buildroot
2026-10-27 19:07 ` [Buildroot] [PATCH v2 01/14] package/boost: fix asio.hpp compile errors with gcc >= 15 Thomas Petazzoni via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox