Re: [PATCH 0/3] Unexport kallsyms_lookup_name() and kallsyms_on_each_symbol()

From: Mathieu Desnoyers
Date: Mon Mar 02 2020 - 14:28:19 EST


On 21-Feb-2020 11:44:01 AM, 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.
>
> This patch series fixes up that one user and unexports the symbol along
> with kallsyms_on_each_symbol(), since that could also be abused in a
> similar manner.

Hi,

I maintain a GPL kernel tracer (LTTng) since 2005 which happens to be
out-of-tree, even though we have made unsuccessful attempts to upstream
it in the past. It uses kallsyms_lookup_name() to fetch a few symbols. I
would be very glad to have them GPL-exported upstream rather than
relying on this work-around. Here is the list of symbols we would need
to GPL-export:

stack_trace_save
stack_trace_save_user
vmalloc_sync_all (CONFIG_X86)
get_pfnblock_flags_mask
disk_name
block_class
disk_type
global_wb_domain
task_prio

In order to provide address-to-symbol mapping at trace post-processing
(for which we have a prototype branch), we would also need the "_text"
symbol to be GPL-exported, as well as the list of currently loaded
modules (LIST_HEAD(modules) or a getter function).

The tricky part is justifying having those exported for a project
which is not upstream.

I welcome advice on this matter,

Thanks,

Mathieu

--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com