* [ptxdist] [PATCH] libbsd: patch sanitize disable flag
@ 2025-10-28 11:46 Sven Püschel
0 siblings, 0 replies; only message in thread
From: Sven Püschel @ 2025-10-28 11:46 UTC (permalink / raw)
To: ptxdist; +Cc: Sven Püschel
libbsd incorrectly checked the sanitize argument and therefore enabled
sanitize also when --disable-sanitize was present in the configure
call.
Created an upstream patch [1] and added it to the patch dir. The first
patch was just regenerated as a result of 'git ptx-patches'.
[1] https://gitlab.freedesktop.org/libbsd/libbsd/-/merge_requests/31
Fixes: 0d8d99a84218 ("libbsd: version bump 0.11.7 -> 0.12.2")
Signed-off-by: Sven Püschel <s.pueschel@pengutronix.de>
---
...-I-instead-of-isystem-for-local-path.patch | 14 +++----
...-build-check-sanitize-argument-value.patch | 42 +++++++++++++++++++
patches/libbsd-0.12.2/series | 3 +-
3 files changed, 51 insertions(+), 8 deletions(-)
create mode 100644 patches/libbsd-0.12.2/0002-build-check-sanitize-argument-value.patch
diff --git a/patches/libbsd-0.12.2/0001-use-I-instead-of-isystem-for-local-path.patch b/patches/libbsd-0.12.2/0001-use-I-instead-of-isystem-for-local-path.patch
index 6dbf20c2a..ddcf049c0 100644
--- a/patches/libbsd-0.12.2/0001-use-I-instead-of-isystem-for-local-path.patch
+++ b/patches/libbsd-0.12.2/0001-use-I-instead-of-isystem-for-local-path.patch
@@ -12,7 +12,7 @@ Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
-index 7ef2013a5ff9..167ad58ce747 100644
+index 00181bd9607b..9caf57d6a4a8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,7 +2,7 @@
@@ -23,17 +23,17 @@ index 7ef2013a5ff9..167ad58ce747 100644
+ -I$(top_srcdir)/include/bsd/ \
-include $(top_builddir)/config.h \
-DLIBBSD_OVERLAY -DLIBBSD_DISABLE_DEPRECATED \
- -D__REENTRANT
+ -D__REENTRANT \
diff --git a/test/Makefile.am b/test/Makefile.am
-index 90fe38430bbd..eb54cf39d60d 100644
+index 13c3309c4bb4..a5d5f70449bc 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
-@@ -7,7 +7,7 @@ HEADERS_CPPFLAGS = \
- -D__REENTRANT
+@@ -8,7 +8,7 @@ HEADERS_CPPFLAGS = \
+ # EOL
AM_CPPFLAGS = \
- -isystem $(top_srcdir)/include/bsd/ \
+ -I$(top_srcdir)/include/bsd/ \
$(HEADERS_CPPFLAGS) \
- -DLIBBSD_OVERLAY
-
+ -DLIBBSD_OVERLAY \
+ # EOL
diff --git a/patches/libbsd-0.12.2/0002-build-check-sanitize-argument-value.patch b/patches/libbsd-0.12.2/0002-build-check-sanitize-argument-value.patch
new file mode 100644
index 000000000..27cdd4032
--- /dev/null
+++ b/patches/libbsd-0.12.2/0002-build-check-sanitize-argument-value.patch
@@ -0,0 +1,42 @@
+From: =?UTF-8?q?Sven=20P=C3=BCschel?= <s.pueschel@pengutronix.de>
+Date: Tue, 28 Oct 2025 12:11:36 +0100
+Subject: [PATCH] build: check sanitize argument value
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Check the value of the sanitize argument to determine if sanitize
+should be enabled. This fixes that sanitize is enabled when
+--disable-sanitize is passed to the configure script.
+
+The third AC_ARG_ENABLE parameter defines an action, if the parameter is
+present, but doesn't check it's value. Therefore it is also invoked if
+the parameter is disabled or --enable-foo=no is set. Therefore don't
+define these actions and instead check the value with an AS_IF statement
+afterwards, as shown in [1].
+
+[1] https://autotools.info/autoconf/arguments.html
+
+Fixes: 257800a03c6b ("build: Add support for sanitizer compiler flags")
+
+Upstream-Status: Submitted [https://gitlab.freedesktop.org/libbsd/libbsd/-/merge_requests/31]
+
+Signed-off-by: Sven Püschel <s.pueschel@pengutronix.de>
+---
+ configure.ac | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 2a15d720f9db..c3fed26939a4 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -425,7 +425,8 @@ AS_IF([test "$user_CFLAGS" = unset], [
+ CFLAGS="$CFLAGS $LIBBSD_COMPILER_FLAGS"
+
+ AC_ARG_ENABLE([sanitize],
+- [AS_HELP_STRING([--enable-sanitize], [enable compiler sanitizer support])],
++ [AS_HELP_STRING([--enable-sanitize], [enable compiler sanitizer support])])
++ AS_IF([test "x$enable_sanitize" = "xyes"],
+ [
+ LIBBSD_COMPILER_FLAGS=''
+ LIBBSD_CHECK_COMPILER_FLAG([-fsanitize=address])
diff --git a/patches/libbsd-0.12.2/series b/patches/libbsd-0.12.2/series
index 4e941d98e..c47d9d254 100644
--- a/patches/libbsd-0.12.2/series
+++ b/patches/libbsd-0.12.2/series
@@ -1,4 +1,5 @@
# generated by git-ptx-patches
#tag:base --start-number 1
0001-use-I-instead-of-isystem-for-local-path.patch
-# 11cd8d3f722f73a2447389987314e113 - git-ptx-patches magic
+0002-build-check-sanitize-argument-value.patch
+# 3d6c768f28075aeb90ae7547b97f6810 - git-ptx-patches magic
--
2.47.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-10-28 11:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-28 11:46 [ptxdist] [PATCH] libbsd: patch sanitize disable flag Sven Püschel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox