Re: WARNING: [xtensa] modpost: vmlinux: section mismatch in reference: ice_adv_lnk_speed_maps+0x14 (section: .data) -> __setup_str_initcall_blacklist (section: .init.rodata)
From: Max Filippov
Date: Fri Dec 06 2024 - 07:51:55 EST
On Wed, Dec 4, 2024 at 3:05 PM Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
>
> On Fri, Aug 23, 2024 at 11:41:17PM -0700, Max Filippov wrote:
>
> > static struct ethtool_forced_speed_map ice_adv_lnk_speed_maps[]
> > __ro_after_init = {
> > ETHTOOL_FORCED_SPEED_MAP(ice_adv_lnk_speed, 100),
> >
> > that array goes into the .data,
>
> ... due to
>
> #define __ro_after_init __read_mostly
>
> in your asm/cache.h,
Oh, the trail leads back to me (:
> instead of the usual .data..ro_after_init,
> which would be enough for modpost to assume that driver knows
> what it's doing and won't access the dangling pointers to
> .init.rodata in there after the initmem had been freed.
>
> The same goes for qed and the same thing happens on openrisc,
> for exact same reason.
>
> While we are at it, that might as well had been
> #define __ro_after_init
> since __read_mostly is not defined on xtensa and default is empty.
>
> If you don't want that stuff to go into RODATA, why not
> simply define an empty RO_AFTER_INIT_DATA in your vmlinux.lds
> and put those sections explicitly there, along with the data ones,
> as e.g. s390 does? Or arch/arm/kernel/vmlinux-xip.lds.S,
> for that matter...
I'll do that, thanks for digging into it.
--
Thanks.
-- Max