admin管理员组文章数量:1410682
I want to modify the text segment. Using mprotect
, I could make the segment writable and update the required data. This is working fine with ARM64-Linux, but on ARM64-QNX, it is giving permission denied.
if (mprotect(page_start_address, page_size, PROT_READ | PROT_WRITE) == -1)
{
perror("mprotect");
return 1;
}
We are running an application with the root user. Also, we don't want to use mmap as loading text segment of larger application may not feasible solution.
We had set the required program capabilities, which is not giving any error.
int set_process_abilities()
{
// Use ThreadCtl to gain debugging privileges
if (ThreadCtl(_NTO_TCTL_IO, NULL) == -1)
{
perror("ThreadCtl IO failed");
return -1;
}
if (ThreadCtl(_NTO_TCTL_HYP_VCPU, NULL) == -1)
{
perror("ThreadCtl HYP_VCPU failed");
return -1;
}
// Get all debugging capabilities in a safer way
int ret = procmgr_ability(0,
PROCMGR_ADN_ROOT | PROCMGR_AOP_ALLOW | PROCMGR_AID_PROT_EXEC,
PROCMGR_ADN_ROOT | PROCMGR_AOP_ALLOW | PROCMGR_AID_MEM_GLOBAL,
PROCMGR_ADN_ROOT | PROCMGR_AOP_ALLOW | PROCMGR_AID_PROT_WRITE_AND_EXEC,
PROCMGR_ADN_ROOT | PROCMGR_AOP_ALLOW | PROCMGR_AID_INTERRUPT,
PROCMGR_ADN_ROOT | PROCMGR_AOP_ALLOW | PROCMGR_AID_PRIORITY,
PROCMGR_ADN_ROOT | PROCMGR_AOP_ALLOW | PROCMGR_AID_IO,
PROCMGR_ADN_ROOT | PROCMGR_AOP_ALLOW | PROCMGR_AID_TRACE,
PROCMGR_ADN_ROOT | PROCMGR_AOP_ALLOW | PROCMGR_AID_MEM_PHYS,
PROCMGR_ADN_ROOT | PROCMGR_AOP_ALLOW | PROCMGR_AID_MEM_PEER,
PROCMGR_ADN_ROOT | PROCMGR_AOP_ALLOW | PROCMGR_AID_CONFSET,
PROCMGR_ADN_ROOT | PROCMGR_AOP_ALLOW | PROCMGR_AID_HYP,
PROCMGR_ADN_ROOT | PROCMGR_AOP_ALLOW | PROCMGR_AID_MEM_LOCK,
PROCMGR_AID_EOL);
if (ret < 0)
{
perror("Failed to set process abilities");
return -1;
}
printf("Initial program ability ret code %d\n", ret);
return ret;
}
We have tried to explore the procnto attributes, but this has not resolved the issue either.
pidin arg | grep procnto is: procnto-smp-instr -mgw -wx -F 70000
本文标签: ARM64QNXMprotect give permission deniedStack Overflow
版权声明:本文标题:ARM64-QNX : Mprotect give permission denied - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744970377a2635198.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论