Re-send [PATCH] : Validating address in runtime

Srinivasa DS srinivasa@in.ibm.com
Wed Jun 25 18:28:00 GMT 2008


Wenji Huang wrote:
> Srinivasa DS wrote:
>> Wenji Huang wrote:
>>> Hi,
>>>
>>> Regarding PR6646, seems no good way to solve it. I just think maybe 
>>> double checking the address in runtime to make things safer.
>>>
>>> This patch adds validating address vs name mapping in runtime for 
>>> several symbols which are used in initializing process.    So kernel 
>>> oops could be early avoided in case of incorrect vmlinux or wrong 
>>> address.
>>>
>>> Any comments are welcome.
>>>   ........................................
>>  >   .......................................
>>>       return -1;
>>>     }
>>>
>>> +    if (_stp_validate_addr("modules_op", (unsigned long)modules_op))
>>> +      return -1;
>>> +
>>
>> Above mentioned code breaks systemtap on ppc64 systems, Execution of a 
>> basic systemtap script fails with following error. I removed above 3 
>> lines of code and now systemtap works well.
>>
>> [root@llm27lp1 systemtap]# ./stap  -e 'probe 
>> kernel.function("sys_open") { printf("hello\n")}'
>> Error inserting module 
>> '/tmp/stapIrEgpn/stap_be5242edefcfe2d56878f1a090e33b6b_250.ko': 
>> Operation not permitted
>> Pass 5: run failed.  Try again with more '-v' (verbose) options.
>> =========================
>> dmesg shows
>>
>> Systemtap Error at _stp_validate_addr:191 Incorrect mapping 
>> 0xc0000000005da7d0 vs modules_op.
>> Systemtap Error at _stp_transport_init:277 failed to initialize modules
>> ================
>>
>>
>> Thanks
>>  Srinivasa DS.
>>
>>
>>
>>
>>
> Could you show what `cat /proc/kallsyms|grep c0000000005da7d0` says, 
> maybe there are some aliased symbols with same address.

No hit for c0000000005da7d0 in /proc/kallsyms.
[root@llm27lp1 ~]# cat /proc/kallsyms|grep c0000000005da7d0
[root@llm27lp1 ~]#

> 
> sprint_symbols is not the good function to read /proc/kallsyms, but 
> kallsyms_lookup_name isn't exported. I will try to extend 
> _stp_validate_addr to cover aliased symbol case.
> 
> Or any better solution, please let me know.
> 
> Regards,
> Wenji



More information about the Systemtap mailing list