import dwarves-1.24-2.el9

This commit is contained in:
CentOS Sources 2023-05-09 05:27:42 +00:00 committed by Stepan Oksanichenko
parent 835a7fa7d1
commit e83b0c918a
4 changed files with 124 additions and 5 deletions

View File

@ -1 +1 @@
ca9684e13a39c9333d2c54b09d421fd65c23d951 SOURCES/dwarves-1.22.tar.xz
2f743d3dc421ae8478cb47051449c721b77f51ab SOURCES/dwarves-1.24.tar.xz

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/dwarves-1.22.tar.xz
SOURCES/dwarves-1.24.tar.xz

View File

@ -0,0 +1,93 @@
From b72f5188856df0abf45e1a707856bb4e4e86153c Mon Sep 17 00:00:00 2001
From: Alan Maguire <alan.maguire@oracle.com>
Date: Fri, 21 Oct 2022 16:02:03 +0100
Subject: [PATCH] dwarves: Zero-initialize struct cu in cu__new() to prevent
incorrect BTF types
BTF deduplication was throwing some strange results, where core kernel
data types were failing to deduplicate due to the return values
of function type members being void (0) instead of the actual type
(unsigned int). An example of this can be seen below, where
"struct dst_ops" was failing to deduplicate between kernel and
module:
struct dst_ops {
short unsigned int family;
unsigned int gc_thresh;
int (*gc)(struct dst_ops *);
struct dst_entry * (*check)(struct dst_entry *, __u32);
unsigned int (*default_advmss)(const struct dst_entry *);
unsigned int (*mtu)(const struct dst_entry *);
...
struct dst_ops___2 {
short unsigned int family;
unsigned int gc_thresh;
int (*gc)(struct dst_ops___2 *);
struct dst_entry___2 * (*check)(struct dst_entry___2 *, __u32);
void (*default_advmss)(const struct dst_entry___2 *);
void (*mtu)(const struct dst_entry___2 *);
...
This was seen with
bcc648a10cbc ("btf_encoder: Encode DW_TAG_unspecified_type returning routines as void")
...which rewrites the return value as 0 (void) when it is marked
as matching DW_TAG_unspecified_type:
static int32_t btf_encoder__tag_type(struct btf_encoder *encoder, uint32_t type_id_off, uint32_t tag_type)
{
if (tag_type == 0)
return 0;
if (encoder->cu->unspecified_type.tag && tag_type == encoder->cu->unspecified_type.type) {
// No provision for encoding this, turn it into void.
return 0;
}
return type_id_off + tag_type;
}
However the odd thing was that on further examination, the unspecified type
was not being set, so why was this logic being tripped? Futher debugging
showed that the encoder->cu->unspecified_type.tag value was garbage, and
the type id happened to collide with "unsigned int"; as a result we
were replacing unsigned ints with void return values, and since this
was being done to function type members in structs, it triggered a
type mismatch which failed deduplication between kernel and module.
The fix is simply to calloc() the cu in cu__new() instead.
Committer notes:
We have zalloc(size) as an alias to calloc(1, size), use it instead.
Fixes: bcc648a10cbcd0b9 ("btf_encoder: Encode DW_TAG_unspecified_type returning routines as void")
Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: bpf@vger.kernel.org
Cc: dwarves@vger.kernel.org
Link: https://lore.kernel.org/r/1666364523-9648-1-git-send-email-alan.maguire@oracle.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
dwarves.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dwarves.c b/dwarves.c
index fbebc1d..95a3bac 100644
--- a/dwarves.c
+++ b/dwarves.c
@@ -626,7 +626,7 @@ struct cu *cu__new(const char *name, uint8_t addr_size,
const unsigned char *build_id, int build_id_len,
const char *filename, bool use_obstack)
{
- struct cu *cu = malloc(sizeof(*cu) + build_id_len);
+ struct cu *cu = zalloc(sizeof(*cu) + build_id_len);
if (cu != NULL) {
uint32_t void_id;
--
2.38.1

View File

@ -2,13 +2,14 @@
%define libver 1
Name: dwarves
Version: 1.22
Release: 1%{?dist}
Version: 1.24
Release: 2%{?dist}
License: GPLv2
Summary: Debugging Information Manipulation Tools (pahole & friends)
URL: http://acmel.wordpress.com
Source: http://fedorapeople.org/~acme/dwarves/%{name}-%{version}.tar.xz
Requires: %{libname}%{libver} = %{version}-%{release}
Patch1: 0001-dwarves-Zero-initialize-struct-cu-in-cu__new-to-prev.patch
BuildRequires: gcc
BuildRequires: cmake >= 2.8.12
BuildRequires: zlib-devel
@ -65,6 +66,7 @@ Debugging information processing library development files.
%prep
%setup -q
%patch1 -p1
%build
%cmake -DCMAKE_BUILD_TYPE=Release .
@ -79,7 +81,8 @@ rm -Rf %{buildroot}
%files
%doc README.ctracer
%doc README.btf
%doc changes-v1.22
%doc changes-v1.23
%doc changes-v1.24
%doc NEWS
%{_bindir}/btfdiff
%{_bindir}/codiff
@ -131,6 +134,29 @@ rm -Rf %{buildroot}
%{_libdir}/%{libname}_reorganize.so
%changelog
* Wed Nov 16 2022 Viktor Malik <vmalik@redhat.com> - 1.24-2
- Backport BTF fix needed for kernel kfuncs
- Related: rhbz#2140020
* Fri Nov 04 2022 Viktor Malik <vmalik@redhat.com> - 1.24-1
- Resolves: rhbz#2140020
- New release: v1.23
- Process DW_TAG_LLVM_annotation tags.
- Initial support for DW_TAG_skeleton_unit.
- Encode BTF_KIND_TYPE_TAG and BTF_KIND_DECL_TAG
- Fix handling of percpu symbols on s390.
- Use cacheline size to infer struct member alignment from BTF.
- Add --skip_missing to not stop when not finding one of -C arguments.
- Fix __attribute__((__aligned__(N)) printing alignment for struct members.
- Fix nested __attribute__(__aligned__(N)) struct printing order.
- New release: v1.24
- Add support to BTF_KIND_ENUM64.
- Support multithreaded BTF encoding.
- Encode char type as signed in BTF.
- Introduce --lang and --lang_exclude to pahole.
- Introduce --compile to pahole.
- Don't segfault when processing bogus files.
* Wed Oct 6 2021 Jiri Olsa <jolsa@redhat.com> - 1.22-1
- New release: v1.22
- Resolves: rhbz#2010414