[bug] possible bug in the range filter
Manlio Perillo
manlio_perillo at libero.it
Wed Dec 12 17:39:36 MSK 2007
Igor Sysoev ha scritto:
> [...]
>>
>>> It seems that your module and nginx did not touch this memory, so the value
>>> was passed to kernel and it saw its invalidity.
>>>
The problem was with these lines of code in the range filter:
if (ngx_buf_in_memory(buf)) {
buf->pos = buf->start + (size_t) range->start;
buf->last = buf->start + (size_t) range->end;
}
In mod_wsgi I forgot to set buf->start (and buf->end, too), so its value
is 0 :-).
>> Right, but why returning EFAULT instead of raising a SIGSEG?
>>
>> Moreover:
>> http://www.gnu.org/software/libc/manual/html_node/Error-Codes.html
>>
>> Macro: int EFAULT
>>
>> Bad address; an invalid pointer was detected. In the GNU system,
>> this error never happens; you get a signal instead.
>>
>>
>> But certainly I'm missing something ;-).
>
> I never saw SIGSEG in this case on FreeBSD.
>
>
Its strange that, within glibc-2.0.1 sources I get
$grep -rw EFAULT .
./sysdeps/mach/hurd/errnos.h: EFAULT = _HURD_ERRNO (14),
./sysdeps/mach/hurd/errnos.h:#define EFAULT _HURD_ERRNO
(14)/* Bad address */
./sysdeps/gnu/errlist.c:#ifdef EFAULT
./sysdeps/gnu/errlist.c: [EFAULT] = N_("Bad address"),
./sysdeps/unix/bsd/bsd4.4/errnos.h:#define EFAULT 14
/* Bad address */
So it seems that the gnu libc does not define EFAULT for Linux.
But I'm not sure of what "GNU system" means.
Regards Manlio Perillo
More information about the nginx
mailing list