Page MenuHomeFreeBSD

D44306.id136478.diff
No OneTemporary

D44306.id136478.diff

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,23 @@
#define MODULE_SUPPORTED_DEVICE(name)
#define MODULE_IMPORT_NS(_name)
+/*
+ * 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.
+ *
+ * For these reasons drm-kmod may specify THIS_MODULE and set up a value
+ * for it through its own module macros. If that is not the case, we can
+ * declare it as NULL here.
+ */
+#if !defined(THIS_MODULE)
#define THIS_MODULE ((struct module *)0)
+#endif
#define __MODULE_STRING(x) __stringify(x)

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 27, 4:20 AM (12 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27297382
Default Alt Text
D44306.id136478.diff (1 KB)

Event Timeline