On Fri, May 27, 2016 at 06:10:26AM +0000, Luke Small wrote:
> Pledge does something odd, that I don't understand by reading the man page.
> It trips the system-call: SYS_PROFIL (44) when it ends its run in
> codeblocks IDE when profiling is enabled. Can I enable a pledge setting
> that enables this to complete? Is there a security reason that pledge is
> disabling profiling?

Currently, profil(2) syscall isn't allowed in a pledged program. We had
a previous discussion about that before (but I don't recall if it was on
public mailing-list or not).

The reason is pledge(2) allows only a subset of syscalls to be called.

For now, as workaround, you could build the program you want to profil
with:

 cc -g -D'pledge(pr,pa)=_nopledge'

This trick *should* work: the pledge definition in unistd.h will be
"changed" to variable declaration, and the pledge call will be "changed"
to access to the variable.

I hope it helps.
-- 
Sebastien Marie

Reply via email to