Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F171197438
D44306.id135613.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D44306.id135613.diff
View Options
diff --git a/sys/compat/linuxkpi/common/include/linux/module.h b/sys/compat/linuxkpi/common/include/linux/module.h
--- a/sys/compat/linuxkpi/common/include/linux/module.h
+++ b/sys/compat/linuxkpi/common/include/linux/module.h
@@ -51,7 +51,21 @@
#define MODULE_SUPPORTED_DEVICE(name)
#define MODULE_IMPORT_NS(_name)
-#define THIS_MODULE ((struct module *)0)
+/*
+ * 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 defines THIS_MODULE to be the filename casted to a struct module. This
+ * allows us to have differing pointers for every "owner", and we can rely on
+ * the module stubs to never dereference these pointers.
+ */
+#define THIS_MODULE ((struct module *)__FILE_NAME__)
#define __MODULE_STRING(x) __stringify(x)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Sep 10, 10:56 AM (4 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38642611
Default Alt Text
D44306.id135613.diff (1 KB)
Attached To
Mode
D44306: linuxkpi: Provide a non-NULL value for THIS_MODULE
Attached
Detach File
Event Timeline
Log In to Comment