Hello guys,

#pledge_queries

I have a query regarding #pledge internals.

I read kern_pledge.c file, but, I am not able to figure out the pledge
bit value of a program which isn't using pledge() system call in
user-space code.
Because even after not using pledge() system call in user-space,
still, every process has some default kind of pledge bit value, that
is, 0x8009588f.

Find pledge details of dhclient and slaacd process:

# dmesg|grep dhclient

old_pledge: 8009588f new_pledge: 101068 pid: 4970 name: dhclient
pledge_xbit: 8009588f
old_pledge: 8009588f new_pledge: 101068 pid: 880 name: dhclient
pledge_xbit: 8009588f

# dmesg|grep slaacd

old_pledge: 8009588f new_pledge: 40008 pid: 20726 name: slaacd
pledge_xbit: 8009588f
old_pledge: 8009588f new_pledge: 140048 pid: 32909 name: slaacd
pledge_xbit: 8009588f
old_pledge: 140048 new_pledge: 100048 pid: 32909 name: slaacd
pledge_xbit: 140048
old_pledge: 40008 new_pledge: 8 pid: 20726 name: slaacd pledge_xbit: 40008

And, for verification, I have written two small codes and I tested them:

//sample1
//without pledge()
#include <stdio.h>

void
main () {
while(1) {}
}

//sample2
//with pledge()
#include <stdio.h>

void
main () {
if(pledge("stdio",NULL) == -1) {
err(1,"pledge");
}
while(1) {}
}

Now, both codes have some pledge bit value, that is, for sample2
pledge_bit value is 8 which is correct, but, for sample1 pledge_bit
value is 0x8009588f.
whereas, in sample1 no one is calling pledge() system call then also
it has some pledge value.
And, I don't know why every non-pledge process has only this value.
It seems like there is some default pledge value for every process.

So, please guys give me some hint or update me on something if I
forgot or missed.


-- 
Thank you,

Neeraj Pal

Reply via email to