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.
This commit is contained in:
Bram Matthys 2022-01-31 08:20:42 +01:00
parent 8fe44698df
commit e0cfbe5821
No known key found for this signature in database
GPG key ID: BF8116B163EAAE98
3 changed files with 4 additions and 7 deletions
include
src

View file

@ -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);

View file

@ -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.

View file

@ -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);
}
}