From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-x92e.google.com (mail-ua1-x92e.google.com [IPv6:2607:f8b0:4864:20::92e]) by sourceware.org (Postfix) with ESMTPS id A5C463858D20 for ; Mon, 7 Feb 2022 15:34:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A5C463858D20 Received: by mail-ua1-x92e.google.com with SMTP id 60so23407363uae.1 for ; Mon, 07 Feb 2022 07:34:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YfIevltDzDlPMgA1fZC/AkNciDUvLLggQHBVtU0igcw=; b=gCdpvBLO8K4/laZwJOSmBXcUVJYHaGWYGXWmnYvI7wtFJDRaiVOSeBC/CZbb88emm5 TkIL/+jFl2j8JNcsFhiWnDV/3zP09FK0DnR04EmQxNwbaffEaRppyXfkwERulIEpLGLw l71c2yhkohwB3SzcZd4mvOzblDEd91XLP0Og0+Ix+YN/2dMCCyB70IqfYVGU+toYFcVK p5zydBrVoJc8aqjRpWzeq8PsW/wrsAOC55XuFV0GvkSR6i6Ic8tn1PftYc16ppEXmzhu jMqbKAMVlSzqbysNrhJfGsz4oLLLNP4lx5uAyVoE5dQg/RgucQdE7u+nwhAMNEXpfYJy z9FQ== X-Gm-Message-State: AOAM531miqhXQ0lFu2rwl9jLYBHA0O+snom29IgvSNBs6zjmcYtAQoc8 PW5hGeCUh50MNdDCOkn9FG5M0Uoag7fFPfZOHF3GtA== X-Google-Smtp-Source: ABdhPJy7rhAscsjdiDS1JSwEXzV8CZpZACLRbQLicv35b2wy7CHhA5F591heXNkLNBuTHcP+9FTVL1ws1aS5RdPSdCw= X-Received: by 2002:a67:e09e:: with SMTP id f30mr4691419vsl.16.1644248050078; Mon, 07 Feb 2022 07:34:10 -0800 (PST) MIME-Version: 1.0 References: <87v8xrlyyd.fsf@redhat.com> <87r18flypy.fsf@seketeli.org> In-Reply-To: <87r18flypy.fsf@seketeli.org> From: Giuliano Procida Date: Mon, 7 Feb 2022 15:33:33 +0000 Message-ID: Subject: Re: [PATCH 1/2] symtab-reader: Remove an over-agressive assertion To: Dodji Seketeli Cc: libabigail@sourceware.org, maennich@google.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-27.7 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Feb 2022 15:34:15 -0000 Hi. On Mon, 7 Feb 2022 at 11:10, Dodji Seketeli wrote: > > > In symtab::load, the symtab reader walks the symbol table and records > each relation "symbol <-> address". > So, the relation "foo <-> address-of-foo" is going to be recorded. > The relation "foo.cfi <-> address-of-foo.cfi" is going to be recorded > as well. > > But then, because the symbol foo.cfi has a special meaning, in the > realm of "control flow integrity", the relation "foo.cfi <-> > address-of-foo.cfi" (as well as all the *.cfi <-> address-of*.cfi > relations) is going to be recorded (again but) in a particular way by > calling symtab::add_alternative_address_lookups. > > The problem is that in, symtab::add_alternative_address_lookups there > is an assert that (wrongly) assumes that the relation foo.cfi <-> > address-of-foo.cfi is being seen for the first time. This is wrong > because the loop in symtab::load that records all the "symbol <-> > address" relations has seen and recorded this foo.cfi <-> > address-of-foo.cfi relation once already. > > This patch removes that assert so that the kernel referred to in the bug > report of PR26646, as mentioned in > https://sourceware.org/bugzilla/show_bug.cgi?id=26646#c5, can be > processed by abidw without crashing. > > * src/abg-symtab-reader.cc > (symtab::add_alternative_address_lookups): Remove over-aggressive > assert. > > Signed-off-by: Dodji Seketeli Reviewed-by: Giuliano Procida I didn't see a better solution and you've written up a proper analysis in the commit message. Thanks! Giuliano. > --- > src/abg-symtab-reader.cc | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/src/abg-symtab-reader.cc b/src/abg-symtab-reader.cc > index 78dec36d..b42ce87d 100644 > --- a/src/abg-symtab-reader.cc > +++ b/src/abg-symtab-reader.cc > @@ -651,9 +651,7 @@ symtab::add_alternative_address_lookups(Elf* elf_handle) > symbol_sptr); > } > > - const auto result = > - addr_symbol_map_.emplace(symbol_value, symbol_sptr); > - ABG_ASSERT(result.second); > + addr_symbol_map_.emplace(symbol_value, symbol_sptr); > } > } > } > -- > 2.35.0.rc2 > > > > -- > Dodji >