当前位置: 技术问答>linux和unix
奇怪,一SO存放在/mnt/WinFat32 跟存放在 /root/mytest下,运行结果竟然不一样?
来源: 互联网 发布时间:2016-07-14
本文导语: 有一别人提供的so (a1.so)文件,我写了一个测试程序调用了此so的一些函数,当把这些程序(包括so)存放在 我挂载的盘(FAT32 格式的)的时候,运行正常. 当我把这些程序复制到linux系统(Fedora11)中的root目录下,再运行此程序,会...
有一别人提供的so (a1.so)文件,我写了一个测试程序调用了此so的一些函数,当把这些程序(包括so)存放在 我挂载的盘(FAT32 格式的)的时候,运行正常.
当我把这些程序复制到linux系统(Fedora11)中的root目录下,再运行此程序,会有以下的错误提示:
概述:
SELinux is preventing TestRP from loading /root/testrp/TestSRC/a1.so
which requires text relocation.
详细描述:
The TestRP application attempted to load /root/testrp/TestSRC/a1.so
which requires text relocation. This is a potential security problem. Most
libraries do not need this permission. Libraries are sometimes coded incorrectly
and request this permission. The SELinux Memory Protection Tests
(http://people.redhat.com/drepper/selinux-mem.html) web page explains how to
remove this requirement. You can configure SELinux temporarily to allow
/root/testrp/TestSRC/a1.so to use relocation as a workaround, until
the library is fixed. Please file a bug report
(http://bugzilla.redhat.com/bugzilla/enter_bug.cgi) against this package.
允许访问:
If you trust /root/testrp/TestSRC/a1.so to run correctly, you can
change the file context to textrel_shlib_t. "chcon -t textrel_shlib_t
'/root/testrp/TestSRC/a1.so'" You must also change the default file
context files on the system in order to preserve them even on a full relabel.
"semanage fcontext -a -t textrel_shlib_t
'/root/testrp/TestSRC/a1.so'"
Fix 命令:
chcon -t textrel_shlib_t '/root/testrp/TestSRC/a1.so'
我按照这边的提示,运行了以下两条语句:
chcon -t textrel_shlib_t '/root/testrp/TestSRC/a1.so'
semanage fcontext -a -t textrel_shlib_t
'/root/testrp/TestSRC/a1.so'
再运行,还是继续提示这样的错误.请问各位兄弟有啥好方法?或者帮忙解释一下该现象.
当我把这些程序复制到linux系统(Fedora11)中的root目录下,再运行此程序,会有以下的错误提示:
概述:
SELinux is preventing TestRP from loading /root/testrp/TestSRC/a1.so
which requires text relocation.
详细描述:
The TestRP application attempted to load /root/testrp/TestSRC/a1.so
which requires text relocation. This is a potential security problem. Most
libraries do not need this permission. Libraries are sometimes coded incorrectly
and request this permission. The SELinux Memory Protection Tests
(http://people.redhat.com/drepper/selinux-mem.html) web page explains how to
remove this requirement. You can configure SELinux temporarily to allow
/root/testrp/TestSRC/a1.so to use relocation as a workaround, until
the library is fixed. Please file a bug report
(http://bugzilla.redhat.com/bugzilla/enter_bug.cgi) against this package.
允许访问:
If you trust /root/testrp/TestSRC/a1.so to run correctly, you can
change the file context to textrel_shlib_t. "chcon -t textrel_shlib_t
'/root/testrp/TestSRC/a1.so'" You must also change the default file
context files on the system in order to preserve them even on a full relabel.
"semanage fcontext -a -t textrel_shlib_t
'/root/testrp/TestSRC/a1.so'"
Fix 命令:
chcon -t textrel_shlib_t '/root/testrp/TestSRC/a1.so'
我按照这边的提示,运行了以下两条语句:
chcon -t textrel_shlib_t '/root/testrp/TestSRC/a1.so'
semanage fcontext -a -t textrel_shlib_t
'/root/testrp/TestSRC/a1.so'
再运行,还是继续提示这样的错误.请问各位兄弟有啥好方法?或者帮忙解释一下该现象.
|
倒霉的selinux啊。感觉是最垃圾的一个功能。
先关掉selinux,在运行看看。是不是真的出在selinux权限上。
#setenfocre 0
如果运行ok。再打开selinux,尝试修改文件权限。(采用参照的方式。)
#setenfoce 1
#chcon --reference 挂载的盘下的a1.so的路径 /root/testrp/TestSRC/a1.so
先关掉selinux,在运行看看。是不是真的出在selinux权限上。
#setenfocre 0
如果运行ok。再打开selinux,尝试修改文件权限。(采用参照的方式。)
#setenfoce 1
#chcon --reference 挂载的盘下的a1.so的路径 /root/testrp/TestSRC/a1.so
|
o
|
我是来顶分的,呵呵
|
哦,是访问权限问题。