Re: [PATCH] [GIT PULL] tracing: allow to change permissions fortext with dynamic ftrace enabled

From: Suresh Siddha
Date: Wed Oct 28 2009 - 17:08:50 EST


On Wed, 2009-10-28 at 13:15 -0700, Steven Rostedt wrote:
> On Wed, 2009-10-28 at 11:56 -0800, Suresh Siddha wrote:
> > CPA_DEBUG is setting/clearing unused bit 9. It has no interaction with
> > RW bits. Though the random page and random length selections may end up
>
> Actually it does. When you call the clear_page_attribute, and go to set
> or clear bit 9, the static_protections() function is called against the
> new_prot. This will clear the RW bit if it is set, even if the original
> caller did not touch that bit.

True. It can happen if the debug test or someone does cpa() before we
mark the text as RO.

> > For CONFIG_DEBUG_RODATA, during the boot we change it to RO.
>
> We do that at the end of boot up. I'm sure there's a reason for this :-/

Well, alternate_instructions() is one :(. I am convinced that I should
add a check of kernel_set_to_readonly, and if set, I should prevent the
write attribute for the whole large page mapping kernel text, so that we
don't end up breaking it to small pages..

> Yes, because the code clears the RW bit whenever something changes any
> attribute of that page table. Including bit 9.

Yep, noticed it after your earlier comments.

Will send another patch to fix this too. You are ok with the ftrace
change right? I will send both of these shortly.

thanks,
suresh

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/