From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by sourceware.org (Postfix) with ESMTPS id F3B483851C0F for ; Fri, 1 Jul 2022 12:54:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F3B483851C0F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=seketeli.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org Received: (Authenticated sender: dodji@seketeli.org) by mail.gandi.net (Postfix) with ESMTPSA id 351C7FF80F; Fri, 1 Jul 2022 12:54:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seketeli.org; s=gm1; t=1656680094; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4n6KNjzb6LdvZ1MY2CN5mSzQ88BpiQWcdCj+fbl6lVE=; b=gvLxOp63lPVuOiCry3V46kR5EEq5imUfemFLZ1Gt0T3ZKUy/2YbpwU1ZI0A3160+2a9eVK kTEmSZ3Li14Qe7L7jZkEmYvfwRT27aTi6XK81otiIcSI6TU8g2ZaE/TVm2UPsD7hanZXdR L0iaUXgMJRMsb/WRofFVksQYIg/KCjIURvWdGjtrNS5HlynkzxsoraCfQQJiYaKKRDFC6b QEoA2BTqDuKeLTjczGnsU47j4ruWO2v78wODd8Gij0fuhB0TPDfGV2xpSkk1qaPa3EUhFd velNtzOwqvZiEUvjfQezrAPMosxmKxByGxDXoXHKeeoBtsJEPt0Vl0vgEK/2MA== Received: by localhost (Postfix, from userid 1000) id 5C674581C3B; Fri, 1 Jul 2022 14:54:53 +0200 (CEST) From: Dodji Seketeli To: Giuliano Procida Cc: libabigail@sourceware.org, kernel-team@android.com, maennich@google.com Subject: Re: [PATCH v5 4/4] add Linux kernel symbol namespace support Organization: Me, myself and I References: <20220321160221.1372398-1-gprocida@google.com> <20220613142533.3676501-5-gprocida@google.com> X-Operating-System: Fedora 37 X-URL: http://www.seketeli.net/~dodji Date: Fri, 01 Jul 2022 14:54:53 +0200 In-Reply-To: <20220613142533.3676501-5-gprocida@google.com> (Giuliano Procida's message of "Mon, 13 Jun 2022 15:25:33 +0100") Message-ID: <87pmipc7s2.fsf@seketeli.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Fri, 01 Jul 2022 12:54:57 -0000 Hello, Giuliano Procida a =C3=A9crit: > Bug 28954 - add Linux Kernel symbol namespace support > > Each Linux kernel symbol can be exported to a specified named > namespace or left in the global (nameless) namespace. > > One complexity is that the symbol values which identify a string in > the __ksymtab_strings section must be interpretated differently for > vmlinux and .ko loadable modules as the former has a fixed load > address but the latter are relocatable. For vmlinux, the section base > address needs to be subtracted to obtain a section-relative offset. > > The global namespace is explicitly represented as the empty string, at > least when it comes to the value of __kstrtabns_FOO symbols, but the > common interpretation is that such symbols lack an export namespace. > > I would rather not have to make use of "empty implies missing" in many > places, so the code here represents namespace as optional and > only the symtab reader cares about empty strings in __ksymtab_strings. > > * include/abg-ir.h (elf_symbol::elf_symbol): Add ns argument. > (elf_symbol::create): Add ns argument. > (elf_symbol::get_namespace): Declare new function. > (elf_symbol::set_namespace): Declare new function. > and set_namespace. > * src/abg-comp-filter.cc (namespace_changed): Define new > helper functions. > (categorize_harmful_diff_node): Also call namespace_changed(). > * src/abg-ir.cc (elf_symbol::priv): Add namespace_ member. > (elf_symbol::priv::priv): Add namespace_ to initialisers. > (elf_symbol::elf_symbol): Take new ns argument and pass it to > priv constructor. > (elf_symbol::create): Take new ns argument and pass it to > elf_symbol constructor. > (elf_symbol::get_namespace): Define new function. > (elf_symbol::set_namespace): Define new function. > * src/abg-reader.cc (build_elf_symbol): If namespace > attribute is present, set symbol namespace. > * src/abg-reporter-priv.cc (maybe_report_diff_for_symbol): If > symbol namespaces differ, report this. > * src/abg-symtab-reader.cc (symtab::load): Get ELF header to > distinguish vmlinux from .ko. Try to get __ksymtab_strings > metadata and data. Use these to look up __kstrtabns_FOO > namespace entries. Set symbol namespace where found. > * src/abg-writer.cc (write_elf_symbol): Emit namespace > attribute, if symbol has a namespace. > * tests/data/Makefile.am: Add new test files. > * tests/data/test-abidiff/test-namespace-0.xml: New test file. > * tests/data/test-abidiff/test-namespace-1.xml: Likewise > * tests/data/test-abidiff/test-namespace-report.txt: Likewise. > * tests/test-abidiff.cc: Add new test case. > > Reviewed-by: Matthias Maennich > Signed-off-by: Giuliano Procida Applied to master, thanks! [...] Cheers, --=20 Dodji