Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from buildroot:master #335

Merged
merged 13 commits into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion board/cubietech/cubieboard1/patches/linux/linux.hash
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Locally calculated
sha256 39207fce1ce42838e085261bae0af5ce4a0843aa777cfc0f5c49bc7729602bcd linux-6.12.5.tar.xz
sha256 9423f4bfb4d875417e39cb0b017b5499fea47da56119f0cd28a201735d898f14 linux-6.12.14.tar.xz
2 changes: 1 addition & 1 deletion board/cubietech/cubieboard1/patches/uboot/uboot.hash
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Locally calculated
sha256 b28daf4ac17e43156363078bf510297584137f6df50fced9b12df34f61a92fb0 u-boot-2024.10.tar.bz2
sha256 cdef7d507c93f1bbd9f015ea9bc21fa074268481405501945abc6f854d5b686f u-boot-2025.01.tar.bz2
2 changes: 1 addition & 1 deletion board/cubietech/cubieboard2/patches/linux/linux.hash
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Locally calculated
sha256 39207fce1ce42838e085261bae0af5ce4a0843aa777cfc0f5c49bc7729602bcd linux-6.12.5.tar.xz
sha256 9423f4bfb4d875417e39cb0b017b5499fea47da56119f0cd28a201735d898f14 linux-6.12.14.tar.xz
2 changes: 1 addition & 1 deletion board/cubietech/cubieboard2/patches/uboot/uboot.hash
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Locally calculated
sha256 b28daf4ac17e43156363078bf510297584137f6df50fced9b12df34f61a92fb0 u-boot-2024.10.tar.bz2
sha256 cdef7d507c93f1bbd9f015ea9bc21fa074268481405501945abc6f854d5b686f u-boot-2025.01.tar.bz2
2 changes: 1 addition & 1 deletion boot/xilinx-embeddedsw/Config.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
config BR2_TARGET_XILINX_EMBEDDEDSW
bool "xilinx-embeddedsw"
depends on BR2_aarch64
depends on BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH = "microblazeel-xilinx-elf"
depends on BR2_TOOLCHAIN_BARE_METAL_BUILDROOT
help
Build boot firmware applications from source for Xilinx
boards. Users can mix and match applications to be built
Expand Down
4 changes: 2 additions & 2 deletions configs/cubieboard1_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/cubietech/cubieboard1/genimage.cfg"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.5"
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.14"
BR2_LINUX_KERNEL_DEFCONFIG="sunxi"
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="allwinner/sun4i-a10-cubieboard"
Expand All @@ -18,7 +18,7 @@ BR2_TARGET_ROOTFS_EXT2_4=y
BR2_TARGET_UBOOT=y
BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
BR2_TARGET_UBOOT_CUSTOM_VERSION=y
BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2024.10"
BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2025.01"
BR2_TARGET_UBOOT_BOARD_DEFCONFIG="Cubieboard"
BR2_TARGET_UBOOT_NEEDS_DTC=y
BR2_TARGET_UBOOT_NEEDS_PYLIBFDT=y
Expand Down
4 changes: 2 additions & 2 deletions configs/cubieboard2_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/cubietech/cubieboard2/genimage.cfg"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.5"
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.14"
BR2_LINUX_KERNEL_DEFCONFIG="multi_v7"
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="allwinner/sun7i-a20-cubieboard2"
Expand All @@ -19,7 +19,7 @@ BR2_TARGET_ROOTFS_EXT2_4=y
BR2_TARGET_UBOOT=y
BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
BR2_TARGET_UBOOT_CUSTOM_VERSION=y
BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2024.10"
BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2025.01"
BR2_TARGET_UBOOT_BOARD_DEFCONFIG="Cubieboard2"
BR2_TARGET_UBOOT_NEEDS_DTC=y
BR2_TARGET_UBOOT_NEEDS_PYLIBFDT=y
Expand Down
139 changes: 139 additions & 0 deletions package/assimp/0001-Fix-leak-5762.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
From 4024726eca89331503bdab33d0b9186e901bbc45 Mon Sep 17 00:00:00 2001
From: Kim Kulling <kimkulling@users.noreply.github.com>
Date: Sat, 7 Sep 2024 21:02:34 +0200
Subject: [PATCH] Fix leak (#5762)

* Fix leak

* Update utLogger.cpp

Upstream: https://github.com/assimp/assimp/commit/4024726eca89331503bdab33d0b9186e901bbc45
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
---
code/Common/Assimp.cpp | 13 ++++++---
fuzz/assimp_fuzzer.cc | 2 +-
test/CMakeLists.txt | 1 +
test/unit/Common/utLogger.cpp | 52 +++++++++++++++++++++++++++++++++++
4 files changed, 63 insertions(+), 5 deletions(-)
create mode 100644 test/unit/Common/utLogger.cpp

diff --git a/code/Common/Assimp.cpp b/code/Common/Assimp.cpp
index ef3ee7b5d..91896e405 100644
--- a/code/Common/Assimp.cpp
+++ b/code/Common/Assimp.cpp
@@ -359,20 +359,25 @@ void CallbackToLogRedirector(const char *msg, char *dt) {
s->write(msg);
}

+static LogStream *DefaultStream = nullptr;
+
// ------------------------------------------------------------------------------------------------
ASSIMP_API aiLogStream aiGetPredefinedLogStream(aiDefaultLogStream pStream, const char *file) {
aiLogStream sout;

ASSIMP_BEGIN_EXCEPTION_REGION();
- LogStream *stream = LogStream::createDefaultStream(pStream, file);
- if (!stream) {
+ if (DefaultStream == nullptr) {
+ DefaultStream = LogStream::createDefaultStream(pStream, file);
+ }
+
+ if (!DefaultStream) {
sout.callback = nullptr;
sout.user = nullptr;
} else {
sout.callback = &CallbackToLogRedirector;
- sout.user = (char *)stream;
+ sout.user = (char *)DefaultStream;
}
- gPredefinedStreams.push_back(stream);
+ gPredefinedStreams.push_back(DefaultStream);
ASSIMP_END_EXCEPTION_REGION(aiLogStream);
return sout;
}
diff --git a/fuzz/assimp_fuzzer.cc b/fuzz/assimp_fuzzer.cc
index 8178674e8..91ffd9d69 100644
--- a/fuzz/assimp_fuzzer.cc
+++ b/fuzz/assimp_fuzzer.cc
@@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using namespace Assimp;

extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t dataSize) {
- aiLogStream stream = aiGetPredefinedLogStream(aiDefaultLogStream_STDOUT,NULL);
+ aiLogStream stream = aiGetPredefinedLogStream(aiDefaultLogStream_STDOUT, nullptr);
aiAttachLogStream(&stream);

Importer importer;
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 7b7fd850a..1a45adac7 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -100,6 +100,7 @@ SET( COMMON
unit/Common/utBase64.cpp
unit/Common/utHash.cpp
unit/Common/utBaseProcess.cpp
+ unit/Common/utLogger.cpp
)

SET(Geometry
diff --git a/test/unit/Common/utLogger.cpp b/test/unit/Common/utLogger.cpp
new file mode 100644
index 000000000..932240a7f
--- /dev/null
+++ b/test/unit/Common/utLogger.cpp
@@ -0,0 +1,52 @@
+/*
+---------------------------------------------------------------------------
+Open Asset Import Library (assimp)
+---------------------------------------------------------------------------
+
+Copyright (c) 2006-2024, assimp team
+
+All rights reserved.
+
+Redistribution and use of this software in source and binary forms,
+with or without modification, are permitted provided that the following
+conditions are met:
+
+* Redistributions of source code must retain the above
+copyright notice, this list of conditions and the
+following disclaimer.
+
+* Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the
+following disclaimer in the documentation and/or other
+materials provided with the distribution.
+
+* Neither the name of the assimp team, nor the names of its
+contributors may be used to endorse or promote products
+derived from this software without specific prior
+written permission of the assimp team.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+---------------------------------------------------------------------------
+*/
+
+#include "UnitTestPCH.h"
+#include <assimp/Importer.hpp>
+
+using namespace Assimp;
+class utLogger : public ::testing::Test {};
+
+TEST_F(utLogger, aiGetPredefinedLogStream_leak_test) {
+ aiLogStream stream1 = aiGetPredefinedLogStream(aiDefaultLogStream_STDOUT, nullptr);
+ aiLogStream stream2 = aiGetPredefinedLogStream(aiDefaultLogStream_STDOUT, nullptr);
+ ASSERT_EQ(stream1.callback, stream2.callback);
+}
--
2.39.5

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
From f12e52198669239af525e525ebb68407977f8e34 Mon Sep 17 00:00:00 2001
From: tyler92 <tyler92@inbox.ru>
Date: Wed, 11 Dec 2024 12:17:14 +0200
Subject: [PATCH] Fix use after free in the CallbackToLogRedirector (#5918)

The heap-use-after-free vulnerability occurs in the
CallbackToLogRedirector function. During the process of logging,
a previously freed memory region is accessed, leading to a
use-after-free condition. This vulnerability stems from incorrect
memory management, specifically, freeing a log stream and then
attempting to access it later on.

This patch sets NULL value for The DefaultStream global pointer.

Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
Upstream: https://github.com/assimp/assimp/commit/f12e52198669239af525e525ebb68407977f8e34
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
---
code/Common/Assimp.cpp | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/code/Common/Assimp.cpp b/code/Common/Assimp.cpp
index 91896e405..22e16bd36 100644
--- a/code/Common/Assimp.cpp
+++ b/code/Common/Assimp.cpp
@@ -416,6 +416,10 @@ ASSIMP_API aiReturn aiDetachLogStream(const aiLogStream *stream) {
DefaultLogger::get()->detachStream(it->second);
delete it->second;

+ if ((Assimp::LogStream *)stream->user == DefaultStream) {
+ DefaultStream = nullptr;
+ }
+
gActiveLogStreams.erase(it);

if (gActiveLogStreams.empty()) {
--
2.39.5

4 changes: 4 additions & 0 deletions package/assimp/assimp.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ ASSIMP_CPE_ID_VENDOR = assimp
ASSIMP_DEPENDENCIES = zlib
ASSIMP_INSTALL_STAGING = YES

# 0001-Fix-leak-5762.patch
# 0002-Fix-use-after-free-in-the-CallbackToLogRedirector-59.patch
ASSIMP_IGNORE_CVES += CVE-2024-48423

# relocation truncated to fit: R_68K_GOT16O. We also need to disable
# optimizations to not run into "Error: value -43420 out of range"
# assembler issues.
Expand Down
36 changes: 34 additions & 2 deletions package/binutils-bare-metal/binutils-bare-metal.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,45 @@ HOST_BINUTILS_BARE_METAL_MAKE_OPTS += MAKEINFO=true
HOST_BINUTILS_BARE_METAL_INSTALL_OPTS += MAKEINFO=true install

HOST_BINUTILS_BARE_METAL_CONF_OPTS = \
--target=$(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE) \
--prefix=$(HOST_DIR) \
--sysconfdir=$(HOST_DIR)/etc \
--localstatedir=$(HOST_DIR)/var \
$(if $$($$(PKG)_OVERRIDE_SRCDIR),,--disable-dependency-tracking) \
$(QUIET) \
--disable-gprof \
--disable-shared \
--enable-lto \
--enable-static \
--disable-initfini-array \
--disable-multilib \
--disable-werror

define HOST_BINUTILS_BARE_METAL_CONFIGURE_CMDS
$(foreach arch_tuple, $(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE), \
mkdir -p $(@D)/build-$(arch_tuple) && \
cd $(@D)/build-$(arch_tuple) && \
$(HOST_CONFIGURE_OPTS) \
$(HOST_BINUTILS_BARE_METAL_CONF_ENV) \
CONFIG_SITE=/dev/null \
$(@D)/configure \
$(HOST_BINUTILS_BARE_METAL_CONF_OPTS) \
--target=$(arch_tuple)
)
endef

define HOST_BINUTILS_BARE_METAL_BUILD_CMDS
$(foreach arch_tuple, $(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE), \
$(HOST_MAKE_ENV) $(MAKE) \
$(HOST_BINUTILS_BARE_METAL_MAKE_OPTS) \
-C $(@D)/build-$(arch_tuple)
)
endef

define HOST_BINUTILS_BARE_METAL_INSTALL_CMDS
$(foreach arch_tuple, $(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE), \
$(HOST_MAKE_ENV) $(MAKE) \
$(HOST_BINUTILS_BARE_METAL_INSTALL_OPTS) \
-C $(@D)/build-$(arch_tuple)
)
endef

$(eval $(host-autotools-package))
2 changes: 1 addition & 1 deletion package/cpp-httplib/cpp-httplib.hash
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Locally computed:
sha256 6ed5894bbbc4a34a0f4c5e962672d0003d2ea099bbadacc66f6dee2b213ff394 cpp-httplib-0.18.0.tar.gz
sha256 c9b9e0524666e1cd088f0874c57c1ce7c0eaa8552f9f4e15c755d5201fc8c608 cpp-httplib-0.19.0.tar.gz
sha256 4b45cbe16d7b71b89ae6127e26e0d90a029198ca5e958ad8e3d0b8bbed364d8b LICENSE
2 changes: 1 addition & 1 deletion package/cpp-httplib/cpp-httplib.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
################################################################################

CPP_HTTPLIB_VERSION = 0.18.0
CPP_HTTPLIB_VERSION = 0.19.0
CPP_HTTPLIB_SITE = $(call github,yhirose,cpp-httplib,v$(CPP_HTTPLIB_VERSION))
CPP_HTTPLIB_LICENSE = MIT
CPP_HTTPLIB_LICENSE_FILES = LICENSE
Expand Down
58 changes: 43 additions & 15 deletions package/gcc-bare-metal/gcc-bare-metal.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,9 @@ HOST_GCC_BARE_METAL_DEPENDENCIES = \
host-mpfr \
host-isl

# gcc doesn't support in-tree build, so we create a 'build'
# subdirectory in the gcc sources, and build from there.
define HOST_GCC_BARE_METAL_CONFIGURE_SYMLINK
mkdir -p $(@D)/build
ln -sf ../configure $(@D)/build/configure
endef

HOST_GCC_BARE_METAL_PRE_CONFIGURE_HOOKS += HOST_GCC_BARE_METAL_CONFIGURE_SYMLINK
HOST_GCC_BARE_METAL_SUBDIR = build
# Don't build documentation. It takes up extra space / build time,
# and sometimes needs specific makeinfo versions to work
HOST_GCC_BARE_METAL_CONF_ENV = MAKEINFO=missing

HOST_GCC_BARE_METAL_MAKE_OPTS = \
$(HOST_GCC_COMMON_MAKE_OPTS) \
Expand All @@ -38,8 +32,13 @@ HOST_GCC_BARE_METAL_MAKE_OPTS = \
HOST_GCC_BARE_METAL_INSTALL_OPTS = install-gcc install-target-libgcc

HOST_GCC_BARE_METAL_CONF_OPTS = \
--target=$(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE) \
--disable-initfini_array \
--prefix=$(HOST_DIR) \
--sysconfdir=$(HOST_DIR)/etc \
--localstatedir=$(HOST_DIR)/var \
$(if $$($$(PKG)_OVERRIDE_SRCDIR),,--disable-dependency-tracking) \
$(QUIET) \
--disable-shared \
--disable-initfini-array \
--disable-__cxa_atexit \
--disable-libstdcxx-pch \
--with-newlib \
Expand All @@ -54,9 +53,38 @@ HOST_GCC_BARE_METAL_CONF_OPTS = \
--with-gmp=$(HOST_DIR) \
--with-mpc=$(HOST_DIR) \
--with-mpfr=$(HOST_DIR) \
--with-isl=$(HOST_DIR) \
--with-sysroot=$(TOOLCHAIN_BARE_METAL_BUILDROOT_SYSROOT) \
AR_FOR_TARGET=$(HOST_DIR)/bin/$(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE)-ar \
RANLIB_FOR_TARGET=$(HOST_DIR)/bin/$(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE)-ranlib
--with-isl=$(HOST_DIR)

define HOST_GCC_BARE_METAL_CONFIGURE_CMDS
$(foreach arch_tuple, $(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE), \
mkdir -p $(@D)/build-$(arch_tuple) && \
cd $(@D)/build-$(arch_tuple) && \
$(HOST_CONFIGURE_OPTS) \
$(HOST_GCC_BARE_METAL_CONF_ENV) \
CONFIG_SITE=/dev/null \
$(@D)/configure \
$(HOST_GCC_BARE_METAL_CONF_OPTS) \
--target=$(arch_tuple) \
--with-sysroot=$(HOST_DIR)/$(arch_tuple)/sysroot \
AR_FOR_TARGET=$(HOST_DIR)/bin/$(arch_tuple)-ar \
RANLIB_FOR_TARGET=$(HOST_DIR)/bin/$(arch_tuple)-ranlib
)
endef

define HOST_GCC_BARE_METAL_BUILD_CMDS
$(foreach arch_tuple, $(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE), \
$(HOST_MAKE_ENV) $(MAKE) \
$(HOST_GCC_BARE_METAL_MAKE_OPTS) \
-C $(@D)/build-$(arch_tuple)
)
endef

define HOST_GCC_BARE_METAL_INSTALL_CMDS
$(foreach arch_tuple, $(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE), \
$(HOST_MAKE_ENV) $(MAKE) \
$(HOST_GCC_BARE_METAL_INSTALL_OPTS) \
-C $(@D)/build-$(arch_tuple)
)
endef

$(eval $(host-autotools-package))
Loading