SEGV in cgit-1.2.3 on unreadable refs/tags/FOO

Frank Ch. Eigler fche at elastic.org
Sat Jun 10 00:03:44 UTC 2023


Hi -

Over on sourceware.org, we run a cgit instance to expose the various
git repos held there.  We noticed in the logs a recurrent SEGV of the
cgi-bin/cgit process, looking thusly:

#0  0x000056510452bfae in cgit_mk_refinfo (oid=0x565105f5bc98, refname=0x565105f5bcca "cluster-2.99.02") at ../shared.c:165
#1  cgit_refs_cb (refname=0x565105f5bcca "cluster-2.99.02", oid=0x565105f5bc98, flags=<optimized out>, cb_data=0x7fff6dc25fc0)
    at ../shared.c:217
#2  0x00005651045d3b44 in do_for_each_repo_ref_iterator (r=0x56510490fc20 <the_repo>, iter=0x565105f7de00,
    fn=fn at entry=0x5651045c6cc0 <do_for_each_ref_helper>, cb_data=cb_data at entry=0x7fff6dc25f80) at refs/iterator.c:418
#3  0x00005651045c9669 in do_for_each_ref (refs=<optimized out>, prefix=prefix at entry=0x5651046a1d4e "refs/tags/",
    fn=<optimized out>, trim=<optimized out>, flags=flags at entry=(unknown: 0),
    cb_data=cb_data at entry=0x56510453295b <cgit_print_tags+75>) at refs.c:1498
#4  0x00005651045c96f2 in refs_for_each_ref_in (refs=<optimized out>, prefix=prefix at entry=0x5651046a1d4e "refs/tags/",
    fn=<optimized out>, cb_data=cb_data at entry=0x56510453295b <cgit_print_tags+75>) at refs.c:1515
#5  0x00005651045ca217 in refs_for_each_tag_ref (cb_data=0x56510453295b <cgit_print_tags+75>, fn=<optimized out>,
    refs=<optimized out>) at refs.c:409
#6  for_each_tag_ref (fn=<optimized out>, cb_data=cb_data at entry=0x7fff6dc25fc0) at refs.c:414
#7  0x000056510453295b in cgit_print_tags (maxcount=2087820800) at ../ui-refs.c:185
#8  0x0000565104539e1d in cgit_print_summary () at ../ui-summary.c:56
#9  0x0000565104525c1f in process_request () at ../cgit.c:755

(gdb) print *oid
$1 = {hash = '\000' <repeats 31 times>, algo = 1}

It appears as though the oid is null or invalid.  That in turns
appears to be because the refs/tags/cluster-2.99.02 file had perms
0440, i.e., unreadable to the cgi process.  With world-readability
restored, the code started working again.


- FChE


More information about the CGit mailing list