Resolves: RHEL-89474 - Fails to build on riscv64

Thanks: David Abdurachmanov <davidlt@rivosinc.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
Andrea Bolognani 2025-04-29 14:39:19 +02:00
parent 2bdb956c82
commit f7b406456c
2 changed files with 98 additions and 1 deletions

View File

@ -0,0 +1,91 @@
From 3aab117ea3c543e5711577456c5bb87ae6b8fbd3 Mon Sep 17 00:00:00 2001
From: Andrea Bolognani <abologna@redhat.com>
Date: Thu, 20 Feb 2025 18:16:21 +0100
Subject: [PATCH] configure: Require valgrind-devel when valgrind is enabled
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Currently we include <valgrind/valgrind.h> unconditionally to
access the RUNNING_ON_VALGRIND macro, which allows us to skip
one of the tests which is known not to work correctly under
valgrind.
However, if only the runtime part of valgrind in installed on
the system and the devel part is missing, this will result in
a very late compilation error. Checking for the header's
presence at configure time allows us to provide better
diagnostics, earlier.
More importantly, this makes it possible to build sssd at all
on architectures where valgrind is not yet available, such as
riscv64.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Alejandro López <allopez@redhat.com>
Reviewed-by: Alexey Tikhonov <atikhono@redhat.com>
(cherry picked from commit 8477aa0658f5af5133a694bba09e0a68fbedc649)
---
configure.ac | 7 +++++++
src/tests/cmocka/test_iobuf.c | 6 ++++++
2 files changed, 13 insertions(+)
diff --git a/configure.ac b/configure.ac
index 90cb1f3ec..804c150de 100644
--- a/configure.ac
+++ b/configure.ac
@@ -543,6 +543,13 @@ AM_CHECK_PAM_WRAPPER
AM_CHECK_TEST_CA
AX_VALGRIND_CHECK
+AS_IF([test x$VALGRIND_ENABLED = xyes], [
+ AC_CHECK_HEADERS([valgrind/valgrind.h],,AC_MSG_ERROR([valgrind-devel required with valgrind enabled]))
+], [
+ AC_CHECK_HEADERS([valgrind/valgrind.h])
+])
+
+
# Check if the user wants SSSD to be compiled with systemtap probes
AM_CHECK_SYSTEMTAP
diff --git a/src/tests/cmocka/test_iobuf.c b/src/tests/cmocka/test_iobuf.c
index 7b4de54f5..145bee07e 100644
--- a/src/tests/cmocka/test_iobuf.c
+++ b/src/tests/cmocka/test_iobuf.c
@@ -20,6 +20,8 @@
*/
#define _GNU_SOURCE /* For memmem() */
+#include "config.h"
+
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
@@ -28,7 +30,9 @@
#include <string.h>
#include <stddef.h>
#include <setjmp.h>
+#ifdef HAVE_VALGRIND_VALGRIND_H
#include <valgrind/valgrind.h>
+#endif
#include <cmocka.h>
#include <sys/mman.h>
#include <sys/stat.h>
@@ -187,11 +191,13 @@ static void test_sss_iobuf_secure(void **state)
struct sss_iobuf *iobuf_secret_2;
struct sss_iobuf *iobuf_nosecret;
+#ifdef HAVE_VALGRIND_VALGRIND_H
/* Valgrind interferes with this test by somehow making disappear the heap.
* So don't run it on Valgrind. */
if (RUNNING_ON_VALGRIND) {
skip();
}
+#endif
mem_ctx = talloc_new(NULL);
--
2.48.1

View File

@ -57,7 +57,7 @@
Name: sssd
Version: 2.10.2
Release: 3%{?dist}.2
Release: 4%{?dist}
Summary: System Security Services Daemon
License: GPL-3.0-or-later
URL: https://github.com/SSSD/sssd/
@ -68,6 +68,7 @@ Source1: sssd.sysusers
Patch0001: 0001-KCM-fix-memory-leak.patch
Patch0002: 0002-KCM-another-memory-leak-fixed.patch
Patch0003: 0003-SYSDB-don-t-add-group-members-if-ignore_group_member.patch
Patch0004: 0004-configure-Require-valgrind-devel-when-valgrind-is-en.patch
### Dependencies ###
@ -165,7 +166,9 @@ BuildRequires: systemtap-sdt-devel
BuildRequires: systemtap-sdt-dtrace
BuildRequires: uid_wrapper
BuildRequires: po4a
%ifarch %{valgrind_arches}
BuildRequires: valgrind-devel
%endif
%if %{build_subid}
BuildRequires: shadow-utils-subid-devel
%endif
@ -1118,6 +1121,9 @@ fi
%systemd_postun_with_restart sssd.service
%changelog
* Fri May 2 2025 Andrea Bolognani <abologna@redhat.com> - 2.10.2-4
- Resolves: RHEL-89474 - Fails to build on riscv64
* Mon Apr 7 2025 Alexey Tikhonov <atikhono@redhat.com> - 2.10.2-3.2
- Resolves: RHEL-79158 - Disk cache failure with large db sizes