Fix ET_DYN vmlinux namespace support

Signed-off-by: Čestmír Kalina <ckalina@redhat.com>
This commit is contained in:
Čestmír Kalina 2022-01-30 23:15:20 +01:00
parent 0f7f085098
commit e0cca855e9
2 changed files with 46 additions and 1 deletions

35
fix-ns-on-ET_DYN.patch Normal file
View File

@ -0,0 +1,35 @@
--- kabi-dw-973fee0f575cc530347bac7f906e7967d4399735.orig/ksymtab.c 2022-01-10 16:09:27.000000000 +0100
+++ kabi-dw-973fee0f575cc530347bac7f906e7967d4399735.new/ksymtab.c 2022-01-31 17:34:13.122000000 +0100
@@ -155,6 +155,20 @@
goto out;
}
+ switch (ehdr->e_type) {
+ case ET_EXEC:
+ case ET_DYN:
+ case ET_REL:
+ break;
+ default:
+ printf("Unsupported object filetype of %s: %d\n", filename,
+ ehdr->e_type);
+ free(ehdr);
+ (void) elf_end(elf);
+ (void) close(fd);
+ goto out;
+ }
+
/*
* Get section index of the string table associated with the section
* headers in the ELF file.
@@ -427,7 +441,10 @@
name += strlen(STRTAB_NS_PREFIX);
ns = (char *) ctx->ksymtab_raw;
- ns += (ctx->e_type == ET_EXEC) ? value - ctx->sh_addr : value;
+ if (ctx->e_type == ET_EXEC || ctx->e_type == ET_DYN)
+ ns += value - ctx->sh_addr;
+ else if (ctx->e_type == ET_REL)
+ ns += value;
if (!strlen(ns))
return;

View File

@ -7,11 +7,12 @@
Name: kabi-dw
Version: 0
Release: 0.23%{?dist}
Release: 0.24%{?dist}
Summary: Detect changes in the ABI between kernel builds
License: GPLv3+
URL: %{forgeurl}
Source0: %{forgesource}
Patch0: fix-ns-on-ET_DYN.patch
BuildRequires: elfutils-devel
BuildRequires: gcc
@ -29,6 +30,7 @@ later comparing the text files.
%prep
%forgesetup
%patch0 -p1
%build
LDFLAGS+=" -pie "
@ -49,6 +51,14 @@ install -m 0755 %{name} %{buildroot}%{_bindir}/
%license COPYING
%changelog
* Tue Jan 18 2022 Cestmir Kalina <ckalina@redhat.com> - 0.24
- Fix annocheck failures
- Fix osci tier0 test reference
- Fix ET_DYN vmlinux namespace support
- Resolves: rhbz#2038913
- Resolves: rhbz#2045976
- Resolves: rhbz#2038892
* Mon Jan 10 2022 Cestmir Kalina <ckalina@redhat.com> - 0.23
- Add support for ET_EXEC
- Add support for DW_TAG_restrict_type