sane-project-website/old-archive/1999-08/0146.html

102 wiersze
4.6 KiB
HTML
Czysty Zwykły widok Historia

<!-- received="Sat Aug 14 09:48:00 1999 PDT" -->
<!-- sent="Sat, 14 Aug 1999 18:51:10 +0200" -->
<!-- name="Andreas Beck" -->
<!-- email="becka@rz.uni-duesseldorf.de" -->
<!-- subject="SG_BIG_BUFF, glibc 2.1 weirdness ..." -->
<!-- id="" -->
<!-- inreplyto="" -->
<title>sane-devel: SG_BIG_BUFF, glibc 2.1 weirdness ...</title>
<h1>SG_BIG_BUFF, glibc 2.1 weirdness ...</h1>
<b>Andreas Beck</b> (<a href="mailto:becka@rz.uni-duesseldorf.de"><i>becka@rz.uni-duesseldorf.de</i></a>)<br>
<i>Sat, 14 Aug 1999 18:51:10 +0200</i>
<p>
<ul>
<li> <b>Messages sorted by:</b> <a href="date.html#146">[ date ]</a><a href="index.html#146">[ thread ]</a><a href="subject.html#146">[ subject ]</a><a href="author.html#146">[ author ]</a>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0147.html">Stephen Williams: "Re: [Fwd: Re: Discussion about SANE and TWAIN...]"</a>
<li> <b>Previous message:</b> <a href="0145.html">Tom Martone: "Re: [Fwd: Re: Discussion about SANE and TWAIN...]"</a>
<!-- nextthread="start" -->
<!-- reply="end" -->
</ul>
<!-- body="start" -->
Hi folks. I just went almost mad tracking a very strange problem with sane<br>
1.0.0, kernel 2.2.5 and glibc 2.1. I do not know, if it is fixed in 1.0.1. <br>
If so, please disregard this mail.<br>
<p>
O.K. - the problem is as follows:<br>
<p>
I wanted to increase SG_BIG_BUFF to get less scanner stops and thus increase<br>
throughput.<br>
<p>
Error #1: I had been told, that 256k were safe. This is correct, but only<br>
for Linux/alpha. The correct boundary is 32*PAGE_SIZE, wich is 4k*32=128k<br>
for Intel, but 8k*32=256k for Alpha.<br>
<p>
We should put that information in a README within SANE, not in the<br>
sg-readme, which is pretty obscure to find.<br>
<p>
The symptom of that is, that the backends quit with "out of memory", if you<br>
go above the treshold given.<br>
<p>
Error #2: If you compile the SCSI generic support as a module, the /proc<br>
entry does not get created, causing sane not to recognize the larger value.<br>
<p>
Now the big one that made me pull my hair:<br>
<p>
Glibc installs its _own_ scsi.h and sg.h, which are different from the<br>
kernel. Thus is you only edit sg.h from the Linux subdirectory you get very<br>
very weird behaviour:<br>
<p>
SANE recognizes the bigger buffer and the backends request the larger<br>
blocks. However the allocated interim buffer in sanei_scsi.c is still<br>
allocated with SG_BIG_BUFF in size. This causes a massive buffer overflow,<br>
which in my case always resulted in a strange abnormal termination of <br>
sanei_scsi_req_wait(), that caused the reader process to think it read 0<br>
bytes and thus it stoped and resetted the scanner.<br>
<p>
O.K. - what should we do about it ?<br>
<p>
1. From 2.2.6 upwards, we have a new sg driver, which needs different<br>
handling of buffer size management anyway. Thus the linux SCSI layer needs<br>
a service interval anyway.<br>
<p>
2. For the lower kernels, we should at least detect the abovementined<br>
problem. Silently allowing to overflow internal buffers is rarely a good<br>
idea. We should at least check, if the allocated buffer is big enough <br>
for the transfer to work. If it isn't, abort with a clear error message.<br>
<p>
IMHO we should even go one step further and stop using the statically<br>
allocated data array, and rather use a dynamically allocated one, which<br>
could use the dynamically found sanei_scsi_max_request_size.<br>
<p>
Who maintains that file ? Still David ?<br>
<p>
I'd volunteer to help on the coding, but I'll at least need a coauthor that<br>
is willing to run 2.1.6 or above and take care for the support of the new <br>
kernel sg driver code.<br>
(The machine I run SANE on is a critical server, which needs proper ISDN<br>
support, which is why I am reluctant to upgrade the kernel. I had lots and<br>
lots of very strange problems with it the last time, and I don't feel like <br>
searching for a working snapshot of the isdn subtree for another week.)<br>
<p>
CU, Andy<br>
<p>
<pre>
--
= Andreas Beck | Email : &lt;<a href="mailto:andreas.beck@ggi-project.org">andreas.beck@ggi-project.org</a>&gt; =
<p>
<pre>
--
Source code, list archive, and docs: <a href="http://www.mostang.com/sane/">http://www.mostang.com/sane/</a>
To unsubscribe: echo unsubscribe sane-devel | mail <a href="mailto:majordomo@mostang.com">majordomo@mostang.com</a>
</pre>
<!-- body="end" -->
<p>
<ul>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0147.html">Stephen Williams: "Re: [Fwd: Re: Discussion about SANE and TWAIN...]"</a>
<li> <b>Previous message:</b> <a href="0145.html">Tom Martone: "Re: [Fwd: Re: Discussion about SANE and TWAIN...]"</a>
<!-- nextthread="start" -->
<!-- reply="end" -->
</ul>