Current attempts to define Apache config commands via command_rec in a Rust based module are resulting in a SEGFAULT on Apache start up. Here is the backtrace:
#0 __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:96
#1 0x00007f6bc9129bee in apr_pstrdup (a=a@entry=0x7f6bc921d028, s=0x390000007c <error: Cannot access memory at address 0x390000007c>) at ./strings/apr_strings.c:77
#2 0x00005600333bcd57 in ap_add_module_commands (m=m@entry=0x7f6bc8dd2010 <TILE_MODULE>, p=p@entry=0x7f6bc921d028) at config.c:546
#3 0x00005600333be13f in ap_add_module (sym_name=, p=0x7f6bc921d028, m=0x7f6bc8dd2010 <TILE_MODULE>) at config.c:646
#4 ap_add_module (m=0x7f6bc8dd2010 <TILE_MODULE>, p=0x7f6bc921d028, sym_name=) at config.c:559
#5 0x00005600333be37d in ap_add_loaded_module (mod=mod@entry=0x7f6bc8dd2010 <TILE_MODULE>, p=, short_name=short_name@entry=0x7f6bc8e00108 "TILE_MODULE") at config.c:713
#6 0x00005600333d0a31 in load_module (cmd=0x7ffd469bab50, dummy=, modname=0x7f6bc8e00108 "TILE_MODULE", filename=0x7f6bc8e00118 "/usr/lib/apache2/modules/mod_tile_rs.so")
at mod_so.c:302
#7 0x00005600333bc605 in invoke_cmd (cmd=0x560033405ac0 <so_cmds>, parms=parms@entry=0x7ffd469bab50, mconfig=mconfig@entry=0x7ffd469baa30, args=,
args@entry=0x7f6bc8e80ea3 "TILE_MODULE /usr/lib/apache2/modules/mod_tile_rs.so") at config.c:948
#8 0x00005600333be9cb in execute_now (p=0x7ffd469baa30, ptemp=0x7ffd469baaa8, parent=, sub_tree=0x7ffd469baa30, parms=0x7ffd469bab50,
args=0x7f6bc8e80ea3 "TILE_MODULE /usr/lib/apache2/modules/mod_tile_rs.so", cmd_line=0x7f6bc8e80f68 "LoadModule") at config.c:1703
#9 ap_build_config_sub (p=p@entry=0x7f6bc921d028, temp_pool=temp_pool@entry=0x7f6bc8e7f028, l=, parms=parms@entry=0x7ffd469bab50, current=current@entry=0x7ffd469baaa0,
curr_parent=curr_parent@entry=0x7ffd469baaa8, conftree=0x7ffd469bb158) at config.c:1167
#10 0x00005600333beff5 in ap_build_config (parms=parms@entry=0x7ffd469bab50, p=p@entry=0x7f6bc921d028, temp_pool=temp_pool@entry=0x7f6bc8e7f028, conftree=conftree@entry=0x7ffd469bb158)
at config.c:1424
#11 0x00005600333bf8c5 in ap_process_resource_config (s=, fname=0x7f6bc8e7fb00 "/etc/apache2/mods-enabled/mod_tile_rs.load", conftree=0x7ffd469bb158, p=0x7f6bc921d028,
ptemp=0x7f6bc8e7f028) at config.c:1873
#12 0x000056003339ea50 in ap_dir_nofnmatch (w=w@entry=0x7ffd469bb070, fname=0x7f6bc8e7fb00 "/etc/apache2/mods-enabled/mod_tile_rs.load") at util.c:3428
#13 0x000056003339ef30 in ap_dir_fnmatch (w=w@entry=0x7ffd469bb070, path=path@entry=0x7f6bc8e7f4e0 "/etc/apache2/mods-enabled", fname=, fname@entry=0x7f6bc8e7c61a ".load")
at util.c:3510
#14 0x000056003339ed15 in ap_dir_fnmatch (w=w@entry=0x7ffd469bb070, path=0x7f6bc8e7f4e0 "/etc/apache2/mods-enabled", path@entry=0x7f6bc8e7f4c0 "/etc/apache2", fname=,
fname@entry=0x7f6bc8e7c60d "mods-enabled/.load") at util.c:3456
#15 0x000056003339ed15 in ap_dir_fnmatch (w=w@entry=0x7ffd469bb070, path=0x7f6bc8e7f4c0 "/etc/apache2", path@entry=0x7f6bc8e7f4b0 "/etc", fname=,
fname@entry=0x7f6bc8e7c605 "apache2/mods-enabled/.load") at util.c:3456
#16 0x000056003339ed15 in ap_dir_fnmatch (w=w@entry=0x7ffd469bb070, path=0x7f6bc8e7f4b0 "/etc", fname=) at util.c:3456
#17 0x00005600333bfb6f in ap_process_fnmatch_configs (s=, fname=fname@entry=0x7f6bc8e7c600 "/etc/apache2/mods-enabled/.load", conftree=conftree@entry=0x7ffd469bb158,
p=0x7f6bc921d028, ptemp=0x7f6bc8e7f028, optional=optional@entry=1) at config.c:1949
#18 0x00005600333ac46e in include_config (cmd=0x7ffd469bb560, dummy=0x7ffd469bb440, name=) at core.c:3314
#19 0x00005600333bc642 in invoke_cmd (cmd=0x560033406b70 <core_cmds+2000>, parms=parms@entry=0x7ffd469bb560, mconfig=mconfig@entry=0x7ffd469bb440, args=,
args@entry=0x7f6bc8e7f180 "mods-enabled/.load") at config.c:928
#20 0x00005600333be9cb in execute_now (p=0x7ffd469bb440, ptemp=0x7ffd469bb4b8, parent=, sub_tree=0x7ffd469bb440, parms=0x7ffd469bb560,
args=0x7f6bc8e7f180 "mods-enabled/.load", cmd_line=0x7f6bc8e7f480 "IncludeOptional") at config.c:1703
#21 ap_build_config_sub (p=p@entry=0x7f6bc921d028, temp_pool=temp_pool@entry=0x7f6bc8e7f028, l=, parms=parms@entry=0x7ffd469bb560, current=current@entry=0x7ffd469bb4b0,
curr_parent=curr_parent@entry=0x7ffd469bb4b8, conftree=0x56003340c290 <ap_conftree>) at config.c:1167
#22 0x00005600333beff5 in ap_build_config (parms=parms@entry=0x7ffd469bb560, p=p@entry=0x7f6bc921d028, temp_pool=temp_pool@entry=0x7f6bc8e7f028,
conftree=conftree@entry=0x56003340c290 <ap_conftree>) at config.c:1424
#23 0x00005600333bf8c5 in ap_process_resource_config (s=s@entry=0x7f6bc8e81bd0, fname=0x7f6bc8e7ef78 "/etc/apache2/apache2.conf", conftree=conftree@entry=0x56003340c290 <ap_conftree>,
p=p@entry=0x7f6bc921d028, ptemp=ptemp@entry=0x7f6bc8e7f028) at config.c:1873
#24 0x00005600333c07cb in ap_read_config (process=, ptemp=0x7f6bc8e7f028, filename=, conftree=0x56003340c290 <ap_conftree>) at config.c:2335
#25 0x000056003339706a in main (argc=, argv=) at main.c:659
static void ap_add_module_commands(module *m, apr_pool_t *p)
{
apr_pool_t *tpool;
ap_mod_list *mln;
const command_rec *cmd;
char *dir;
cmd = m->cmds;
if (ap_config_hash == NULL) {
rebuild_conf_hash(p, 0);
}
tpool = apr_hash_pool_get(ap_config_hash);
while (cmd && cmd->name) {
mln = apr_palloc(tpool, sizeof(ap_mod_list));
mln->cmd = cmd;
mln->m = m;
dir = apr_pstrdup(tpool, cmd->name);
ap_str_tolower(dir);
mln->next = apr_hash_get(ap_config_hash, dir, APR_HASH_KEY_STRING);
apr_hash_set(ap_config_hash, dir, APR_HASH_KEY_STRING, mln);
++cmd;
}
}
is just strdup on the command name.
Current attempts to define Apache config commands via command_rec in a Rust based module are resulting in a SEGFAULT on Apache start up. Here is the backtrace:
Viewing the Apache2 code this is what
ap_add_module_commandsis doing:is just strdup on the command name.