设置 man-db 会导致系统因错误的系统调用而崩溃

设置 man-db 会导致系统因错误的系统调用而崩溃

Ubuntu 18.04 x86_64。自从我从 17.10 升级到 18.04 以来,每当我安装或运行更新并且随后发生 man-db 更新时,系统就会卡住十分钟左右,出现错误并严重影响 CPU。

Setting up man-db (2.8.3-2) ...
Updating database of manual pages ...
/usr/bin/mandb: zcat: Bad system call (core dumped)
/usr/bin/mandb: zcat < /usr/share/man/man1/wodim.1.gz: Bad system call (core dumped)
/usr/bin/mandb: /usr/lib/man-db/manconv -f UTF-8:ISO-8859-1 -t UTF-8//IGNORE -q: Bad system call (core dumped)
/usr/bin/mandb: zcat < /usr/share/man/man1/grub-editenv.1.gz: Bad system call (core dumped)
/usr/bin/mandb: zcat: Bad system call (core dumped)
/usr/bin/mandb: zcat < /usr/share/man/man1/grub-editenv.1.gz: Bad system call (core dumped)
/usr/bin/mandb: /usr/lib/man-db/manconv -f UTF-8:ISO-8859-1 -t UTF-8//IGNORE -q: Bad system call (core dumped)
/usr/bin/mandb: zcat < /usr/share/man/man1/grub-file.1.gz: Bad system call (core dumped)
.
.
.

此外,手册页会抛出错误并且为空:

     Manual page man(1) line ?/? (END) (press h for help or q to quit)man: 
    zcat < /usr/share/man/man1/man.1.gz: Bad system call (core dumped)
    man: /usr/lib/man-db/manconv: Bad system call (core dumped)man: preconv: Segmentation fault (core dumped)
    man: tbl: Segmentation fault (core dumped)
    man: nroff: Bad system call (core dumped)
man: gzip: Bad system call (core dumped)

Debian 上有一个错误报告描述了类似的问题,https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=890355man-db,但我已经在运行据称可以解决问题的版本(2.8.3)。尝试重新安装man-db,但无效。有人遇到过类似情况吗?如何解决?

这是所请求的跟踪文件的链接:

手册页跟踪

答案1

我收到了几条对我的strace输出请求的回复,非常感谢。其中大部分都表明使用了 Astrill VPN 软件,该软件使用 向系统上的每个进程注入代码/etc/ld.so.preload,从而使有效的进程沙盒变得更加困难。我相信我已经解决这个问题在 git master 中。

一个回复指出使用 ESET File Security 防病毒软件,它的功能类似。我过去曾尝试解决此问题,但似乎有点难以解决。我已承诺最佳解决方法到 git master。

假设我获得有关这些更改的一些成功测试报告,它们将在 man-db 2.8.4 中,并且它们足够小且独立,我应该能够将它们作为稳定更新推送到 Ubuntu 18.04。

答案2

我遇到了这个问题,并且在很多机器上都看到过它,我联系了 Astrill,他们回复说:

“这是由 apparmor 引起的。请确保将 astrill 更新到最新版本。我试图通过排除一些行为不当的程序来改善这种情况。基本上,当这些程序试图访问共享内存时,apparmor 会使这些程序崩溃,而不是通过返回相应的错误核心来拒绝访问。我相信这是 apparmor 或系统库中的一个错误,除了排除这些程序外,我对此无能为力。

我制作了一个配置文件,您可以通过指定可执行文件名称(每行一个)来排除行为不当的程序:/etc/lsp.exclude

我在最近的一些版本中修复了这个问题,所以请确保你使用的是最新的 astrill 版本。如果它不工作,请尝试找出要添加到列表中的程序。请将列表发给我,然后我可以将其包含在下一个版本中。

我已经排除了 sshd、bash、sh、grotty、groff、man”

我可以确认,如果添加了 mandb /etc/lsp.exclude,问题就会消失(至少在我的计算机上)。我也通知了 Astrill。

更新:Astrill 通知我,他们将把 mandb 添加到 /etc/lsp.exclude

更新:我已将您的评论转发给 astrill,他们告知我下一次更新将排除 mandb,但是……

答案3

如果您使用该工具运行升级并且必须更新一些手册页,Bad system call也会出现此问题:apt-getnocache(1)

# nocache apt-get --yes dist-upgrade
[...]
Processing triggers for systemd (237-3ubuntu10.42) ...                          
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...                           
/usr/bin/mandb: zcat < /usr/share/man/man8/grub-bios-setup.8.gz: Bad system call
 (core dumped)                                                                  
/usr/bin/mandb: zcat < /usr/share/man/man8/grub-bios-setup.8.gz: Bad system call
 (core dumped)                                                                  
/usr/bin/mandb: zcat < /usr/share/man/man8/grub-install.8.gz: Bad system call (c
ore dumped)
[...etc...]

的手册页nocache()解释说它确实使用了添加的系统调用:

This is done by intercepting the `open` and `close` system calls and
calling `posix_fadvise` with the `POSIX_FADV_DONTNEED` parameter.
  • Ubuntu 18.04.5 LTS
  • Linux xxx 4.15.0-112-通用#113-Ubuntu SMP 星期四 7 月 9 日 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

相关内容