Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package dwarves for openSUSE:Factory checked 
in at 2021-06-05 23:30:56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/dwarves (Old)
 and      /work/SRC/openSUSE:Factory/.dwarves.new.1898 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "dwarves"

Sat Jun  5 23:30:56 2021 rev:30 rq:896653 version:1.21

Changes:
--------
--- /work/SRC/openSUSE:Factory/dwarves/dwarves.changes  2021-05-07 
16:44:52.064475272 +0200
+++ /work/SRC/openSUSE:Factory/.dwarves.new.1898/dwarves.changes        
2021-06-05 23:31:21.052419058 +0200
@@ -1,0 +2,6 @@
+Tue Jun  1 10:28:25 UTC 2021 - Michal Suchanek <[email protected]>
+
+- Handle zero sized per-cpu veriables in Linux BTF.
+  + 
btf_encoder-fix-and-complete-filtering-out-zero-sized-per-CPU-variables.patch
+
+-------------------------------------------------------------------

New:
----
  btf_encoder-fix-and-complete-filtering-out-zero-sized-per-CPU-variables.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ dwarves.spec ++++++
--- /var/tmp/diff_new_pack.CoYETy/_old  2021-06-05 23:31:21.640420081 +0200
+++ /var/tmp/diff_new_pack.CoYETy/_new  2021-06-05 23:31:21.644420088 +0200
@@ -29,6 +29,7 @@
 Source2:        
https://fedorapeople.org/~acme/dwarves/dwarves-%version.tar.sign
 Source9:        baselibs.conf
 Patch0:         remove-ftrace-filter.patch
+Patch1:         
btf_encoder-fix-and-complete-filtering-out-zero-sized-per-CPU-variables.patch
 BuildRequires:  cmake
 BuildRequires:  libdw-devel >= 0.171
 %if 0%{?suse_version} < 1550

++++++ 
btf_encoder-fix-and-complete-filtering-out-zero-sized-per-CPU-variables.patch 
++++++
>From 0d17503db0580a6635d103fed030724b38ba1364 Mon Sep 17 00:00:00 2001
From: Andrii Nakryiko <[email protected]>
Date: Mon, 24 May 2021 16:42:22 -0700
Subject: [PATCH] btf_encoder: fix and complete filtering out zero-sized
 per-CPU variables
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Upstram: accepted - expected version 1.22
Git-commit: 0d17503db0580a6635d103fed030724b38ba1364

btf_encoder is ignoring zero-sized per-CPU ELF symbols, but the same has to be
done for DWARF variables when matching them with ELF symbols. This is due to
zero-sized DWARF variables matching unrelated (non-zero-sized) variable that
happens to be allocated at the exact same address, leading to a lot of
confusion in BTF.

See [0] for when this causes big problems.

  [0] 
https://lore.kernel.org/bpf/CAEf4BzZ0-sihSL-UAm21JcaCCY92CqfNxycHRZYXcoj8OYb=w...@mail.gmail.com/

Committer notes:

Kept the {} around the if block with more than one line, which
simplifies the original patch by just removing that assignment
to the 'dwarf_name' variable.

Reported-by: Michal Such??nek <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
 btf_encoder.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/btf_encoder.c b/btf_encoder.c
index c711f12..033c927 100644
--- a/btf_encoder.c
+++ b/btf_encoder.c
@@ -538,6 +538,7 @@ int cu__encode_btf(struct cu *cu, int verbose, bool force,
        cu__for_each_variable(cu, core_id, pos) {
                uint32_t size, type, linkage;
                const char *name, *dwarf_name;
+               const struct tag *tag;
                uint64_t addr;
                int id;
 
@@ -550,6 +551,7 @@ int cu__encode_btf(struct cu *cu, int verbose, bool force,
 
                /* addr has to be recorded before we follow spec */
                addr = var->ip.addr;
+               dwarf_name = variable__name(var, cu);
 
                /* DWARF takes into account .data..percpu section offset
                 * within its segment, which for vmlinux is 0, but for kernel
@@ -583,7 +585,6 @@ int cu__encode_btf(struct cu *cu, int verbose, bool force,
                 *  per-CPU symbols have non-zero values.
                 */
                if (var->ip.addr == 0) {
-                       dwarf_name = variable__name(var, cu);
                        if (!dwarf_name || strcmp(dwarf_name, name))
                                continue;
                }
@@ -600,6 +601,13 @@ int cu__encode_btf(struct cu *cu, int verbose, bool force,
                        break;
                }
 
+               tag = cu__type(cu, var->ip.tag.type);
+               if (tag__size(tag, cu) == 0) {
+                       if (btf_elf__verbose)
+                               fprintf(stderr, "Ignoring zero-sized per-CPU 
variable '%s'...\n", dwarf_name ?: "<missing name>");
+                       continue;
+               }
+
                type = var->ip.tag.type + type_id_off;
                linkage = var->external ? BTF_VAR_GLOBAL_ALLOCATED : 
BTF_VAR_STATIC;
 
-- 
2.31.1

Reply via email to