Re: [RFC] module: Strict per-modname namespaces

From: Christoph Hellwig
Date: Thu Nov 07 2024 - 00:47:11 EST


On Wed, Nov 06, 2024 at 03:42:03PM -0800, Luis Chamberlain wrote:
> > This allows exports targeted at specific modules and no others -- one
> > random example included. I've hated the various kvm exports we've had
> > for a while, and strictly limiting them to the kvm module helps
> > alleviate some abuse potential.
>
> Yeah we also want:
>
> EXPORT_SYMBOL_NS_GPL(bdev_disk_changed, MODULE_loop);
> EXPORT_SYMBOL_NS_GPL(bdev_disk_changed, MODULE_dasd_kmod);
>
> But we might as well have EXPORT_SYMBOL_GPL_FOR() with the implied
> module list. We could then add just:
>
>
> EXPORT_SYMBOL_GPL_FOR(bdev_disk_changed, loop);
>
> But it would be nice to just also support this as well:
>
> EXPORT_SYMBOL_GPL_FOR(bdev_disk_changed, loop, dasd_kmod);

Parsing a variable length list in a single macro tends to be a bit
of a pain, and I don't think there is much benefit. Most of the cases
should be exactly one module. If we can cover the small uses of
multiple uses with multiple exports I think its perfectly fine, and if
we can't cover it at all I can probably live with that aswell.