From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F89CC35DE1 for ; Tue, 25 Feb 2020 12:11:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1E2112084E for ; Tue, 25 Feb 2020 12:11:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729444AbgBYMLa (ORCPT ); Tue, 25 Feb 2020 07:11:30 -0500 Received: from mx2.suse.de ([195.135.220.15]:44374 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729033AbgBYMLa (ORCPT ); Tue, 25 Feb 2020 07:11:30 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id A48AFAC66; Tue, 25 Feb 2020 12:11:27 +0000 (UTC) Date: Tue, 25 Feb 2020 13:11:25 +0100 From: Petr Mladek To: Miroslav Benes Cc: Will Deacon , linux-kernel@vger.kernel.org, kernel-team@android.com, akpm@linux-foundation.org, "K . Prasad" , Thomas Gleixner , Greg Kroah-Hartman , Frederic Weisbecker , Christoph Hellwig , Quentin Perret , Alexei Starovoitov , Masami Hiramatsu , live-patching@vger.kernel.org Subject: Re: [PATCH 0/3] Unexport kallsyms_lookup_name() and kallsyms_on_each_symbol() Message-ID: <20200225121125.psvuz6e7coa77vxe@pathway.suse.cz> References: <20200221114404.14641-1-will@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170912 (1.9.0) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 2020-02-25 11:05:39, Miroslav Benes wrote: > CC live-patching ML, because this could affect many of its users... > > On Fri, 21 Feb 2020, Will Deacon wrote: > > > Hi folks, > > > > Despite having just a single modular in-tree user that I could spot, > > kallsyms_lookup_name() is exported to modules and provides a mechanism > > for out-of-tree modules to access and invoke arbitrary, non-exported > > kernel symbols when kallsyms is enabled. Just to explain how this affects livepatching users. Livepatch is a module that inludes fixed copies of functions that are buggy in the running kernel. These functions often call functions or access variables that were defined static in the original source code. There are two ways how this is currently solved. Some livepatch authors use kallsyms_lookup_name() to locate the non-exported symbols in the running kernel and then use these address in the fixed code. Another possibility is to used special relocation sections, see Documentation/livepatch/module-elf-format.rst The problem with the special relocations sections is that the support to generate them is not ready yet. The main piece would klp-convert tool. Its development is pretty slow. The last version can be found at https://lkml.kernel.org/r/20190509143859.9050-1-joe.lawrence@redhat.com I am not sure if this use case is enough to keep the symbols exported. Anyway, there are currently some out-of-tree users. Best Regards, Petr