Re: [patch 1/2] kprobes i386 quick fix mark-ro-data

2007-06-19 Thread Andi Kleen

> Please find the quick fix as per your suggestion below.

I've already done it myself. But I ended up doing it the other
way around -- making DEBUG_RODATA dependent on !KPROBES
because I figured KPROBES is more important than DEBUG_RODATA
and it is less confusing for the user this way.

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


Re: [patch 1/2] kprobes i386 quick fix mark-ro-data

2007-06-19 Thread S. P. Prasanna
On Mon, Jun 18, 2007 at 09:32:56PM +0200, Andi Kleen wrote:
> On Monday 18 June 2007 20:56:32 Andrew Morton wrote:
> > On Mon, 18 Jun 2007 14:44:57 -0400
> > Chuck Ebbert <[EMAIL PROTECTED]> wrote:
> > 
> > > > I fancy it's done by the kprobe_page_fault handler, but I do not see
> > > > clearly how writing the breakpoint from arch_arm_kprobe() in
> > > > non-writeable memory is done.
> > > 
> > > Looks like it's not merged yet:
> > > 
> > > http://lkml.org/lkml/2007/6/7/2
> > > 
> > > This needs to go in before 2.6.22-final
> > 
> > Andi, I'll include the below two patches in the next batch, OK?
> 
> It won't work reliably unless some of the c_p_a() fixes get in first.
> 
> > 
> > 
> > 
> > +extern int kernel_text_is_ro;
> 
> No externs in .c files
Yes.
> 
> 
> I also don't like kernel_text_is_read_only() much, it would
> be better to just lookup_address() it and check the write flag.

Yes, I will look into this approach.
> 
> But for 2.6.22 as a quick fix it might be better to just
> make KPROBES dependent on !DEBUG_RODATA. That would be a one liner.
> 

Please find the quick fix as per your suggestion below.

Thanks
Prasanna

This patch is a quick fix to enable kprobes only if DEBUG_RODATA is
not configured. Since DEBUG_RODATA markes the kernel text pages as read-only.

Signed-off-by: Prasanna S P. <[EMAIL PROTECTED]>


 arch/i386/Kconfig |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff -puN arch/i386/Kconfig~kprobes-quick-fix-mark-ro-data-i386 
arch/i386/Kconfig
--- linux-2.6.22-rc5/arch/i386/Kconfig~kprobes-quick-fix-mark-ro-data-i386  
2007-06-19 14:55:31.0 +0530
+++ linux-2.6.22-rc5-prasanna/arch/i386/Kconfig 2007-06-19 14:55:31.0 
+0530
@@ -1212,6 +1212,8 @@ source "drivers/Kconfig"
 
 source "fs/Kconfig"
 
+source "arch/i386/Kconfig.debug"
+
 menu "Instrumentation Support"
depends on EXPERIMENTAL
 
@@ -1219,7 +1221,7 @@ source "arch/i386/oprofile/Kconfig"
 
 config KPROBES
bool "Kprobes (EXPERIMENTAL)"
-   depends on KALLSYMS && EXPERIMENTAL && MODULES
+   depends on KALLSYMS && EXPERIMENTAL && MODULES && !DEBUG_RODATA
help
  Kprobes allows you to trap at almost any kernel address and
  execute a callback function.  register_kprobe() establishes
@@ -1228,8 +1230,6 @@ config KPROBES
  If in doubt, say "N".
 endmenu
 
-source "arch/i386/Kconfig.debug"
-
 source "security/Kconfig"
 
 source "crypto/Kconfig"

_
-- 
Prasanna S.P.
Linux Technology Center
India Software Labs, IBM Bangalore
Email: [EMAIL PROTECTED]
Ph: 91-80-41776329
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 1/2] kprobes i386 quick fix mark-ro-data

2007-06-19 Thread S. P. Prasanna
On Mon, Jun 18, 2007 at 09:32:56PM +0200, Andi Kleen wrote:
 On Monday 18 June 2007 20:56:32 Andrew Morton wrote:
  On Mon, 18 Jun 2007 14:44:57 -0400
  Chuck Ebbert [EMAIL PROTECTED] wrote:
  
I fancy it's done by the kprobe_page_fault handler, but I do not see
clearly how writing the breakpoint from arch_arm_kprobe() in
non-writeable memory is done.
   
   Looks like it's not merged yet:
   
   http://lkml.org/lkml/2007/6/7/2
   
   This needs to go in before 2.6.22-final
  
  Andi, I'll include the below two patches in the next batch, OK?
 
 It won't work reliably unless some of the c_p_a() fixes get in first.
 
  
  
  
  +extern int kernel_text_is_ro;
 
 No externs in .c files
Yes.
 
 
 I also don't like kernel_text_is_read_only() much, it would
 be better to just lookup_address() it and check the write flag.

Yes, I will look into this approach.
 
 But for 2.6.22 as a quick fix it might be better to just
 make KPROBES dependent on !DEBUG_RODATA. That would be a one liner.
 

Please find the quick fix as per your suggestion below.

Thanks
Prasanna

This patch is a quick fix to enable kprobes only if DEBUG_RODATA is
not configured. Since DEBUG_RODATA markes the kernel text pages as read-only.

Signed-off-by: Prasanna S P. [EMAIL PROTECTED]


 arch/i386/Kconfig |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff -puN arch/i386/Kconfig~kprobes-quick-fix-mark-ro-data-i386 
arch/i386/Kconfig
--- linux-2.6.22-rc5/arch/i386/Kconfig~kprobes-quick-fix-mark-ro-data-i386  
2007-06-19 14:55:31.0 +0530
+++ linux-2.6.22-rc5-prasanna/arch/i386/Kconfig 2007-06-19 14:55:31.0 
+0530
@@ -1212,6 +1212,8 @@ source drivers/Kconfig
 
 source fs/Kconfig
 
+source arch/i386/Kconfig.debug
+
 menu Instrumentation Support
depends on EXPERIMENTAL
 
@@ -1219,7 +1221,7 @@ source arch/i386/oprofile/Kconfig
 
 config KPROBES
bool Kprobes (EXPERIMENTAL)
-   depends on KALLSYMS  EXPERIMENTAL  MODULES
+   depends on KALLSYMS  EXPERIMENTAL  MODULES  !DEBUG_RODATA
help
  Kprobes allows you to trap at almost any kernel address and
  execute a callback function.  register_kprobe() establishes
@@ -1228,8 +1230,6 @@ config KPROBES
  If in doubt, say N.
 endmenu
 
-source arch/i386/Kconfig.debug
-
 source security/Kconfig
 
 source crypto/Kconfig

_
-- 
Prasanna S.P.
Linux Technology Center
India Software Labs, IBM Bangalore
Email: [EMAIL PROTECTED]
Ph: 91-80-41776329
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 1/2] kprobes i386 quick fix mark-ro-data

2007-06-19 Thread Andi Kleen

 Please find the quick fix as per your suggestion below.

I've already done it myself. But I ended up doing it the other
way around -- making DEBUG_RODATA dependent on !KPROBES
because I figured KPROBES is more important than DEBUG_RODATA
and it is less confusing for the user this way.

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