狠狠撸

狠狠撸Share a Scribd company logo
1
Chrome が落ちる問題を
追いかけていたら
libgcrypt の bug に出会った
●
●
@ItSANgo
●
http://www.facebook.com/profile.php?id=100005833863069
●
http://mixi.jp/show_profile.pl?id=789759
2
発端 (2012 年 12 月 24 日 )
●
https://productforums.google.com/forum/#!msg/c
●
Xubuntu 12.04 上の Chrome が
http://twtter.com/ItSANgo/ へアクセスする
と SIGABRT で落ちます。
●
その他、あちこちのサイトで落ちます。
●
Linux 版 Chrome 使えねぇ (-"-)
3
標準エラー出力
(google-chrome:10581): Pango-CRITICAL **:
pango_font_description_set_size: assertion `size >= 0' failed
●
chrome --flag-switches-begin --flag-switches-end: /build/buildd/cairo-
1.10.2/src/cairo-surface.c:1287: cairo_surface_set_device_offset: アサー
ション `status == CAIRO_STATUS_SUCCESS' に失敗しました。
●
●
なんだこれは?
Chrome には crash report を出
す機能がある。 (12 月 26 日 )
●
chrome://crashes
●
早速 crash report を提出。
●
https://code.google.com/p/chromium/issue
●
Desktop 環境によっては
落ちないよ ?(12 月 30 日 )
Desktop 環境依存 ?
Lubuntu は Chromium が標準ブラウザ
→ 独自に修正が入っている ?
セッション 結果
Ubuntu ×
GNOME ×
LXDE ○
Recovery Console ○
Xubuntu ×
同じエラーを報告している人が
いた
●
https://code.google.com/p/chromium/issues/detail?id=124990
●
(chromium:4187): Pango-CRITICAL **:
pango_font_description_set_size: assertion `size >= 0' failed は同
じメッセージ。
●
“I think the browser crashes more, when are been loaded sites
which asks for username and password .”
●
でも本当に同じエラー?
助っ人登場 (1 月 2 日 )
●
font 周りでは ?
●
--password-store=basic では ? ← これ
が大きかった !
password-store と問題の関連
性
●
gnome-keyring が怪しい。
password-store 結果
gnome ×
kwallet ○
basic ○
gnome-keyring の Ver. Up
(1 月 7 日 )
Xubuntu(Ubuntu) Gnome-keyring
12.04 3.2.2-2
12.10 3.6.1-0
●
Xubuntu ごと Upgrade しました。
●
しかし問題は改善しなかった。
Gnome-keyring の make check
が通らない
●
/wrap-layer/create-credential/ok_password: FAIL
●
●
もはや Chrome の問題ではないよ^^;
●
●
自分の手におえそうにないので Ubuntu 日本語フォーラムに助けを求めた。 (1 月 9 日 )
●
https://forums.ubuntulinux.jp/viewtopic.php?id=14643
●
「 gnome-keyring 3.6.1-0Ubuntu1 のソースの make check が FAIL になるのを何とかしたい」
●
DELL XPS8300 (core i7-2600) 上の VirtualBox では問題が発生しない。
GDB で追いかける (1 月 13
日 )●
largs[0] = success ? 0 : 1;
●
ここを通り過ぎたとき、largs[0] は0 になると予想しましたが、実際には-nan になっていました。
●
●
(gdb) print largs[0]
●
$28 = -nan(0xc000000000000000)
●
(gdb) print success
●
$29 = 1
●
(gdb) print test_run_success
●
$30 = 0
●
●
こんなことってある? メモリを壊している?
●
パルプンテ! パルプンテ! パルプンテ!
●
迷走中:最適化を切ってみた
(1 月 20 日)
●
落ちる場所は変わった w
●
/gnome2-store/import/pkcs12:
FAIL
まーた変な値が入っている
(1 月 22 日 )
●
guint32 iterations;
●
/* 略. */
●
/* Prepare us the iterations */
●
iterations = 1000 + (int) (1000.0 * rand() / (RAND_MAX + 1.0)); /* ← これが怪しい. */
●
/* 略. */
●
●
if (!create_cipher (login, calgo, halgo, salt, sizeof (salt), iterations, &cipher)) /* ← ここで落ちている. */
●
return FALSE;
●
上記のコードなのですが私が読んだ限りではiterationsには1000から2000の値が入ると見たのですが、実際には、
●
●
(gdb) print iterations
●
$15 = 2147484648
●
パルプンテ!パルプンテ!パルプンテ!
ふと思った (1 月 25 日 )
●
浮動小数点数まわりの扱いがおかしいので
はないか ?
●
IA-32 の CPU の仕様の勉強を始めた。
●
「 IA-32 インテル ? アーキテクチャソフト
ウェア?デベロッパーズ?マニュアル」
●
http://www.intel.co.jp/content/www/jp/ja/develo
GDB で追いかける。
●
Info float
●
普段は Empty(gdb) info float
R7: Empty 0x4008ffffff8b0dffffff8030ffffff98000000
R6: Empty 0x00000000000000000000
R5: Empty 0x00000000000000000000
R4: Empty 0x00000000000000000000
R3: Empty 0x00000000000000000000
R2: Empty 0x00000000000000000000
R1: Empty 0x00000000000000000000
=>R0: Empty 0x00000000000000000000
●
…しかし
FPU …レジスタが
●
FPU レジスタが全て使われてしまって
いる。(gdb) info float
=>R7: Special 0xffffffffffffffffffffffc000000000000000 Real
Indefinite (QNaN)
R6: Zero 0x00000000000000000000 +0
R5: Zero 0x00000000000000000000 +0
R4: Zero 0x00000000000000000000 +0
R3: Zero 0x00000000000000000000 +0
R2: Zero 0x00000000000000000000 +0
R1: Special 0xffffffffffffffff0000000000000000 Unsupported
R0: Special 0xffffffffffffffff0000000000000000 Unsupported
●
何故だ ? --;
●
だが、問題を追いかけるトリガーが出来た。
●
後はただひたすらに処理を追いかけるだけ。
問題個所特定 (1 月 26 日 )
●
gcry_cipher_encrypt (cipher, dest, input->len,
input->buf, input->len)
●
libgcrypt11:i386 1.5.0-3ubuntu1 の関数
●
再現プログラムを書いた。
●
Bug report:
https://bugs.launchpad.net/ubuntu/+source/libgcr
さらに問題個所を絞り込む
(1 月 27 日 )
●
/build/buildd/libgcrypt11-1.5.0/cipher/rijndael.c の_gcry_aes_cbc_enc ()でaesni_cleanup() を呼び出しているところ
で、全てのx87 FPUデータレジスタが使用されていました。
●
●
void
●
_gcry_aes_cbc_enc (void *context, unsigned char *iv,
●
void *outbuf_arg, const void *inbuf_arg,
●
unsigned int nblocks, int cbc_mac)
●
{
●
/* 略. */
●
aesni_cleanup (); /* <- ここ. */
●
●
_gcry_burn_stack (48 + 2*sizeof(int));
●
}
マクロでした
●
# define aesni_cleanup() 
●
do { asm volatile ("pxor %%xmm0, %%xmm0nt" 
●
"pxor %%xmm1, %%xmm1nt" :: ); 
●
} while (0)
●
●
pxor -
http://softwaretechnique.web.fc2.com/OS_Development/Tips/IA32_MMX_Instruction
●
要するに xmm0 と xmm1 を 0 クリアしているだけ。
●
どうしてこうなるのか
●
9.5.1. MMXR 命令とx87 FPU タグワードの関係
●
MMXR 命令の実行後は、必ずx87 FPU タグワード全体がValid (00B )に
設定されてい
●
る。
●
。EMMS 命令(MMX テクノロジ?ステートのクリア命令)を実行すると、
x87 FPU タグワード全体がEmpty (11B )に設定される。
●
http://www.intel.co.jp/content/dam/www/public/ijkk/jp/ja/documents/developer/
●
●
要するにPXOR の後にEMMS を呼び出すのを忘れている?
パッチ書きました
●
# define aesni_cleanup() 
●
do { asm volatile ("pxor %%xmm0, %%xmm0nt" 
●
"pxor %%xmm1, %%xmm1nt" "emmsn" :: ); 
●
} while (0)
●
●
make check はすべてクリア、 Chrome も落ちることは無くなっ
た。
●
…全てはこれで解決するかに見えたが
そのパッチ間違ってます
●
http://lists.gnupg.org/pipermail/gcrypt-devel/2013-January/002083.html
●
●
Jussi Kivilinna jussi.kivilinna at mbnet.fi
●
Mon Jan 28 09:49:33 CET 2013
●
●
Those are SSE2 instructions, not MMX. So it does not touch x87
●
registers at all.
●
Your bug report shows that you have Pentium-III. It does not support SSE2.
●
●
Since PXOR for MMX is encoded with '0F EF' and for SSE2 with '66 0F
●
EF', the SSE2 version runs as MMX version on CPUs without SSE2
●
support. The 0x66 byte at front of SSE2-opcode is operand-size
●
override prefix and is being ignored on your CPU.
●
●
Bug appears to be in _gcry_aes_cbc_enc(), aesni_cleanup() is called
●
outside '#ifdef USE_AESNI' and/or 'if (ctr->use_aesni)'. This works on
●
most (modern) CPUs, but not those without SSE2 support.
●
●
正しいパッチが出ました
(1 月 28 日 )
●
開発版 (1.6beta):http://lists.gnupg.org/pipermail/gcrypt-devel/2013-January/002084.html
●
Version 1.5:
http://lists.gnupg.org/pipermail/gcrypt-devel/2013-January/002088.html
●
●
- aesni_cleanup ();
●
+
●
+#ifdef USE_AESNI
●
+ if (ctx->use_aesni)
●
+ aesni_cleanup ();
●
+#endif /*USE_AESNI*/
●
●
要するにpxor を呼び出す箇所は#ifdef で囲いctx->use_aesni でチェック。
その後当方でやったこと
●
パッチのテスト
●
パッチの当て方ドキュメント化 (1 月30 日)
–
https://forums.ubuntulinux.jp/viewtopic.php?
pid=96461#p96461
–
https://bugs.launchpad.net/ubuntu/
+source/libgcrypt11/+bug/1105758/comments/3
その後の状況
●
正式なパッケージが出始めました。
–
Debian's 1.5.0-5
●
そのうち Ubuntu にも落ちてくるでしょう。
–
Libgcrypt 1.5.1 released
http://lists.gnupg.org/pipermail/gcrypt-
devel/2013-March/002109.html
–
Libgcrypt 1.5.2 released …
こうして世のポンコツ PC が救
われたのです。
●
Pentium II とか III とか
http://www.ill-f.co.jp/blog/cat6/
所感とか
●
Chrome のデバッグは大変よねぇ。
●
IA-32 って変態さんだ。 ( 歴史を背負っ
ててぐちゃまら )
●
マクロを小文字で書く文化は滅びろ w
Chrome のプロセスについて
●
chrome(2910)-+-chrome(2916)
●
|-chrome-sandbox(2917)---chrome(2918)-+-chrome(2925)-+-chrome(2975)-+-{chrome}(2979)
●
| | | |-{chrome}(2982)
●
| | | `-{chrome}(2992)
●
| | |-chrome(2985)-+-{chrome}(2989)
●
| | | |-{chrome}(2990)
●
| | | `-{chrome}(2993)
●
| | `-chrome(2994)-+-{chrome}(2997)
●
| | |-{chrome}(2998)
●
| | `-{chrome}(2999)
●
| `-nacl_helper_boo(2924)
●
|-{chrome}(2927)
●
|-{chrome}(2928)
●
|-{chrome}(2929)
●
|-{chrome}(2931)
●
|-{chrome}(2932)
●
|-{chrome}(2933)
●
|-{chrome}(2934)
●
|-{chrome}(2935)
●
|-{chrome}(2936)
●
|-{chrome}(2937)
●
|-{chrome}(2938)
●
|-{chrome}(2939)
●
|-{chrome}(2940)
●
|-{chrome}(2941)
●
|-{chrome}(2943)
●
|-{chrome}(2944)
●
|-{chrome}(2945)
●
|-{chrome}(2946)
●
|-{chrome}(2947)
●
|-{chrome}(2948)
●
|-{chrome}(2971)
●
|-{chrome}(2972)
●
|-{chrome}(2973)
●
|-{chrome}(2974)
●
|-{chrome}(2981)
●
|-{chrome}(2983)
●
|-{chrome}(2984)
●
|-{chrome}(2991)
●
|-{chrome}(3002)
●
|-{chrome}(3003)
●
|-{chrome}(3004)
●
|-{chrome}(3005)
●
|-{chrome}(3009)
●
|-{chrome}(3015)
●
|-{chrome}(3018)
●
|-{chrome}(3019)
●
|-{chrome}(3020)
●
|-{chrome}(3022)
●
|-{chrome}(3023)
●
|-{chrome}(3024)
●
|-{chrome}(3025)
●
`-{chrome}(3028)
●
どうデバッグしろと w
https://code.google.com/p/chromium/wiki/LinuxDebuggi
ng

More Related Content

What's hot (19)

PDF
飞别谤办办锄别耻驳3の骋鲍滨実装
Hisanari Otsu
?
PDF
Task Spooler を試した
y-uti
?
PDF
ノンコーディング防犯
真理 中村
?
PDF
coma Creators session vol.2
Atsushi Tadokoro
?
PDF
【罢别肠丑叠耻锄锄】第9回肠辞肠辞蝉2诲-虫勉强会「シェーダ书いてますか?」
nyagasuki
?
PDF
GoCon 2015 Summer GoのASTをいじくって新しいツールを作る
Masahiro Wakame
?
PDF
础苍诲谤辞颈诲プログラミング初心者のためのゲームアプリ开発入门
Masahiko Mizuta
?
PDF
これからの闯补惫补厂肠谤颈辫迟の话
Shogo Sensui
?
PDF
规格书で読む颁++11のスレッド
Kohsuke Yuasa
?
PDF
Acme minechan
takesako
?
PDF
C++ マルチスレット?フ?ロク?ラミンク?
Kohsuke Yuasa
?
PDF
Gocon2013
Moriyoshi Koizumi
?
PDF
础苍诲谤辞颈诲上での3顿(翱辫别苍骋尝)描画の基础と狈顿碍による実践的高速化手法
Hiroshi Yoshida
?
PDF
History & Practices for UniRx UniRxの歴史、或いは開発(中)タイトルの用例と落とし穴の回避法
Yoshifumi Kawai
?
KEY
Core Graphicsでつくる自作UIコンポーネント入門
cocopon
?
PDF
これからのJSの話をしよう ~jQueryで作るTwitterアプリ~ (Gunma.web #2 2010/10/9)
parrotstudio
?
PDF
Cocos2d x-sprite3d
aktsk
?
PDF
C++ マルチスレッド 入門
京大 マイコンクラブ
?
KEY
iOSプログラマへ。HTML5 Canvasがおもしろい!
cocopon
?
飞别谤办办锄别耻驳3の骋鲍滨実装
Hisanari Otsu
?
Task Spooler を試した
y-uti
?
ノンコーディング防犯
真理 中村
?
coma Creators session vol.2
Atsushi Tadokoro
?
【罢别肠丑叠耻锄锄】第9回肠辞肠辞蝉2诲-虫勉强会「シェーダ书いてますか?」
nyagasuki
?
GoCon 2015 Summer GoのASTをいじくって新しいツールを作る
Masahiro Wakame
?
础苍诲谤辞颈诲プログラミング初心者のためのゲームアプリ开発入门
Masahiko Mizuta
?
これからの闯补惫补厂肠谤颈辫迟の话
Shogo Sensui
?
规格书で読む颁++11のスレッド
Kohsuke Yuasa
?
Acme minechan
takesako
?
C++ マルチスレット?フ?ロク?ラミンク?
Kohsuke Yuasa
?
础苍诲谤辞颈诲上での3顿(翱辫别苍骋尝)描画の基础と狈顿碍による実践的高速化手法
Hiroshi Yoshida
?
History & Practices for UniRx UniRxの歴史、或いは開発(中)タイトルの用例と落とし穴の回避法
Yoshifumi Kawai
?
Core Graphicsでつくる自作UIコンポーネント入門
cocopon
?
これからのJSの話をしよう ~jQueryで作るTwitterアプリ~ (Gunma.web #2 2010/10/9)
parrotstudio
?
Cocos2d x-sprite3d
aktsk
?
C++ マルチスレッド 入門
京大 マイコンクラブ
?
iOSプログラマへ。HTML5 Canvasがおもしろい!
cocopon
?

Similar to Chromeが落ちる問題を 追いかけていたら libgcryptのbugに出会った (20)

PDF
厂辫别肠迟谤别叠耻蝉迟别谤蝉あるいは尝颈苍耻虫における厂辫别肠迟谤别対策
Masami Hiramatsu
?
PDF
リナックスに置ける様々なリモートエキスプロイト手法 by スクハー?リー
CODE BLUE
?
PDF
颁/颁++プログラマのための开発ツール
MITSUNARI Shigeo
?
PPTX
高速な暗号実装のためにしてきたこと
MITSUNARI Shigeo
?
PDF
clu2cは64ビットOSでも使えます (OSC 2012 Hiroshima LT用資料)
洋史 東平
?
PDF
Cybozu Tech Conference 2016 バグの調べ方
MITSUNARI Shigeo
?
PDF
フラグを爱でる
MITSUNARI Shigeo
?
PDF
ゆるバグ
MITSUNARI Shigeo
?
ODP
0x300
geek_alice
?
ODP
厂补驳颈迟迟补谤颈耻蝉の绍介
Kato Takashi
?
PDF
尝尝痴惭最适化のこつ
MITSUNARI Shigeo
?
PPTX
アセンブラ100 さきゅりてぃ発表用
boropon
?
PDF
kernel/vm@okinawa 2014
y0t4
?
KEY
OSS奨励賞受賞プレゼン 活動紹介
Hiromu Yakura
?
PDF
Filippo, plain simple reality of entropy ja
PacSecJP
?
PDF
齿产测补办の绍介とその周辺
MITSUNARI Shigeo
?
PDF
贬补蝉飞别濒濒サーベイと有限体クラスの绍介
MITSUNARI Shigeo
?
PDF
CRYPT+YOU, UNDERSTAND TODAY!
inaz2
?
PDF
【学习メモ#11迟丑】12ステップで作る组込み翱厂自作入门
sandai
?
ODP
Acct v3 binary
Yutaka Matsuzawa
?
厂辫别肠迟谤别叠耻蝉迟别谤蝉あるいは尝颈苍耻虫における厂辫别肠迟谤别対策
Masami Hiramatsu
?
リナックスに置ける様々なリモートエキスプロイト手法 by スクハー?リー
CODE BLUE
?
颁/颁++プログラマのための开発ツール
MITSUNARI Shigeo
?
高速な暗号実装のためにしてきたこと
MITSUNARI Shigeo
?
clu2cは64ビットOSでも使えます (OSC 2012 Hiroshima LT用資料)
洋史 東平
?
Cybozu Tech Conference 2016 バグの調べ方
MITSUNARI Shigeo
?
フラグを爱でる
MITSUNARI Shigeo
?
ゆるバグ
MITSUNARI Shigeo
?
厂补驳颈迟迟补谤颈耻蝉の绍介
Kato Takashi
?
尝尝痴惭最适化のこつ
MITSUNARI Shigeo
?
アセンブラ100 さきゅりてぃ発表用
boropon
?
kernel/vm@okinawa 2014
y0t4
?
OSS奨励賞受賞プレゼン 活動紹介
Hiromu Yakura
?
Filippo, plain simple reality of entropy ja
PacSecJP
?
齿产测补办の绍介とその周辺
MITSUNARI Shigeo
?
贬补蝉飞别濒濒サーベイと有限体クラスの绍介
MITSUNARI Shigeo
?
CRYPT+YOU, UNDERSTAND TODAY!
inaz2
?
【学习メモ#11迟丑】12ステップで作る组込み翱厂自作入门
sandai
?
Acct v3 binary
Yutaka Matsuzawa
?
Ad

More from Mitsutoshi Nakano (6)

PDF
FreeWnn に patch が送られてきた、どうしよう
Mitsutoshi Nakano
?
PDF
Managed your slides by Git and upload them
Mitsutoshi Nakano
?
PDF
What is LPIC
Mitsutoshi Nakano
?
ODP
Tests and bugreports
Mitsutoshi Nakano
?
ODP
别迟肠办别别辫别谤を辞辫别苍厂鲍厂贰の公式リポジトリに入れたいぞ! Ver.2
Mitsutoshi Nakano
?
ODP
别迟肠办别别辫别谤を辞辫别苍厂鲍厂贰の公式リポジトリに入れたいぞ!
Mitsutoshi Nakano
?
FreeWnn に patch が送られてきた、どうしよう
Mitsutoshi Nakano
?
Managed your slides by Git and upload them
Mitsutoshi Nakano
?
What is LPIC
Mitsutoshi Nakano
?
Tests and bugreports
Mitsutoshi Nakano
?
别迟肠办别别辫别谤を辞辫别苍厂鲍厂贰の公式リポジトリに入れたいぞ! Ver.2
Mitsutoshi Nakano
?
别迟肠办别别辫别谤を辞辫别苍厂鲍厂贰の公式リポジトリに入れたいぞ!
Mitsutoshi Nakano
?
Ad

Recently uploaded (9)

PPTX
勉強会_ターミナルコマント?入力迅速化_20250620. pptx. .
iPride Co., Ltd.
?
PDF
論文紹介:AutoPrompt: Eliciting Knowledge from Language Models with Automatically ...
Toru Tamaki
?
PDF
論文紹介:Unbiasing through Textual Descriptions: Mitigating Representation Bias i...
Toru Tamaki
?
PDF
安尾 萌, 藤代 裕之, 松下 光範. 協調的情報トリアージにおけるコミュニケーションの影響についての検討, 第11回データ工学と情報マネジメントに関する...
Matsushita Laboratory
?
PPTX
色について.pptx .
iPride Co., Ltd.
?
PDF
安尾 萌, 北村 茂生, 松下 光範. 災害発生時における被害状況把握を目的とした情報共有システムの基礎検討, 電子情報通信学会HCGシンポジウム2018...
Matsushita Laboratory
?
PDF
Forguncy 10 製品概要資料 - ノーコードWebアプリ開発プラットフォーム
フォーガンシー
?
PDF
安尾 萌, 松下 光範. 環境馴致を計量可能にするための試み,人工知能学会第4回仕掛学研究会, 2018.
Matsushita Laboratory
?
PPTX
Vibe Codingを始めよう ?Cursorを例に、ノーコードでのプログラミング体験?
iPride Co., Ltd.
?
勉強会_ターミナルコマント?入力迅速化_20250620. pptx. .
iPride Co., Ltd.
?
論文紹介:AutoPrompt: Eliciting Knowledge from Language Models with Automatically ...
Toru Tamaki
?
論文紹介:Unbiasing through Textual Descriptions: Mitigating Representation Bias i...
Toru Tamaki
?
安尾 萌, 藤代 裕之, 松下 光範. 協調的情報トリアージにおけるコミュニケーションの影響についての検討, 第11回データ工学と情報マネジメントに関する...
Matsushita Laboratory
?
色について.pptx .
iPride Co., Ltd.
?
安尾 萌, 北村 茂生, 松下 光範. 災害発生時における被害状況把握を目的とした情報共有システムの基礎検討, 電子情報通信学会HCGシンポジウム2018...
Matsushita Laboratory
?
Forguncy 10 製品概要資料 - ノーコードWebアプリ開発プラットフォーム
フォーガンシー
?
安尾 萌, 松下 光範. 環境馴致を計量可能にするための試み,人工知能学会第4回仕掛学研究会, 2018.
Matsushita Laboratory
?
Vibe Codingを始めよう ?Cursorを例に、ノーコードでのプログラミング体験?
iPride Co., Ltd.
?

Chromeが落ちる問題を 追いかけていたら libgcryptのbugに出会った

  • 1. 1 Chrome が落ちる問題を 追いかけていたら libgcrypt の bug に出会った ● ● @ItSANgo ● http://www.facebook.com/profile.php?id=100005833863069 ● http://mixi.jp/show_profile.pl?id=789759
  • 2. 2 発端 (2012 年 12 月 24 日 ) ● https://productforums.google.com/forum/#!msg/c ● Xubuntu 12.04 上の Chrome が http://twtter.com/ItSANgo/ へアクセスする と SIGABRT で落ちます。 ● その他、あちこちのサイトで落ちます。 ● Linux 版 Chrome 使えねぇ (-"-)
  • 3. 3 標準エラー出力 (google-chrome:10581): Pango-CRITICAL **: pango_font_description_set_size: assertion `size >= 0' failed ● chrome --flag-switches-begin --flag-switches-end: /build/buildd/cairo- 1.10.2/src/cairo-surface.c:1287: cairo_surface_set_device_offset: アサー ション `status == CAIRO_STATUS_SUCCESS' に失敗しました。 ● ● なんだこれは?
  • 4. Chrome には crash report を出 す機能がある。 (12 月 26 日 ) ● chrome://crashes ● 早速 crash report を提出。 ● https://code.google.com/p/chromium/issue ●
  • 5. Desktop 環境によっては 落ちないよ ?(12 月 30 日 ) Desktop 環境依存 ? Lubuntu は Chromium が標準ブラウザ → 独自に修正が入っている ? セッション 結果 Ubuntu × GNOME × LXDE ○ Recovery Console ○ Xubuntu ×
  • 6. 同じエラーを報告している人が いた ● https://code.google.com/p/chromium/issues/detail?id=124990 ● (chromium:4187): Pango-CRITICAL **: pango_font_description_set_size: assertion `size >= 0' failed は同 じメッセージ。 ● “I think the browser crashes more, when are been loaded sites which asks for username and password .” ● でも本当に同じエラー?
  • 7. 助っ人登場 (1 月 2 日 ) ● font 周りでは ? ● --password-store=basic では ? ← これ が大きかった !
  • 9. gnome-keyring の Ver. Up (1 月 7 日 ) Xubuntu(Ubuntu) Gnome-keyring 12.04 3.2.2-2 12.10 3.6.1-0 ● Xubuntu ごと Upgrade しました。 ● しかし問題は改善しなかった。
  • 10. Gnome-keyring の make check が通らない ● /wrap-layer/create-credential/ok_password: FAIL ● ● もはや Chrome の問題ではないよ^^; ● ● 自分の手におえそうにないので Ubuntu 日本語フォーラムに助けを求めた。 (1 月 9 日 ) ● https://forums.ubuntulinux.jp/viewtopic.php?id=14643 ● 「 gnome-keyring 3.6.1-0Ubuntu1 のソースの make check が FAIL になるのを何とかしたい」 ● DELL XPS8300 (core i7-2600) 上の VirtualBox では問題が発生しない。
  • 11. GDB で追いかける (1 月 13 日 )● largs[0] = success ? 0 : 1; ● ここを通り過ぎたとき、largs[0] は0 になると予想しましたが、実際には-nan になっていました。 ● ● (gdb) print largs[0] ● $28 = -nan(0xc000000000000000) ● (gdb) print success ● $29 = 1 ● (gdb) print test_run_success ● $30 = 0 ● ● こんなことってある? メモリを壊している? ● パルプンテ! パルプンテ! パルプンテ! ●
  • 12. 迷走中:最適化を切ってみた (1 月 20 日) ● 落ちる場所は変わった w ● /gnome2-store/import/pkcs12: FAIL
  • 13. まーた変な値が入っている (1 月 22 日 ) ● guint32 iterations; ● /* 略. */ ● /* Prepare us the iterations */ ● iterations = 1000 + (int) (1000.0 * rand() / (RAND_MAX + 1.0)); /* ← これが怪しい. */ ● /* 略. */ ● ● if (!create_cipher (login, calgo, halgo, salt, sizeof (salt), iterations, &cipher)) /* ← ここで落ちている. */ ● return FALSE; ● 上記のコードなのですが私が読んだ限りではiterationsには1000から2000の値が入ると見たのですが、実際には、 ● ● (gdb) print iterations ● $15 = 2147484648 ● パルプンテ!パルプンテ!パルプンテ!
  • 14. ふと思った (1 月 25 日 ) ● 浮動小数点数まわりの扱いがおかしいので はないか ? ● IA-32 の CPU の仕様の勉強を始めた。 ● 「 IA-32 インテル ? アーキテクチャソフト ウェア?デベロッパーズ?マニュアル」 ● http://www.intel.co.jp/content/www/jp/ja/develo
  • 15. GDB で追いかける。 ● Info float ● 普段は Empty(gdb) info float R7: Empty 0x4008ffffff8b0dffffff8030ffffff98000000 R6: Empty 0x00000000000000000000 R5: Empty 0x00000000000000000000 R4: Empty 0x00000000000000000000 R3: Empty 0x00000000000000000000 R2: Empty 0x00000000000000000000 R1: Empty 0x00000000000000000000 =>R0: Empty 0x00000000000000000000 ● …しかし
  • 16. FPU …レジスタが ● FPU レジスタが全て使われてしまって いる。(gdb) info float =>R7: Special 0xffffffffffffffffffffffc000000000000000 Real Indefinite (QNaN) R6: Zero 0x00000000000000000000 +0 R5: Zero 0x00000000000000000000 +0 R4: Zero 0x00000000000000000000 +0 R3: Zero 0x00000000000000000000 +0 R2: Zero 0x00000000000000000000 +0 R1: Special 0xffffffffffffffff0000000000000000 Unsupported R0: Special 0xffffffffffffffff0000000000000000 Unsupported ● 何故だ ? --; ● だが、問題を追いかけるトリガーが出来た。 ● 後はただひたすらに処理を追いかけるだけ。
  • 17. 問題個所特定 (1 月 26 日 ) ● gcry_cipher_encrypt (cipher, dest, input->len, input->buf, input->len) ● libgcrypt11:i386 1.5.0-3ubuntu1 の関数 ● 再現プログラムを書いた。 ● Bug report: https://bugs.launchpad.net/ubuntu/+source/libgcr
  • 18. さらに問題個所を絞り込む (1 月 27 日 ) ● /build/buildd/libgcrypt11-1.5.0/cipher/rijndael.c の_gcry_aes_cbc_enc ()でaesni_cleanup() を呼び出しているところ で、全てのx87 FPUデータレジスタが使用されていました。 ● ● void ● _gcry_aes_cbc_enc (void *context, unsigned char *iv, ● void *outbuf_arg, const void *inbuf_arg, ● unsigned int nblocks, int cbc_mac) ● { ● /* 略. */ ● aesni_cleanup (); /* <- ここ. */ ● ● _gcry_burn_stack (48 + 2*sizeof(int)); ● }
  • 19. マクロでした ● # define aesni_cleanup() ● do { asm volatile ("pxor %%xmm0, %%xmm0nt" ● "pxor %%xmm1, %%xmm1nt" :: ); ● } while (0) ● ● pxor - http://softwaretechnique.web.fc2.com/OS_Development/Tips/IA32_MMX_Instruction ● 要するに xmm0 と xmm1 を 0 クリアしているだけ。 ●
  • 20. どうしてこうなるのか ● 9.5.1. MMXR 命令とx87 FPU タグワードの関係 ● MMXR 命令の実行後は、必ずx87 FPU タグワード全体がValid (00B )に 設定されてい ● る。 ● 。EMMS 命令(MMX テクノロジ?ステートのクリア命令)を実行すると、 x87 FPU タグワード全体がEmpty (11B )に設定される。 ● http://www.intel.co.jp/content/dam/www/public/ijkk/jp/ja/documents/developer/ ● ● 要するにPXOR の後にEMMS を呼び出すのを忘れている?
  • 21. パッチ書きました ● # define aesni_cleanup() ● do { asm volatile ("pxor %%xmm0, %%xmm0nt" ● "pxor %%xmm1, %%xmm1nt" "emmsn" :: ); ● } while (0) ● ● make check はすべてクリア、 Chrome も落ちることは無くなっ た。 ● …全てはこれで解決するかに見えたが
  • 22. そのパッチ間違ってます ● http://lists.gnupg.org/pipermail/gcrypt-devel/2013-January/002083.html ● ● Jussi Kivilinna jussi.kivilinna at mbnet.fi ● Mon Jan 28 09:49:33 CET 2013 ● ● Those are SSE2 instructions, not MMX. So it does not touch x87 ● registers at all. ● Your bug report shows that you have Pentium-III. It does not support SSE2. ● ● Since PXOR for MMX is encoded with '0F EF' and for SSE2 with '66 0F ● EF', the SSE2 version runs as MMX version on CPUs without SSE2 ● support. The 0x66 byte at front of SSE2-opcode is operand-size ● override prefix and is being ignored on your CPU. ● ● Bug appears to be in _gcry_aes_cbc_enc(), aesni_cleanup() is called ● outside '#ifdef USE_AESNI' and/or 'if (ctr->use_aesni)'. This works on ● most (modern) CPUs, but not those without SSE2 support. ● ●
  • 23. 正しいパッチが出ました (1 月 28 日 ) ● 開発版 (1.6beta):http://lists.gnupg.org/pipermail/gcrypt-devel/2013-January/002084.html ● Version 1.5: http://lists.gnupg.org/pipermail/gcrypt-devel/2013-January/002088.html ● ● - aesni_cleanup (); ● + ● +#ifdef USE_AESNI ● + if (ctx->use_aesni) ● + aesni_cleanup (); ● +#endif /*USE_AESNI*/ ● ● 要するにpxor を呼び出す箇所は#ifdef で囲いctx->use_aesni でチェック。
  • 24. その後当方でやったこと ● パッチのテスト ● パッチの当て方ドキュメント化 (1 月30 日) – https://forums.ubuntulinux.jp/viewtopic.php? pid=96461#p96461 – https://bugs.launchpad.net/ubuntu/ +source/libgcrypt11/+bug/1105758/comments/3
  • 25. その後の状況 ● 正式なパッケージが出始めました。 – Debian's 1.5.0-5 ● そのうち Ubuntu にも落ちてくるでしょう。 – Libgcrypt 1.5.1 released http://lists.gnupg.org/pipermail/gcrypt- devel/2013-March/002109.html – Libgcrypt 1.5.2 released …
  • 26. こうして世のポンコツ PC が救 われたのです。 ● Pentium II とか III とか http://www.ill-f.co.jp/blog/cat6/
  • 27. 所感とか ● Chrome のデバッグは大変よねぇ。 ● IA-32 って変態さんだ。 ( 歴史を背負っ ててぐちゃまら ) ● マクロを小文字で書く文化は滅びろ w
  • 28. Chrome のプロセスについて ● chrome(2910)-+-chrome(2916) ● |-chrome-sandbox(2917)---chrome(2918)-+-chrome(2925)-+-chrome(2975)-+-{chrome}(2979) ● | | | |-{chrome}(2982) ● | | | `-{chrome}(2992) ● | | |-chrome(2985)-+-{chrome}(2989) ● | | | |-{chrome}(2990) ● | | | `-{chrome}(2993) ● | | `-chrome(2994)-+-{chrome}(2997) ● | | |-{chrome}(2998) ● | | `-{chrome}(2999) ● | `-nacl_helper_boo(2924) ● |-{chrome}(2927) ● |-{chrome}(2928) ● |-{chrome}(2929) ● |-{chrome}(2931) ● |-{chrome}(2932) ● |-{chrome}(2933) ● |-{chrome}(2934) ● |-{chrome}(2935) ● |-{chrome}(2936) ● |-{chrome}(2937) ● |-{chrome}(2938) ● |-{chrome}(2939) ● |-{chrome}(2940) ● |-{chrome}(2941) ● |-{chrome}(2943) ● |-{chrome}(2944) ● |-{chrome}(2945) ● |-{chrome}(2946) ● |-{chrome}(2947) ● |-{chrome}(2948) ● |-{chrome}(2971) ● |-{chrome}(2972) ● |-{chrome}(2973) ● |-{chrome}(2974) ● |-{chrome}(2981) ● |-{chrome}(2983) ● |-{chrome}(2984) ● |-{chrome}(2991) ● |-{chrome}(3002) ● |-{chrome}(3003) ● |-{chrome}(3004) ● |-{chrome}(3005) ● |-{chrome}(3009) ● |-{chrome}(3015) ● |-{chrome}(3018) ● |-{chrome}(3019) ● |-{chrome}(3020) ● |-{chrome}(3022) ● |-{chrome}(3023) ● |-{chrome}(3024) ● |-{chrome}(3025) ● `-{chrome}(3028) ● どうデバッグしろと w https://code.google.com/p/chromium/wiki/LinuxDebuggi ng