PATCH Check module version each time it is loaded

Michal Suchanek hramrach at centrum.cz
Fri Oct 7 12:25:28 PDT 2011


 https://bugs.freedesktop.org/attachment.cgi?id=51585

The patch is incompatible with the dummy video driver version 0.3.4.

There is a duble-free which happens in case of an error but when fixed
it still does not work:

[1238177.911] (II) LoadModule: "dummy"
[1238177.912] (II) Loading /usr/lib/xorg/modules/drivers/dummy_drv.so
[1238177.914] (II) Module dummy: vendor="X.Org Foundation"
[1238177.914]   compiled for 1.11.0, module version = 0.3.4
[1238177.914]   Module class: X.Org Video Driver
[1238177.914]   ABI class: X.Org Video Driver, version 11.0
[1238177.919] (II) LoadModule: "void"
[1238177.924] (WW) Warning, couldn't open module void
[1238177.925] (II) UnloadModule: "void"
[1238177.925] (II) Unloading void
[1238177.927] (EE) Failed to load module "void" (module does not exist, 0)
[1238177.928] (II) DUMMY: Driver for Dummy chipsets: dummy
[1238177.932] (WW) Falling back to old probe method for dummy
[1238177.938] (II) Loading /usr/lib/xorg/modules/drivers/dummy_drv.so
[1238177.939] (II) Module dummy: vendor="X.Org Foundation"
[1238177.939]   compiled for 1.11.0, module version = 0.3.4
[1238177.939]   Module class: X.Org Video Driver
[1238177.939]   ABI class: X.Org Video Driver, version 11.0
[1238177.940] (EE) LoadModule: Module dummy SetupProc failed

Obviously, the dummy was duplicated here.

SetupProc returns NULL which causes LoaderOpen failure and returns a NULL copy.

The patched-out part of DupliceteModule would just set the
TeardownData (which is what SetupProc is supposed to return) to NULL:

-    if (!(ret->handle = LoaderOpen(mod->path, &errmaj, &errmin))) {
-        free(ret);
+    if (!doLoaderOpen(ret, mod->path, NULL, NULL, &errmaj, &errmin)) {
+        UnloadModule(ret);
         return NULL;
     }
-
-    ret->SetupProc = mod->SetupProc;
-    ret->TearDownProc = mod->TearDownProc;
-    ret->TearDownData = NULL;
     ret->child = DuplicateModule(mod->child, ret);
     ret->sib = DuplicateModule(mod->sib, parent);
     ret->parent = parent;

Is there any guarantee that the the first copy of the module which
does have the teardown data is unloaded last, though?

[1238177.940] (II) UnloadModule: "dummy"
[1238177.940] (II) Unloading dummy
[1238177.945] (WW) VGA arbiter: cannot open kernel arbiter, no
multi-card support
[1238177.953] (II) DUMMY(0): Chipset is a DUMMY
[1238177.958] (**) DUMMY(0): Depth 24, (--) framebuffer bpp 32
..
[1238178.117] (II) DUMMY(0): Modeline "320x175"x85.3   15.75  320 336
368 416  175 191 192 222 doublescan +hsync -vsync (37.9 kHz d)
[1238178.119] (==) DUMMY(0): DPI set to (96, 96)
[1238178.120] (EE) DUMMY: Failed to load module "fb" (invalid
argument(s) to LoadModule(), 0)
[1238178.125] (EE) Screen(s) found, but none have a usable configuration.

dummy tries to load submodule fb on its failed copy which is NULL.
This would lead to segfault because neither dummy nor LoadSubModule
checked that the pointer was non-NULL.

Any ideas how to resolve this?

Thanks

Michal
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Do-full-module-probe-on-every-LoaderOpen.patch
Type: text/x-patch
Size: 5684 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20111007/6b48a328/attachment-0001.bin>


More information about the xorg-devel mailing list