From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 67862 invoked by alias); 9 Aug 2019 16:01:50 -0000 Mailing-List: contact libabigail-help@sourceware.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Id: List-Subscribe: Sender: libabigail-owner@sourceware.org Received: (qmail 67631 invoked by uid 89); 9 Aug 2019 16:01:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.3 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-18.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_1,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 spammy=appreciated!, hello! X-Spam-Status: No, score=-18.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_1,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sourceware.org X-Spam-Level: X-HELO: mail.kernel.org Received: from mail.kernel.org (HELO mail.kernel.org) (198.145.29.99) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 09 Aug 2019 16:01:49 +0000 Received: from linux-8ccs (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B5B2A2089E; Fri, 9 Aug 2019 16:01:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565366507; bh=TiC/RHznaVgKPX6vDmD9zyNemiJoTnrwkY6cN/TwHtY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=evizNTJGcrgytMv6deTQ4Rccahgplbw+tFFSCgaejZ3qCnIJk/1zqY7iDS+GF5Bsn MrXls+U+xWqKdmB+tOHdezfnC6u/KiP6gz2pRq6icB8C3J/s+l+5JREEofKO57rbE/ 4jgjclp4BdcAemPGa/iH3atW59xWufzDcJmTgxw4= Date: Tue, 01 Jan 2019 00:00:00 -0000 From: Jessica Yu To: libabigail@sourceware.org Cc: Dodji Seketeli , Matthias Maennich Subject: Re: [RFC PATCH] Support pre and post v4.19 ksymtabs for Linux kernel modules Message-ID: <20190809160143.GB24473@linux-8ccs> References: <20190809154900.13751-1-jeyu@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20190809154900.13751-1-jeyu@kernel.org> X-OS: Linux linux-8ccs 4.12.14-lp150.12.28-default x86_64 User-Agent: Mutt/1.10.1 (2018-07-13) X-IsSubscribed: yes X-SW-Source: 2019-q3/txt/msg00024.txt.bz2 +++ Jessica Yu [09/08/19 17:49 +0200]: >As described in commit ad8c2531fb9, the format of the Linux kernel >ksymtab changed in v4.19 to use relative references instead of absolute >references. This changes the type of relocations emitted for ksymtab >sections to be place-relative 32-bit relocations instead of absolute >relocations. One side-effect of this is that libdwfl will not relocate >the ksymtab sections due to the PC-relative relocations. This breaks >load_kernel_symbol_table() for kernel modules because it only reads in >zeros from the unrelocated ksymtab section and is subsequently unable to >determine what exported symbols it refers to. Since a vmlinux binary is >already fully linked and relocated (and therefore we can read its >ksymtab section just fine), this problem is only relevant to Linux >kernel modules. > >To work around this, we utilize the ksymtab relocation sections to >determine which symbols the ksymtab entries refer to. We do this by >inspecting each relocation's r_info field for the symbol table index and >from there we are able to read each symbol's value and subsequently add >that to the set of exported symbols. > >In addition, for Linux kernel modules, we can utilize relocation types >to implement a new heuristic to determine the ksymtab format we have. >The presence of PC-relative relocations suggest the new v4.19 format, >and absolute relocation types suggest the old pre v4.19 format. Hello! Just a small addendum: This is my first patch to libabigail so things might be a bit rough around the edges. I'm sending this first as an RFC because not everyone might agree on the general approach and it may need to be reworked. Testing is greatly appreciated! I will also be on vacation next week with no access to email so I won't be able to respond to comments until the following week. Thanks! Jessica