From: sternenseemann <sternenseemann@systemli.org>
To: tech@mandoc.bsd.lv
Subject: makewhatis: segfault in dbadd when using -a
Date: Sat, 7 Aug 2021 01:53:18 +0200 [thread overview]
Message-ID: <bccac2cd-01b6-b349-86e5-de4066ed8dee@systemli.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 1096 bytes --]
Hi all,
while testing Ingo's latest patch I found a segfault in makewhatis
involving -a and symlinks which I can also reproduce on unpatched CVS.
To reproduce do something like this
mkdir test-manpath
mkdir -p test-manpath/de/man1
ln -sf $(realpath test-manpath/de) test-manpath/DE
So we have a base directory which has one child that is a symlink. This
symlink points to a directory below the base directory which contains
another directory. Running makewhatis -a test-manpath will then segfault
with the following backtrace:
#0 0x000000000041a9e1 in dbadd (dba=dba@entry=0x471050,
mpage=mpage@entry=0x473560) at mandocdb.c:2140
#1 0x000000000041b0ae in mpages_merge (dba=dba@entry=0x471050,
mp=mp@entry=0x46c2b0) at mandocdb.c:1294
#2 0x000000000041ca13 in mandocdb (argc=1, argc@entry=3,
argv=<optimized out>, argv@entry=0x7fffffffd678) at mandocdb.c:513
#3 0x000000000041dffa in main (argc=3, argv=0x7fffffffd678) at main.c:165
Full backtrace is attached as well. I've stared at mpages_merge for a
little bit, but haven't figured out how this is happening so far.
Cheers,
Lukas
[-- Attachment #2: makewhatis-full-backtrace --]
[-- Type: text/plain, Size: 3304 bytes --]
#0 0x000000000041a9e1 in dbadd (dba=dba@entry=0x471050, mpage=mpage@entry=0x473560) at mandocdb.c:2140
mlink = 0x472510
key = <optimized out>
cp = 0x476460 "DE"
mask = <optimized out>
i = 2
slot = 0
mustfree = 0
__PRETTY_FUNCTION__ = "dbadd"
#1 0x000000000041b0ae in mpages_merge (dba=dba@entry=0x471050, mp=mp@entry=0x46c2b0) at mandocdb.c:1294
mpage = 0x473560
mpage_dest = <optimized out>
mlink = 0x0
mlink_dest = <optimized out>
meta = 0x46ca00
cp = 0x437301 <hash_calloc> "H\203\354\b\350\\\374\377\377H\203\304\b\303H\203\354\b\350p\374\377\377H\203\304\b\303H\203\354\070dH\213\004%("
fd = <optimized out>
__PRETTY_FUNCTION__ = "mpages_merge"
#2 0x000000000041ca13 in mandocdb (argc=1, argc@entry=3, argv=<optimized out>, argv@entry=0x7fffffffd678) at mandocdb.c:513
conf = {output = {includes = 0x0, man = 0x0, outfilename = 0x0, paper = 0x0, style = 0x0, tag = 0x0, tagfilename = 0x0, indent = 0, width = 0, fragment = 0, mdoc = 0, noval = 0, synopsisonly = 0, tag_found = 0, toc = 0}, manpath = {paths = 0x46d0c0, sz = 1}}
mp = 0x46c2b0
dba = 0x471050
path_arg = <optimized out>
progname = <optimized out>
j = 0
sz = <optimized out>
ch = <optimized out>
i = <optimized out>
#3 0x000000000041dffa in main (argc=3, argv=0x7fffffffd678) at main.c:165
conf = {output = {includes = 0x100000 <error: Cannot access memory at address 0x100000>, man = 0x0, outfilename = 0xffffffffffffffff <error: Cannot access memory at address 0xffffffffffffffff>, paper = 0x8000 <error: Cannot access memory at address 0x8000>, style = 0x0,
tag = 0xffffffffffffffff <error: Cannot access memory at address 0xffffffffffffffff>, tagfilename = 0x0, indent = 140737488347803, width = 140737354082303, fragment = 0, mdoc = 0, noval = 0, synopsisonly = 0, tag_found = 0, toc = 0}, manpath = {paths = 0x0, sz = 140737353989472}}
outst = {tag_files = 0x1, outdata = 0xffffffffffffffff, use_pager = 4096, wstop = 0, had_output = 256, outtype = OUTT_ASCII}
ws = {ws_row = 2048, ws_col = 0, ws_xpixel = 0, ws_ypixel = 0}
search = {arch = 0xffffffffffffffff <error: Cannot access memory at address 0xffffffffffffffff>, sec = 0xc0000 <error: Cannot access memory at address 0xc0000>, outkey = 0x0, argmode = 4294967295, firstmatch = -1}
res = 0x40
resn = 0x38000000380
mp = <optimized out>
conf_file = <optimized out>
os_s = <optimized out>
progname = 0x7fffffffda72 "makewhatis"
sec = <optimized out>
defpaths = <optimized out>
auxpaths = <optimized out>
oarg = 0x38000000380 <error: Cannot access memory at address 0x38000000380>
tagarg = <optimized out>
uc = <optimized out>
ressz = 17179870080
resnsz = 1048576
i = <optimized out>
ib = <optimized out>
ssz = <optimized out>
options = <optimized out>
show_usage = <optimized out>
prio = <optimized out>
best_prio = <optimized out>
startdir = <optimized out>
c = <optimized out>
os_e = MANDOC_OS_OTHER
outmode = <optimized out>
next reply other threads:[~2021-08-06 23:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-06 23:53 sternenseemann [this message]
2021-08-11 15:09 ` Ingo Schwarze
2021-08-18 22:02 ` sternenseemann
2021-08-19 17:11 ` Ingo Schwarze
2021-09-06 14:50 ` Ingo Schwarze
2021-09-06 15:52 ` sternenseemann
2021-09-06 17:12 ` Ingo Schwarze
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bccac2cd-01b6-b349-86e5-de4066ed8dee@systemli.org \
--to=sternenseemann@systemli.org \
--cc=tech@mandoc.bsd.lv \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).