Compare commits

...

No commits in common. "imports/c8-beta/valgrind-3.19.0-1.el8" and "c8" have entirely different histories.

6 changed files with 182 additions and 42 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/valgrind-3.19.0.tar.bz2
SOURCES/valgrind-3.22.0.tar.bz2

View File

@ -1 +0,0 @@
294c341b421b4d9534e42e8125f509c148f48c17 SOURCES/valgrind-3.19.0.tar.bz2

View File

@ -35,19 +35,6 @@ index 1b7842b..e211eec 100644
if HAVE_DLINFO_RTLD_DI_TLS_MODID
getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDADD = $(LDADD) -ldl
endif
diff --git a/cachegrind/Makefile.am b/cachegrind/Makefile.am
index f572741..1c07e50 100644
--- a/cachegrind/Makefile.am
+++ b/cachegrind/Makefile.am
@@ -27,7 +27,7 @@ cg_merge_SOURCES = cg_merge.c
cg_merge_CPPFLAGS = $(AM_CPPFLAGS_PRI)
cg_merge_CFLAGS = $(AM_CFLAGS_PRI) -fstack-protector-strong
cg_merge_CCASFLAGS = $(AM_CCASFLAGS_PRI)
-cg_merge_LDFLAGS = $(AM_CFLAGS_PRI)
+cg_merge_LDFLAGS = $(AM_CFLAGS_PRI) -Wl,-z,now
# If there is no secondary platform, and the platforms include x86-darwin,
# then the primary platform must be x86-darwin. Hence:
if ! VGCONF_HAVE_PLATFORM_SEC
diff --git a/coregrind/Makefile.am b/coregrind/Makefile.am
index 3c73210..fb6b7bb 100644
--- a/coregrind/Makefile.am
@ -61,8 +48,8 @@ index 3c73210..fb6b7bb 100644
# If there is no secondary platform, and the platforms include x86-darwin,
# then the primary platform must be x86-darwin. Hence:
if ! VGCONF_HAVE_PLATFORM_SEC
@@ -96,7 +96,7 @@ endif
vgdb_CPPFLAGS = $(AM_CPPFLAGS_PRI)
@@ -104,7 +104,7 @@
vgdb_CPPFLAGS = $(AM_CPPFLAGS_PRI) $(GDB_SCRIPTS_DIR)
vgdb_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) -fstack-protector-strong
vgdb_CCASFLAGS = $(AM_CCASFLAGS_PRI)
-vgdb_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@

View File

@ -35,19 +35,6 @@ index 56cc5ef..1b7842b 100644
getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CCASFLAGS = $(AM_CCASFLAGS_PRI)
getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@
if HAVE_DLINFO_RTLD_DI_TLS_MODID
diff --git a/cachegrind/Makefile.am b/cachegrind/Makefile.am
index f8447a1..f572741 100644
--- a/cachegrind/Makefile.am
+++ b/cachegrind/Makefile.am
@@ -25,7 +25,7 @@ bin_PROGRAMS = cg_merge
cg_merge_SOURCES = cg_merge.c
cg_merge_CPPFLAGS = $(AM_CPPFLAGS_PRI)
-cg_merge_CFLAGS = $(AM_CFLAGS_PRI)
+cg_merge_CFLAGS = $(AM_CFLAGS_PRI) -fstack-protector-strong
cg_merge_CCASFLAGS = $(AM_CCASFLAGS_PRI)
cg_merge_LDFLAGS = $(AM_CFLAGS_PRI)
# If there is no secondary platform, and the platforms include x86-darwin,
diff --git a/configure.ac b/configure.ac
index f8c798b..ccc8f52 100755
--- a/configure.ac
@ -107,10 +94,10 @@ index 94030fd..3c73210 100644
valgrind_CCASFLAGS = $(AM_CCASFLAGS_PRI)
valgrind_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@
# If there is no secondary platform, and the platforms include x86-darwin,
@@ -94,7 +94,7 @@ vgdb_SOURCES += vgdb-invoker-solaris.c
@@ -102,7 +102,7 @@
endif
vgdb_CPPFLAGS = $(AM_CPPFLAGS_PRI)
vgdb_CPPFLAGS = $(AM_CPPFLAGS_PRI) $(GDB_SCRIPTS_DIR)
-vgdb_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS)
+vgdb_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) -fstack-protector-strong
vgdb_CCASFLAGS = $(AM_CCASFLAGS_PRI)

View File

@ -0,0 +1,122 @@
commit 1d00e5ce0fb069911c4b525ec38289fb5d9021b0
Author: Paul Floyd <pjfloyd@wanadoo.fr>
Date: Sat Nov 18 08:49:34 2023 +0100
Bug 476548 - valgrind 3.22.0 fails on assertion when loading debuginfo file produced by mold
(cherry picked from commit 9ea4ae66707a4dcc6f4328e11911652e4418c585)
diff --git a/coregrind/m_debuginfo/image.c b/coregrind/m_debuginfo/image.c
index 02e509071..445f95555 100644
--- a/coregrind/m_debuginfo/image.c
+++ b/coregrind/m_debuginfo/image.c
@@ -1221,6 +1221,20 @@ Int ML_(img_strcmp_c)(DiImage* img, DiOffT off1, const HChar* str2)
}
}
+Int ML_(img_strcmp_n)(DiImage* img, DiOffT off1, const HChar* str2, Word n)
+{
+ ensure_valid(img, off1, 1, "ML_(img_strcmp_c)");
+ while (n) {
+ UChar c1 = get(img, off1);
+ UChar c2 = *(const UChar*)str2;
+ if (c1 < c2) return -1;
+ if (c1 > c2) return 1;
+ if (c1 == 0) return 0;
+ off1++; str2++; --n;
+ }
+ return 0;
+}
+
UChar ML_(img_get_UChar)(DiImage* img, DiOffT offset)
{
ensure_valid(img, offset, 1, "ML_(img_get_UChar)");
diff --git a/coregrind/m_debuginfo/priv_image.h b/coregrind/m_debuginfo/priv_image.h
index a49846f14..c91e49f01 100644
--- a/coregrind/m_debuginfo/priv_image.h
+++ b/coregrind/m_debuginfo/priv_image.h
@@ -115,6 +115,10 @@ Int ML_(img_strcmp)(DiImage* img, DiOffT off1, DiOffT off2);
cast to HChar before comparison. */
Int ML_(img_strcmp_c)(DiImage* img, DiOffT off1, const HChar* str2);
+/* Do strncmp of a C string in the image vs a normal one. Chars are
+ cast to HChar before comparison. */
+Int ML_(img_strcmp_n)(DiImage* img, DiOffT off1, const HChar* str2, Word n);
+
/* Do strlen of a C string in the image. */
SizeT ML_(img_strlen)(DiImage* img, DiOffT off);
diff --git a/coregrind/m_debuginfo/readelf.c b/coregrind/m_debuginfo/readelf.c
index fb64ed976..46f8c8343 100644
--- a/coregrind/m_debuginfo/readelf.c
+++ b/coregrind/m_debuginfo/readelf.c
@@ -2501,8 +2501,7 @@ Bool ML_(read_elf_object) ( struct _DebugInfo* di )
di->rodata_avma += inrw1->bias;
di->rodata_bias = inrw1->bias;
di->rodata_debug_bias = inrw1->bias;
- }
- else {
+ } else {
BAD(".rodata"); /* should not happen? */
}
di->rodata_present = True;
@@ -2977,6 +2976,46 @@ Bool ML_(read_elf_object) ( struct _DebugInfo* di )
return retval;
}
+static void find_rodata(Word i, Word shnum, DiImage* dimg, struct _DebugInfo* di, DiOffT shdr_dioff,
+ UWord shdr_dent_szB, DiOffT shdr_strtab_dioff, PtrdiffT rw_dbias)
+{
+ ElfXX_Shdr a_shdr;
+ ElfXX_Shdr a_extra_shdr;
+ ML_(img_get)(&a_shdr, dimg,
+ INDEX_BIS(shdr_dioff, i, shdr_dent_szB),
+ sizeof(a_shdr));
+ if (di->rodata_present &&
+ 0 == ML_(img_strcmp_c)(dimg, shdr_strtab_dioff
+ + a_shdr.sh_name, ".rodata")) {
+ Word sh_size = a_shdr.sh_size;
+ Word j;
+ Word next_addr = a_shdr.sh_addr + a_shdr.sh_size;
+ for (j = i + 1; j < shnum; ++j) {
+ ML_(img_get)(&a_extra_shdr, dimg,
+ INDEX_BIS(shdr_dioff, j, shdr_dent_szB),
+ sizeof(a_shdr));
+ if (0 == ML_(img_strcmp_n)(dimg, shdr_strtab_dioff
+ + a_extra_shdr.sh_name, ".rodata", 7)) {
+ if (a_extra_shdr.sh_addr ==
+ VG_ROUNDUP(next_addr, a_extra_shdr.sh_addralign)) {
+ sh_size = VG_ROUNDUP(sh_size, a_extra_shdr.sh_addralign) + a_extra_shdr.sh_size;
+ }
+ next_addr = a_extra_shdr.sh_addr + a_extra_shdr.sh_size;
+ } else {
+ break;
+ }
+ }
+ vg_assert(di->rodata_size == sh_size);
+ vg_assert(di->rodata_avma + a_shdr.sh_addr + rw_dbias);
+ di->rodata_debug_svma = a_shdr.sh_addr;
+ di->rodata_debug_bias = di->rodata_bias +
+ di->rodata_svma - di->rodata_debug_svma;
+ TRACE_SYMTAB("acquiring .rodata debug svma = %#lx .. %#lx\n",
+ di->rodata_debug_svma,
+ di->rodata_debug_svma + di->rodata_size - 1);
+ TRACE_SYMTAB("acquiring .rodata debug bias = %#lx\n", (UWord)di->rodata_debug_bias);
+ }
+}
Bool ML_(read_elf_debug) ( struct _DebugInfo* di )
{
Word i, j;
@@ -3391,7 +3430,11 @@ Bool ML_(read_elf_debug) ( struct _DebugInfo* di )
FIND(text, rx)
FIND(data, rw)
FIND(sdata, rw)
- FIND(rodata, rw)
+ // https://bugs.kde.org/show_bug.cgi?id=476548
+ // special handling for rodata as adjacent
+ // rodata sections may have been merged in ML_(read_elf_object)
+ //FIND(rodata, rw)
+ find_rodata(i, ehdr_dimg.e_shnum, dimg, di, shdr_dioff, shdr_dent_szB, shdr_strtab_dioff, rw_dbias);
FIND(bss, rw)
FIND(sbss, rw)

View File

@ -2,15 +2,13 @@
Summary: Dynamic analysis tools to detect memory or thread bugs and profile
Name: %{?scl_prefix}valgrind
Version: 3.19.0
Release: 1%{?dist}
Version: 3.22.0
Release: 2%{?dist}
Epoch: 1
License: GPLv2+
URL: https://www.valgrind.org/
Group: Development/Debuggers
# Only necessary for RHEL, will be ignored on Fedora
# Are we building for a Software Collection?
%{?scl:%global is_scl 1}
%{!?scl:%global is_scl 0}
@ -18,11 +16,16 @@ Group: Development/Debuggers
# We never want the openmpi subpackage when building a software collecton.
# We always want it for fedora.
# We only want it for older rhel. But not s390x for too old rhel.
# And on fedora > 39 i386 dropped openmpi.
%if %{is_scl}
%global build_openmpi 0
%else
%if 0%{?fedora}
%global build_openmpi 1
%ifarch %{ix86}
%global build_openmpi (%{?fedora} < 40)
%else
%global build_openmpi 1
%endif
%endif
%if 0%{?rhel}
%if 0%{?rhel} > 7
@ -86,6 +89,10 @@ Patch3: valgrind-3.16.0-some-stack-protector.patch
# Add some -Wl,z,now.
Patch4: valgrind-3.16.0-some-Wl-z-now.patch
# valgrind 3.22.0 fails on assertion when loading debuginfo
# https://bugs.kde.org/show_bug.cgi?id=476548
Patch5: valgrind-3.22.0-rodata.patch
BuildRequires: make
BuildRequires: glibc-devel
@ -118,11 +125,16 @@ BuildRequires: docbook-dtds
# For testing debuginfod-find
%if 0%{?fedora} > 29 || 0%{?rhel} > 7
BuildRequires: elfutils-debuginfod
BuildRequires: elfutils-debuginfod-client
# For using debuginfod at runtime
Recommends: elfutils-debuginfod-client
%endif
# Some of the python scripts require python 3.9+
BuildRequires: python3.11
BuildRequires: python3.11-rpm-macros
%{?scl:Requires:%scl_runtime}
# We need to fixup selinux file context when doing a scl build.
@ -217,15 +229,16 @@ Valgrind User Manual for details.
%prep
%setup -q -n %{?scl:%{pkg_name}}%{!?scl:%{name}}-%{version}
%patch1 -p1
%patch2 -p1
%patch -P1 -p1
%patch -P2 -p1
# Old rhel gcc doesn't have -fstack-protector-strong.
%if 0%{?fedora} || 0%{?rhel} >= 7
%patch3 -p1
%patch4 -p1
%patch -P3 -p1
%patch -P4 -p1
%endif
%patch -P5 -p1
%build
@ -291,7 +304,8 @@ export LDFLAGS
%configure \
--with-mpicc=%{mpiccpath} \
%{only_arch} \
GDB=%{_bindir}/gdb
GDB=%{_bindir}/gdb \
--without-gdbscripts-dir
make %{?_smp_mflags}
@ -413,6 +427,7 @@ echo ===============END TESTING===============
%files devel
%dir %{_includedir}/valgrind
%{_includedir}/valgrind/valgrind.h
%{_includedir}/valgrind/cachegrind.h
%{_includedir}/valgrind/callgrind.h
%{_includedir}/valgrind/drd.h
%{_includedir}/valgrind/helgrind.h
@ -451,6 +466,36 @@ fi
%endif
%changelog
* Wed Dec 6 2023 Mark Wielaard <mjw@redhat.com> - 3.22.0-2
- Add valgrind-3.22.0-rodata.patch
* Fri Nov 3 2023 Mark Wielaard <mjw@redhat.com> - 3.22.0-1
- Upstream 3.22.0 final
- BuildRequires elfutils-debuginfod for testing
- Remove all upstreamed patches
- Adjust valgrind-3.16.0-some-stack-protector.patch
- Adjust valgrind-3.16.0-some-Wl-z-now.patch
- Add cachegrind.h to valgrind-devel package
- Use %%patch -Pn instead of deprecated %%patchn
* Tue Jun 27 2023 Mark Wielaard <mjw@redhat.com> - 3.21.0-8
- BuildRequire python3.11
* Fri Jun 23 2023 Mark Wielaard <mjw@redhat.com> - 3.21.0-7
- Add valgrind-3.21.0-callgrind_control-no-strict.patch
- Add valgrind-3.21.0-realloc-again.patch
- Update valgrind-3.21.0-no-memcpy-replace-check.patch (memcpy_chk)
- Add valgrind-3.21.0-vgm.patch and valgrind-3.21.0-vgm-tests.patch
- Add valgrind-3.21.0-pgste.patch
* Tue May 16 2023 Alexandra Hájková <ahajkova@redhat.com> - 3.21.0-3
- Add valgrind-3.21.0-Add-with-gdbscripts-dir.patch
* Fri May 5 2023 Mark Wielaard <mjw@redhat.com> - 3.21.0-2
- Upgrade to upstream 3.21.0
- Remove upstreamed patches
- Add valgrind-3.21.0-no-memcpy-replace-check.patch
* Tue Apr 19 2022 Mark Wielaard <mjw@redhat.com> - 3.19.0-1
- Upgrade to valgrind 3.19.0. Drop old patches.