大阪市中央区 システムソフトウェア開発会社

営業時間:平日09:15〜18:15
MENU

raspbian stretch で mailutils がsegmentation fault

株式会社クローバーフィールドの経営理念
著者:津路高広
公開日:2022/01/23
最終更新日:2022/01/23
カテゴリー:技術情報
タグ:

津路です。

昨日は、メール送信をコマンドで行うために、色々調べていました。
ssmtp, mailutilsをインストールして、単純なメールを送信しようとしました。
が、mailコマンドでsegmentation faultが吐かれます。それも、mail -Vでも。。。

sendmailコマンドでは、容易に送れました。
ということは、mailutilsに問題があるのでしょう。

ulimit -c 1000000000
make -V

にて、coreファイルを生成
gdbコマンドでトレースすることに。

GNU gdb (Raspbian 7.7.1+dfsg-5+rpi1) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from mail...(no debugging symbols found)...done.

warning: core file may not match specified executable file.
[New LWP 1620]
Dwarf Error: wrong version in compilation unit header (is 9661, should be 2, 3, or 4) [in module /usr/lib/debug/.build-id/80/04807a641723782e258f53fccb18b50d586940.debug]
Dwarf Error: wrong version in compilation unit header (is -17502, should be 2, 3, or 4) [in module /usr/lib/debug/.build-id/c3/90f5fdedf442d80621e7884a8b7661e9c8050f.debug]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
Dwarf Error: wrong version in compilation unit header (is 30469, should be 2, 3, or 4) [in module /usr/lib/debug/.build-id/44/d64b51763b6272bc47bd01723b6bdf68f38a1c.debug]
Dwarf Error: wrong version in compilation unit header (is -25664, should be 2, 3, or 4) [in module /usr/lib/debug/.build-id/09/4b30e8c4ded4dca627b8adf5e6324125084005.debug]
Dwarf Error: wrong version in compilation unit header (is -27107, should be 2, 3, or 4) [in module /usr/lib/debug/.build-id/81/ceb8fe32848c140c8a3d1741242c6a996bdb0d.debug]
Dwarf Error: wrong version in compilation unit header (is -31079, should be 2, 3, or 4) [in module /usr/lib/debug/.build-id/e5/8601123ae22d2f43220005658f6cc8a9ad89f5.debug]
Core was generated by `mail -V'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x76277654 in nettle_yarrow256_update ()
   from /usr/lib/arm-linux-gnueabihf/libnettle.so.6
(gdb)
#0  0x76277654 in nettle_yarrow256_update ()
   from /usr/lib/arm-linux-gnueabihf/libnettle.so.6
(gdb) bt
Cannot access memory at address 0x0
#0  0x76277654 in nettle_yarrow256_update ()
   from /usr/lib/arm-linux-gnueabihf/libnettle.so.6
#1  0x7610bf6c in ?? () from /usr/lib/arm-linux-gnueabihf/libgnutls-deb0.so.28
Cannot access memory at address 0x0
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) frame 0
#0  0x76277654 in nettle_yarrow256_update ()
   from /usr/lib/arm-linux-gnueabihf/libnettle.so.6
(gdb) frame 1
#1  0x7610bf6c in ?? () from /usr/lib/arm-linux-gnueabihf/libgnutls-deb0.so.28
(gdb)

mailutils のバージョンは、3.1.1、libnettleのバージョンは、

:~ $ dpkg -l | grep libnettle
ii  libnettle4:armhf                      2.7.1-5+deb8u2                            armhf        low level cryptographic library (symmetric and one-way cryptos)
ii  libnettle6:armhf                      3.3-1+deb9u1                              armhf        low level cryptographic library (symmetric and one-way cryptos)

想像できるのは、バージョン不一致によるメモリアクセスエラー
解決策として、ソースをダウンロードしてビルドすることにしました。

sudo apt-get remove mailutils
mkdir tmp/mailutils
chmod 0777 tmp/mailutils
cd tmp/mailutils
added deb-src to /etc/apt/sources.list
sudo apt-get build-dep mailutils
sudo apt-get autoremove
sudo apt-get source mailutils

ここで、configureするのですが、-gを一応つけました。
makeコマンドで、alocal, automakeが見つからないと怒られ、バージョンを一致させました。
make, make installを行い、ライブラリパスを追加して、やっと起動に成功しました。

    上に戻る