Patch to not fork/exec xkbcomp on X Server initialization

Paulo Cesar Pereira de Andrade pcpa at mandriva.com.br
Tue Jul 1 10:05:11 PDT 2008


  Hi,

  I talked with Peter Hutterer in the weekend about a patch I was working
on, to not fork/exec xkbcomp.

  I worked on it, because after some profiling, it seems xkb initialization
takes around 60% of the time required to start the X Server.  Initially I
wrote it as an optional patch for server 1.4 branch, but yesterday I rewrote
it almost from scratch, to not be optional and also adapted it to git 
master.

  I changed it to not conditional because the involved code is somewhat
of a mess already :-), but the fact that it fallbacks to /tmp to create
the xkbcomp output is a security risk, as it probably will be doing it
as root, and not only would it follow symlinks, it would also remove the
symlink after possibly making some damage, leaving no trace of what was
wrong...

  I am posting it for review as there may exist yet problems. I ran with
a 1.4 server and a git-master server and it appears to be correct, but
may be it will not work correctly with multiple input devices, etc.

  Also, the code for invocation of xkbcomp from xkb/ddxList.c probably 
should
be removed, as xkeyboard-config installation should take care of installing
the *.dir files, and the X Server should really just fail to initialize
xkb if those files don't exist.

  There is still a lot of parsing done by the xkb code, that allocates
like 6k strings, and does significantly more realloc's, that maybe could
somehow be optimized to read "compiled" data from the disk, so that
xkb would not be anymore the culprit of most slow X Server initializations.

Paulo

-------------- next part --------------
A non-text attachment was scrubbed...
Name: server-1.4-branch-0001-Don-t-fork-exec-xkbcomp-if-a-cache-file-exists.patch
Type: text/x-patch
Size: 22947 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg/attachments/20080701/2db3d268/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: master-0001-Don-t-fork-exec-xkbcomp-if-a-cache-file-exists.patch
Type: text/x-patch
Size: 18454 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg/attachments/20080701/2db3d268/attachment-0001.bin>


More information about the xorg mailing list