有没有一种方法可以将kptr_restrict设置为0? [英] Is there a way to set kptr_restrict to 0?
问题描述
我目前在运行linux perf时遇到问题,主要是因为/proc/sys/kernel/kptr_restrict
当前设置为1.
I am currently having trouble running linux perf, mostly because /proc/sys/kernel/kptr_restrict
is currently set to 1.
但是,如果我尝试通过如下方式将0回显到/proc/sys/kernel/kptr_restrict
...
However, if I try to /proc/sys/kernel/kptr_restrict
by echoing 0 to it as follows...
echo 0 > /proc/sys/kernel/kptr_restrict
我收到一个权限被拒绝的错误.我也不认为可以更改其权限.
I get a permission denied error. I don't think I can change permissions on it either.
是否可以通过某种方式直接设置此设置?我是超级用户.我认为,如果不设置此功能,性能将无法令人满意.
Is there a way to set this directly somehow? I am super user. I don't think perf will function acceptably without this being set.
推荐答案
在您的示例中,echo
以root身份运行,但您的shell却以您的身份运行.
In your example, echo
is running as root, but your shell is running as you.
因此,请尝试以下命令:
So please try this command:
sudo sh -c " echo 0 > /proc/sys/kernel/kptr_restrict"
这篇关于有没有一种方法可以将kptr_restrict设置为0?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!