Browse Source

When using remote includes with certain setups, one could get weird

rehash errors such as error: set::geoip-classic::ipv6-database:
cannot open file "/home/xxxx/unrealircd/data/https://www.unrealircd...
and possibly even a crash.
The initial boot of UnrealIRCd, however, was always fine, this only
happened when rehashing.
It also seemed to occur more with ftp:// includes or at least with
multiple parallel includes, that may or may not have different or
more latency. In any case it seemed to affect some remote includes
setups semi-consistently, and others not at all.

The root cause was a complex code path causing a read-after-free.
We now use a simplified code path which can no longer cause this.
The only downside is that rehashing may be delayed up to an extra
250ms (quarter of a second), but that should hardly be noticeable,
if at all.

Issue reported by Bun-Bun.
pull/44/head
Bram Matthys 10 months ago
parent
commit
e0cfbe5821
No known key found for this signature in database
GPG Key ID: BF8116B163EAAE98
  1. 1
      include/h.h
  2. 7
      src/conf.c
  3. 3
      src/ircd.c

1
include/h.h

@ -518,6 +518,7 @@ extern int channel_canjoin(Client *client, const char *name);
extern char *collapse(char *pattern);
extern void dcc_sync(Client *client);
extern void request_rehash(Client *client);
extern int rehash_internal(Client *client);
extern void s_die();
extern int match_simple(const char *mask, const char *name);
extern int match_esc(const char *mask, const char *name);

7
src/conf.c

@ -10638,13 +10638,6 @@ void resource_download_complete(const char *url, const char *file, const char *e
safe_strdup(wce->ce->value, rs->file); // now information of url is lost, hm!!
}
}
/* If rehashing, check if we are done.
* If booting (not rehashing), this is done from the
* startup loop where it also checks is_config_read_finished().
*/
if (loop.rehashing && is_config_read_finished())
rehash_internal(loop.rehash_save_client);
}
/** Request to REHASH the configuration file.

3
src/ircd.c

@ -914,6 +914,9 @@ void SocketLoop(void *dummy)
reinit_tls();
doreloadcert = 0;
}
/* If rehashing, check if we are done. */
if (loop.rehashing && is_config_read_finished())
rehash_internal(loop.rehash_save_client);
}
}

Loading…
Cancel
Save