* [PATCH][2.5.47]Add exported valid_kernel_address()
@ 2002-11-13 20:13 Rusty Lynch
2002-11-13 20:46 ` Arjan van de Ven
0 siblings, 1 reply; 5+ messages in thread
From: Rusty Lynch @ 2002-11-13 20:13 UTC (permalink / raw)
To: alan; +Cc: linux-kernel
The following is a small patch to the 2.5.47 kernel that adds an exported
function called valid_kernel_address() that allows kernel code to verify
a kernel-mapped address is valid.
valid_kernel_address just calls the static inline kernel_text_address()
function defined in arch/i386/kernel/traps.c
-rustyl
diff -urN linux-2.5.47/arch/i386/kernel/i386_ksyms.c linux-2.5.47-vka-patch/arch/i386/kernel/i386_ksyms.c
--- linux-2.5.47/arch/i386/kernel/i386_ksyms.c 2002-11-10 19:28:32.000000000 -0800
+++ linux-2.5.47-vka-patch/arch/i386/kernel/i386_ksyms.c 2002-11-13 11:46:49.000000000 -0800
@@ -59,6 +59,8 @@
extern unsigned long cpu_khz;
extern unsigned long get_cmos_time(void);
+extern int valid_kernel_address(unsigned long addr);
+
/* platform dependent support */
EXPORT_SYMBOL(boot_cpu_data);
#ifdef CONFIG_EISA
@@ -91,6 +93,7 @@
EXPORT_SYMBOL(get_cmos_time);
EXPORT_SYMBOL(cpu_khz);
EXPORT_SYMBOL(apm_info);
+EXPORT_SYMBOL(valid_kernel_address);
#ifdef CONFIG_DEBUG_IOVIRT
EXPORT_SYMBOL(__io_virt_debug);
diff -urN linux-2.5.47/arch/i386/kernel/traps.c linux-2.5.47-vka-patch/arch/i386/kernel/traps.c
--- linux-2.5.47/arch/i386/kernel/traps.c 2002-11-10 19:28:05.000000000 -0800
+++ linux-2.5.47-vka-patch/arch/i386/kernel/traps.c 2002-11-13 11:51:58.000000000 -0800
@@ -129,6 +129,11 @@
#endif
+int valid_kernel_address(unsigned long addr)
+{
+ return kernel_text_address(addr);
+}
+
void show_trace(unsigned long * stack)
{
int i;
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH][2.5.47]Add exported valid_kernel_address() 2002-11-13 20:13 [PATCH][2.5.47]Add exported valid_kernel_address() Rusty Lynch @ 2002-11-13 20:46 ` Arjan van de Ven 0 siblings, 0 replies; 5+ messages in thread From: Arjan van de Ven @ 2002-11-13 20:46 UTC (permalink / raw) To: Rusty Lynch; +Cc: alan, linux-kernel [-- Attachment #1: Type: text/plain, Size: 487 bytes --] On Wed, 2002-11-13 at 21:13, Rusty Lynch wrote: > The following is a small patch to the 2.5.47 kernel that adds an exported > function called valid_kernel_address() that allows kernel code to verify > a kernel-mapped address is valid. > > valid_kernel_address just calls the static inline kernel_text_address() > function defined in arch/i386/kernel/traps.c > it is customary that people who ask for an export explain why they need it.... would you mind explaining that ? [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <200211132013.gADKDhS01389@linux.intel.com.suse.lists.linux.kernel>]
[parent not found: <1037220406.2889.4.camel@localhost.localdomain.suse.lists.linux.kernel>]
* Re: [PATCH][2.5.47]Add exported valid_kernel_address() [not found] ` <1037220406.2889.4.camel@localhost.localdomain.suse.lists.linux.kernel> @ 2002-11-13 21:14 ` Andi Kleen 2002-11-13 21:24 ` Rusty Lynch 0 siblings, 1 reply; 5+ messages in thread From: Andi Kleen @ 2002-11-13 21:14 UTC (permalink / raw) To: Arjan van de Ven; +Cc: linux-kernel, rusty Arjan van de Ven <arjanv@redhat.com> writes: > it is customary that people who ask for an export explain why they need > it.... would you mind explaining that ? For modular lkcd I guess. Make a lot of sense to do it modular. -Andi ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH][2.5.47]Add exported valid_kernel_address() 2002-11-13 21:14 ` Andi Kleen @ 2002-11-13 21:24 ` Rusty Lynch 2002-11-13 22:30 ` Rusty Lynch 0 siblings, 1 reply; 5+ messages in thread From: Rusty Lynch @ 2002-11-13 21:24 UTC (permalink / raw) To: Arjan van de Ven, Andi Kleen; +Cc: linux-kernel, rusty I had a need for it in a sample kprobes driver where I wanted to verify that some address was a valid kernel space address before I handed a probe to kprobes. So I would do something like: if (!valid_kernel_address(probe->addr)) { ret = -EINVAL; goto out; } register_kprobe(probe); and then kpboes will go and attempt to set *(probe->addr) = BREAK_POINT; -rustyl ----- Original Message ----- From: "Andi Kleen" <ak@suse.de> To: "Arjan van de Ven" <arjanv@redhat.com> Cc: <linux-kernel@vger.kernel.org>; <rusty@linux.co.intel.com> Sent: Wednesday, November 13, 2002 1:14 PM Subject: Re: [PATCH][2.5.47]Add exported valid_kernel_address() > Arjan van de Ven <arjanv@redhat.com> writes: > > > it is customary that people who ask for an export explain why they need > > it.... would you mind explaining that ? > > For modular lkcd I guess. Make a lot of sense to do it modular. > > -Andi ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH][2.5.47]Add exported valid_kernel_address() 2002-11-13 21:24 ` Rusty Lynch @ 2002-11-13 22:30 ` Rusty Lynch 0 siblings, 0 replies; 5+ messages in thread From: Rusty Lynch @ 2002-11-13 22:30 UTC (permalink / raw) To: Rusty Lynch, Arjan van de Ven, Andi Kleen; +Cc: linux-kernel, rusty To clarify further, I am talking about the sample driver I submitted earlier at http://marc.theaimsgroup.com/?l=linux-kernel&m=103721364225087&w=2 The patch implements a char device that enables arbitrary printk's to be inserted at in arbitrary kernel addresses. It is used by writing strings of the form "0xADDRESS MESSAGE" to the device. I was looking for a way to verify the address passed in was valid before creating and inserting a new probe. Maybe there is a better way to verify a kernel address is valid before messing with it? -rusty ----- Original Message ----- From: "Rusty Lynch" <rusty@linux.co.intel.com> To: "Arjan van de Ven" <arjanv@redhat.com>; "Andi Kleen" <ak@suse.de> Cc: <linux-kernel@vger.kernel.org>; <rusty@linux.co.intel.com> Sent: Wednesday, November 13, 2002 1:24 PM Subject: Re: [PATCH][2.5.47]Add exported valid_kernel_address() > I had a need for it in a sample kprobes driver where I wanted to verify that > some address > was a valid kernel space address before I handed a probe to kprobes. > > So I would do something like: > > if (!valid_kernel_address(probe->addr)) { > ret = -EINVAL; > goto out; > } > > register_kprobe(probe); > > and then kpboes will go and attempt to set *(probe->addr) = BREAK_POINT; > > -rustyl > ----- Original Message ----- > From: "Andi Kleen" <ak@suse.de> > To: "Arjan van de Ven" <arjanv@redhat.com> > Cc: <linux-kernel@vger.kernel.org>; <rusty@linux.co.intel.com> > Sent: Wednesday, November 13, 2002 1:14 PM > Subject: Re: [PATCH][2.5.47]Add exported valid_kernel_address() > > > > Arjan van de Ven <arjanv@redhat.com> writes: > > > > > it is customary that people who ask for an export explain why they need > > > it.... would you mind explaining that ? > > > > For modular lkcd I guess. Make a lot of sense to do it modular. > > > > -Andi > > - > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-11-13 22:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-13 20:13 [PATCH][2.5.47]Add exported valid_kernel_address() Rusty Lynch
2002-11-13 20:46 ` Arjan van de Ven
[not found] <200211132013.gADKDhS01389@linux.intel.com.suse.lists.linux.kernel>
[not found] ` <1037220406.2889.4.camel@localhost.localdomain.suse.lists.linux.kernel>
2002-11-13 21:14 ` Andi Kleen
2002-11-13 21:24 ` Rusty Lynch
2002-11-13 22:30 ` Rusty Lynch
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox