Petar Bogdanovic <petar-+Dgt6vZh/JqsTnJN9+BGXg@...> writes:
>> > This seems to happen when two hosts connect within a very short time. I
>> > think that GeoIP_id_by_name() is called for the second host while this
>> > function is still executed for the first one. As both are operating on
>> > the same 'geoip_handle' handle, this will corrupt internal state when
>> > geoip is not reentrant.
>>
>> While looking over the code it seems that other subsystems have similar
>> issues. E.g. 'p0f' uses a shared 'p0fsock' socket in non-atomic
>> reconnect-write-read sequences. Ditto for 'spamd'.
>
> I don't understand. Why should we lock that?
In case of p0f, there is
----
static int p0fsock = -1;
int p0f_lookup(priv)
{
...
if (p0f_reconnect() != 0)
return -1;
...
if (write(p0fsock, &req ,sizeof(req)) != sizeof(req)) {
...
if (read(p0fsock, &rep, sizeof(rep)) != sizeof(rep)) {
...
}
----
p0f_lookup() is called unlocked from mlfi_connect().
DKIM (which might be also affected), calls dkim_verify() with a static
dkim_ptr.
> In case of spamd, every thread talks to a separate spamd child through
> its own socket fd..
Sorry; you are right. Spamd is ok.
EnricoMessage
Re: Segfault due to non-reentrant GeoIP?
2010-02-10 by Enrico Scholz
Attachments
- No local attachments were found for this message.