回文章列表
作者suglwu.bbs@bbs.sayya.org (suglwu) 看板: linux
標題Re: [問題] 無法在 .profile 內設置 LD_PRELOAD
時間SayYA 資訊站 (2008/03/18 Tue 11:42:34)
※ 引述《mantour.bbs@ptt.cc (朱子)》之銘言:
> ※ 引述《suglwu.bbs@bbs.sayya.org (suglwu)》之銘言:
> : 不知道 Kubuntu 是不是有什麼特別設計
> : 但在 ubuntu default 應該是 ".bash_profile" 這個檔案
> : 測試
> : * 新增 export LD_PRELOAD="test" 到 .bash_profile
> :     vi .bash_profile
> :     export LD_PRELOAD="test"
> : * 重新 login 後 (這邊是利用 ssh login 而沒有重開機)
> :     :~$ export |grep LD_PRELOAD
> :     ERROR: ld.so: object 'test' from LD_PRELOAD cannot be preloaded: ignored.
> :     declare -x LD_PRELOAD="test"
> 謝謝
> 不過這個我也試過了
> 不管是 .bash_profile , .bash_login 都試過了
> system wide 的 /etc/profile , /etc/environment 也都試過了
> 都是一樣的情況
> 目前只有設在 .bashrc 的有效,但只對從konsole執行的程式有效
> 同一個程式如果從圖形介面開啟的話就不會受到LD_PRELOAD的影響
> 而這不是我想要的結果


根據 [1] 的說明

<quote>
KDE has an extra twist. A while ago, KDE processes were started with the
"kdeinit" wrapper. Now we have "start_kdeinit" which is a SUID-wrapper around
the kdeinit wrapper. "start_kdeinit" does some magic to "prevent getting
killed by bad heuristic in Linux OOM-killer" (quote from the source code),
then drops root privileges and calls kdeinit. And, of course, since it is a
SUID program, it drops LD_PRELOAD.
Way out: Edit /usr/bin/startkde and replace "start_kdeinit" by "kdeinit".
</quote>

因為安全因素 SUID program 會移除 LD_PRELOAD
start_kdeinit 這個 wrapper 是個 SUID program 所以移除 LD_PRELOAD 這個變數

請試看看 [1] 與 [2] 提到的兩個 workaround

* 別用 start_kdeinit 這個 wrapper
* 移除 start_kdeinit 的 SUID

<quote>
------- Additional Comments From l.lunak kde org  2007-06-21 14:17 -------
Already fixed. Remove suid from $KDEDIR/bin/start_kdeinit as a workaround.
</quote>


PS: 還未經驗證。

[1] http://www.math.uni-leipzig.de/~hellmund/sunray.shtml
[2] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=425741


--
我是路過的路人
--
※ Origin: SayYA 資訊站 <bbs.sayya.org> 
◆ From: adsl-218-211-15-237.nh.sparqnet.net
文章選讀←離開[主題上]主題下(k)上篇(j)下篇S/a搜尋 G串列 TAB精華 ↑↓捲 Pg/Space翻