lkml.org 
[lkml]   [2013]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/5] kprobes: constify check_kprobe_address_safe and friends
Hello Masami,

Thank you for your review!

My comments are below.

On 01/21/2013 06:49 AM, Masami Hiramatsu wrote:
> (2013/01/10 8:09), Sasha Levin wrote:
>> @@ -278,7 +278,7 @@ static int __kprobes can_optimize(unsigned long paddr)
>> }
>>
>> /* Check optimized_kprobe can actually be optimized. */
>> -int __kprobes arch_check_optimized_kprobe(struct optimized_kprobe *op)
>> +int __kprobes arch_check_optimized_kprobe(const struct optimized_kprobe *op)
>> {
>> int i;
>> struct kprobe *p;
>
> This can be change optimized_kprobe inside, e.g. change flags.
> IMHO, I don't like to change this interface.

[snip]

>> -static __kprobes int check_kprobe_address_safe(struct kprobe *p,
>> +static __kprobes int check_kprobe_address_safe(const struct kprobe *p,
>> struct module **probed_mod)
>> {
>> int ret = 0;
>>
>
> No, p is NOT constant in this function. This changes p->flags.
>
> ---
> #ifdef KPROBES_CAN_USE_FTRACE
> /* Given address is not on the instruction boundary */
> if ((unsigned long)p->addr != ftrace_addr)
> return -EILSEQ;
> p->flags |= KPROBE_FLAG_FTRACE;
> #else /* !KPROBES_CAN_USE_FTRACE */

As to arch_check_optimized_kprobe() and check_kprobe_address_safe(), this
is simply way too confusing. It doesn't make sense that a function named
check_[...]() would modify any of it's parameters.

For example, that entire block within KPROBES_CAN_USE_FTRACE should be split
out and go into update_kprobe_for_ftrace() or something similar.

If that makes sense, I can send a patch to split out all the parts that
modify anything in those two functions out of them.


Thanks,
Sasha


\
 
 \ /
  Last update: 2013-01-25 05:41    [W:0.147 / U:4.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site