prctl parameters not being passed to kernel

Salvatore CRO' salvatore.cro at st.com
Thu Jun 17 10:09:09 UTC 2010


Khem Raj wrote:
> On Wed, Jun 16, 2010 at 12:02 PM, Khem Raj <raj.khem at gmail.com> wrote:
>   
>> On Wed, Jun 9, 2010 at 6:15 PM, Daniel Ng <daniel.ng1234 at gmail.com> wrote:
>>     
>>> Hi,
>>>
>>> I'm using Linux kernel 2.6.30.3 with uClibc 0.9.30.1, on a powerpc (mpc8272)
>>> platform.
>>>
>>> It looks like the prctl parameters are not being passed to the kernel properly,
>>> regardless of the the prctl operation I specify.
>>>
>>> For example, in the kernel (kernel/sys.c), I have inserted a printk to print out
>>> arg2:
>>>
>>>    case PR_SET_PDEATHSIG:
>>>        printk("PR_SET_PDEATHSIG: 0x%lx\n", arg2);
>>>        if (!valid_signal(arg2)) {
>>>            error = -EINVAL;
>>>            break;
>>>        }
>>>
>>> -but arg2 always seems to be 0.
>>>
>>> This is how I call prctl in userspace:
>>>
>>>    status = prctl(PR_SET_PDEATHSIG, SIGHUP, NULL, NULL, NULL);
>>>
>>> I've also tried the following:
>>>
>>>    status = prctl(PR_SET_PDEATHSIG, 1, NULL, NULL, NULL);
>>>
>>>    status = prctl(PR_SET_PDEATHSIG, SIGHUP);
>>>
>>>    status = prctl(PR_SET_PDEATHSIG, 1);
>>>
>>> -they all result in the kernel seeing arg2 as 0.
>>>
>>> Is there something I'm missing, or is this a genuine uClibc bug,
>>> or something else?
>>>
>>>       
>
> OK I had a chance to have ppc qemu system to look into it using uclibc
> git/linux 2.6.34
>
> the registers before the sc (system call) look correct to me
>
> (gdb) i registers
> r0             0xab     171
> r1             0xbfeba0d0       3219890384
> r2             0x4800f440       1208022080
> r3             0x1      1
> r4             0x1      1
> r5             0x0      0
> r6             0x0      0
> r7             0x0      0
>
> here r0 contains the syscall number which is 171 =  __NR_prctl
>
> and the arguments start from r3 onwards which means r4 contains are
> second argument
> and seems to be ok.
>
> This is the lame test I executed
>
> #include <sys/prctl.h>
> #include <stdio.h>
> int main ()
> {
>     return prctl(PR_SET_PDEATHSIG, 1, NULL, NULL, NULL);
> }
>
> so as you can see r4 contains the second argument which is 1
>
>
>   

I did the same on a sh4 box which runs a 2.6.32-based kernel and got 
param correctly passed.

>
>   
>> I only tried it on mips arch here and uclibc seems to pass correct
>> parameters to the syscall. I dont
>> have ppc system handy so cant test it right now however I would ask
>> you to reproduce it on latest
>> master on git if you could do that it will help.
>>
>> Thanks
>>
>> -Khem
>>
>>     
>>> _______________________________________________
>>> uClibc mailing list
>>> uClibc at uclibc.org
>>> http://lists.busybox.net/mailman/listinfo/uclibc
>>>
>>>       
> _______________________________________________
> uClibc mailing list
> uClibc at uclibc.org
> http://lists.busybox.net/mailman/listinfo/uclibc
>   



More information about the uClibc mailing list