HomeFreeBSD

linuxkpi: Provide a non-NULL value for THIS_MODULE

Description

linuxkpi: Provide a non-NULL value for THIS_MODULE

THIS_MODULE is used to differentiate modules on Linux. We currently
completely stub out any Linux struct module usage, but THIS_MODULE
is still used to populate the "owner" fields of various drivers.
Even though we don't actually dereference these "owner" fields they
are still used by drivers to check if devices/dmabufs/etc come
from different modules. For example, during DRM GEM import some
drivers check if the dmabuf's owner matches the dev's owner. If
they match because they are both NULL drivers may incorrectly think
two resources come from the same module.

This adds a general purpose __this_linker_file which will point to
the linker file of the module that uses it. We can then use that
pointer to have a valid value for THIS_MODULE.

Reviewed by: bz, jhb
Differential Revision: https://reviews.freebsd.org/D44306

Details

Provenance
ashafer_badland.ioAuthored on Mar 6 2024, 5:48 PM
jhbCommitted on Thu, May 16, 5:36 PM
Reviewer
bz
Differential Revision
D44306: linuxkpi: Provide a non-NULL value for THIS_MODULE
Parents
rG65fd76b5f566: makeman: extend duplicate option warning to OPT_ options
Branches
Unknown
Tags
Unknown