Patch for mmap problem in KConfigBackEnd, Bug #72586
Dr. Juergen Pfennig
info at j-pfennig.de
Thu Jan 15 13:20:16 GMT 2004
Hello whoever,
I send you a patch to avoid that Konqueror hangs and Syslogd quickly fills
your harddisk with error messages. The problem occurs with mmap() and files
that are accessed via smb (or nfs) and are not accessible due to ownership
and protection on the server side. See the remark concerning nfs in 'man 2
access'. Typically the problem shows up with konqueror and the .directory
file. Lots of lines containing just the work "SIGBUS" are written to stderr
and konqueror hangs.
About the current implementation in kconfigbackend.cpp: mmap() is used always
to read conf files. Interrestingly the author was aware of a SIGBUS problem
and tried to recover from the SIGBUS. BUT THIS DOES NOT WORK. Maybe it never
worked? Or maybe it's a compiler optimization problem.
About the patch: as mmap() may return unaccessible memory, the use of mmap is
restricted now to large files. In any case a classical read() syscall is used
either to read an entiere small conf file, or to probe if the (large) file is
readable. If the read succeeds for a large file, mmap is used as before. mmap
is not trivial for the kernel, maybe this patch also gives a little speed
improvement. The patch is against today's HEAD (3.1.94 plus updates).
I also attach a little test program that can be used to play with access() and
mmap() if you don't trust me. My kernel is a 2.4.21 from Mantel/SuSE. I am
using a P4 and the problem occurred also in older Versions of KDE.
Yours Jürgen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jpf.patch
Type: text/x-diff
Size: 2996 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20040115/55f5d0a2/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smbproblem.cpp
Type: text/x-c++src
Size: 1323 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20040115/55f5d0a2/attachment.cpp>
More information about the kde-core-devel
mailing list