Re: [PATCH v4 02/21] kallsyms: Export kallsyms_lookup_name

Mukesh Ojha
2023-06-28T15:23:37Z

On 6/28/2023 7:23 PM, Pavan Kondeti wrote:
> On Wed, Jun 28, 2023 at 06:04:29PM +0530, Mukesh Ojha wrote:
>> Module like minidump providing debugging support will need to
>> get the symbol information from the core kernel e.g to get
>> the linux_banner, kernel section addresses bss, data, ro etc.
>>
> One might ask why we would need such a debug driver to
> be compiled as module? What would you do if we need to capture more
> kernel data structures later? Do you plan to continue use
> kallsyms_lookup_name() to query all the symbols?

You are on point, i needed this driver to be static but i don't have
any example at present to collect more than just _linux_banner_ from
my existing set of patches..

Agree, it will be easier to make this driver as static instead of
opening up the doors for modules to abuse via exporting
kallsyms_lookup_name() and also it will be very slow for production
kernel uses.

>
> I have seen v3 discussion where you are asked to compile this driver
> as module but that time there was no reason why your driver needs to
> be compiled as statically, now you have a reason (linux_banner) for
> it.

Yes, at present minidump driver will not be able to compile without
exporting kallsyms_lookup_name()

-Mukesh

>
>> commit 0bd476e6c671 ("kallsyms: unexport kallsyms_lookup_name()
>> and kallsyms_on_each_symbol()") unexports kallsyms_lookup_name
>> due to lack of in-tree user of the symbol. Now, that minidump
>> will one of its user, export it.
>>
>> Signed-off-by: Mukesh Ojha <quic_mojha@quicinc.com>
>
> Thanks,
> Pavan