systemd-252-38

Resolves: RHEL-30372
This commit is contained in:
Jan Macku 2024-06-19 12:59:17 +02:00
parent 75aa201631
commit 4f97ea019f
6 changed files with 261 additions and 1 deletions

View File

@ -0,0 +1,25 @@
From d77bb7131a5c6946e78e8055e79ab7837189529c Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Fri, 3 Mar 2023 14:48:56 +0900
Subject: [PATCH] tools: fix the file name that "meson setup" generates
(cherry picked from commit 26ab5ea69d7b7804d0e9a7f4773443902c76c654)
Related: RHEL-30372
---
tools/meson-build.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/meson-build.sh b/tools/meson-build.sh
index ecd558f8d9..c8370a7e6a 100755
--- a/tools/meson-build.sh
+++ b/tools/meson-build.sh
@@ -10,7 +10,7 @@ CC="$5"
CXX="$6"
# shellcheck disable=SC2086
-[ -f "$dst/ninja.build" ] || CC="$CC" CXX="$CXX" meson "$src" "$dst" $options
+[ -f "$dst/build.ninja" ] || CC="$CC" CXX="$CXX" meson "$src" "$dst" $options
# Locate ninja binary, on CentOS 7 it is called ninja-build, so
# use that name if available.

View File

@ -0,0 +1,41 @@
From d04257360c5b5cafbfdb67a3d1bcaf270f101465 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Fri, 3 Mar 2023 20:06:09 +0900
Subject: [PATCH] tools: explicitly specify "setup" subcommand
As invoking meson without subcommand is deprecated since 0.64.0.
(cherry picked from commit e3b2f7c056551fa50ba6ed13703b8e63ba8303c7)
Related: RHEL-30372
---
tools/meson-build.sh | 2 +-
tools/oss-fuzz.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/meson-build.sh b/tools/meson-build.sh
index c8370a7e6a..2ef60cfa8e 100755
--- a/tools/meson-build.sh
+++ b/tools/meson-build.sh
@@ -10,7 +10,7 @@ CC="$5"
CXX="$6"
# shellcheck disable=SC2086
-[ -f "$dst/build.ninja" ] || CC="$CC" CXX="$CXX" meson "$src" "$dst" $options
+[ -f "$dst/build.ninja" ] || CC="$CC" CXX="$CXX" meson setup "$src" "$dst" $options
# Locate ninja binary, on CentOS 7 it is called ninja-build, so
# use that name if available.
diff --git a/tools/oss-fuzz.sh b/tools/oss-fuzz.sh
index 7e9312b833..2e64475c6d 100755
--- a/tools/oss-fuzz.sh
+++ b/tools/oss-fuzz.sh
@@ -73,7 +73,7 @@ else
fi
fi
-if ! meson "$build" "-D$fuzzflag" -Db_lundef=false; then
+if ! meson setup "$build" "-D$fuzzflag" -Db_lundef=false; then
cat "$build/meson-logs/meson-log.txt"
exit 1
fi

View File

@ -0,0 +1,86 @@
From cd2c39dd38fe4127a185e86798639c076dee58af Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Fri, 10 Nov 2023 16:38:01 +0100
Subject: [PATCH] fuzz: pass -Dc_args=/-Dcpp_args= to fuzzer targets
Prompted by #29972, because right now it's practically impossible to pass
-fno-sanitize=function to the fuzzer targets without some extensive
sed'ing.
This splits both c_args and cpp_args to separate arguments for
tools/meson-build.sh, because the other way would be to use `eval`, so
the space-separated but quoted strings passed to these options are not
split where they shouldn't, and I'd rather avoid using `eval` if
possible.
Also, this switches the positional arguments we pass to `meson setup`,
as they were in incorrect order (docs say it should be buildir followed
by sourcedir); meson is apparently clever enough to figure this out and
switch the arguments around if necessary, so it didn't complain.
(cherry picked from commit 17ee59c9c922553a8cb4d54cb8ae415706c4feff)
Related: RHEL-30372
---
test/fuzz/meson.build | 5 +++--
tools/meson-build.sh | 29 ++++++++++++++---------------
2 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/test/fuzz/meson.build b/test/fuzz/meson.build
index f7f0a6111c..813c2cfb8b 100644
--- a/test/fuzz/meson.build
+++ b/test/fuzz/meson.build
@@ -38,10 +38,11 @@ sanitize_address_undefined = custom_target(
project_source_root,
'@OUTPUT@',
'fuzzers',
- '-Dfuzz-tests=true -Db_lundef=false -Db_sanitize=address,undefined --optimization=@0@ @1@ -Dc_args=@2@ -Dcpp_args=@2@ -Dskip-deps=@3@'.format(
+ ' '.join(get_option('c_args') + '-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION'),
+ ' '.join(get_option('cpp_args') + '-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION'),
+ '-Dfuzz-tests=true -Db_lundef=false -Db_sanitize=address,undefined --optimization=@0@ @1@ -Dskip-deps=@2@'.format(
get_option('optimization'),
get_option('werror') ? '--werror' : '',
- '-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION',
get_option('skip-deps')
),
' '.join(cc.cmd_array()),
diff --git a/tools/meson-build.sh b/tools/meson-build.sh
index 2ef60cfa8e..311b778f0a 100755
--- a/tools/meson-build.sh
+++ b/tools/meson-build.sh
@@ -2,21 +2,20 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
set -eux
-src="$1"
-dst="$2"
-target="$3"
-options="$4"
-CC="$5"
-CXX="$6"
+sourcedir="${1:?}"
+builddir="${2:?}"
+target="${3:?}"
+c_args="${4:?}"
+cpp_args="${5:?}"
+options="${6:?}"
+CC="${7:?}"
+CXX="${8:?}"
-# shellcheck disable=SC2086
-[ -f "$dst/build.ninja" ] || CC="$CC" CXX="$CXX" meson setup "$src" "$dst" $options
-
-# Locate ninja binary, on CentOS 7 it is called ninja-build, so
-# use that name if available.
-ninja="ninja"
-if command -v ninja-build >/dev/null ; then
- ninja="ninja-build"
+if [ ! -f "$builddir/build.ninja" ]; then
+ # shellcheck disable=SC2086
+ CC="$CC" CXX="$CXX" meson setup -Dc_args="$c_args" -Dcpp_args="$cpp_args" "$builddir" "$sourcedir" $options
fi
-"$ninja" -C "$dst" "$target"
+# Locate ninja binary, on CentOS 7 it is called ninja-build, so use that name if available.
+command -v ninja-build >/dev/null && ninja="ninja-build" || ninja="ninja"
+"$ninja" -C "$builddir" "$target"

View File

@ -0,0 +1,67 @@
From b327fbd6f262d2bbf2f20136d94a8edd28e43be8 Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Wed, 15 Nov 2023 11:41:45 +0100
Subject: [PATCH] fuzz: don't panic without a C++ compiler
meson's `cpp_args` option is defined only if it detects a C++ compiler,
otherwise we get an error:
../test/fuzz/meson.build:56:28: ERROR: Tried to access unknown option 'cpp_args'.
[fsumsal]: make the RHS of the c_args/cpp_args expressions lists as
well, since it's a meson 0.60.0 feature (we ship 0.63.3 in RHEL 9 ATTOW,
but our baseline is 0.53.2, so meson rightfully complains about it;
bumping it would require several other commits to be pulled in as well
with lots of conflicts)
(cherry picked from commit a3d3bf559c9789c8abe96d931fc5d3f109886db9)
Related: RHEL-30372
---
test/fuzz/meson.build | 12 ++++++++++--
tools/meson-build.sh | 2 +-
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/test/fuzz/meson.build b/test/fuzz/meson.build
index 813c2cfb8b..8637c66458 100644
--- a/test/fuzz/meson.build
+++ b/test/fuzz/meson.build
@@ -31,6 +31,14 @@ endforeach
############################################################
+
+fuzz_c_args = get_option('c_args')
+if cxx_cmd != ''
+ fuzz_cpp_args = get_option('cpp_args')
+else
+ fuzz_cpp_args = []
+endif
+
sanitize_address_undefined = custom_target(
'sanitize-address-undefined-fuzzers',
output : 'sanitize-address-undefined-fuzzers',
@@ -38,8 +46,8 @@ sanitize_address_undefined = custom_target(
project_source_root,
'@OUTPUT@',
'fuzzers',
- ' '.join(get_option('c_args') + '-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION'),
- ' '.join(get_option('cpp_args') + '-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION'),
+ ' '.join(fuzz_c_args + ['-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION']),
+ ' '.join(fuzz_cpp_args + ['-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION']),
'-Dfuzz-tests=true -Db_lundef=false -Db_sanitize=address,undefined --optimization=@0@ @1@ -Dskip-deps=@2@'.format(
get_option('optimization'),
get_option('werror') ? '--werror' : '',
diff --git a/tools/meson-build.sh b/tools/meson-build.sh
index 311b778f0a..2366df23f9 100755
--- a/tools/meson-build.sh
+++ b/tools/meson-build.sh
@@ -9,7 +9,7 @@ c_args="${4:?}"
cpp_args="${5:?}"
options="${6:?}"
CC="${7:?}"
-CXX="${8:?}"
+CXX="$8"
if [ ! -f "$builddir/build.ninja" ]; then
# shellcheck disable=SC2086

View File

@ -0,0 +1,29 @@
From 70de0ee05d6680e81b6e1b163902c45a2ff7aa63 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Wed, 15 Nov 2023 14:47:17 +0100
Subject: [PATCH] meson: use ternary op for brevity
(cherry picked from commit 3e0cf732435faba34aa16f315d8a47e924734589)
Related: RHEL-30372
---
test/fuzz/meson.build | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/test/fuzz/meson.build b/test/fuzz/meson.build
index 8637c66458..cb00006ff2 100644
--- a/test/fuzz/meson.build
+++ b/test/fuzz/meson.build
@@ -33,11 +33,7 @@ endforeach
fuzz_c_args = get_option('c_args')
-if cxx_cmd != ''
- fuzz_cpp_args = get_option('cpp_args')
-else
- fuzz_cpp_args = []
-endif
+fuzz_cpp_args = cxx_cmd != '' ? get_option('cpp_args') : []
sanitize_address_undefined = custom_target(
'sanitize-address-undefined-fuzzers',

View File

@ -25,7 +25,7 @@
Name: systemd
Url: https://systemd.io
Version: 252
Release: 37%{?dist}
Release: 38%{?dist}
# For a breakdown of the licensing, see README
License: LGPLv2+ and MIT and GPLv2+
Summary: System and Service Manager
@ -901,6 +901,11 @@ Patch0809: 0809-Revert-core-manager-export-manager_dbus_is_running-a.patch
Patch0810: 0810-manager-fix-reloading-in-reload-or-restart-marked.patch
Patch0811: 0811-rpm-add-systemd_postun_with_reload-and-systemd_user_.patch
Patch0812: 0812-rpm-add-systemd_user_daemon_reexec.patch
Patch0813: 0813-tools-fix-the-file-name-that-meson-setup-generates.patch
Patch0814: 0814-tools-explicitly-specify-setup-subcommand.patch
Patch0815: 0815-fuzz-pass-Dc_args-Dcpp_args-to-fuzzer-targets.patch
Patch0816: 0816-fuzz-don-t-panic-without-a-C-compiler.patch
Patch0817: 0817-meson-use-ternary-op-for-brevity.patch
# Downstream-only patches (90009999)
@ -1781,6 +1786,13 @@ systemd-hwdb update &>/dev/null || :
%{_prefix}/lib/dracut/modules.d/70rhel-net-naming-sysattrs/*
%changelog
* Wed Jun 19 2024 systemd maintenance team <systemd-maint@redhat.com> - 252-38
- tools: fix the file name that "meson setup" generates (RHEL-30372)
- tools: explicitly specify "setup" subcommand (RHEL-30372)
- fuzz: pass -Dc_args=/-Dcpp_args= to fuzzer targets (RHEL-30372)
- fuzz: don't panic without a C++ compiler (RHEL-30372)
- meson: use ternary op for brevity (RHEL-30372)
* Thu Jun 13 2024 systemd maintenance team <systemd-maint@redhat.com> - 252-37
- ci(src-git): add RHEL-9.1 and RHEL-9.1.z to allowed versions (RHEL-30372)
- libsystemd: link with '-z nodelete' (RHEL-6589)