kdb
[Top] [All Lists]

Re: [PATCH] access user space addresses/switch process context

To: vamsi@xxxxxxxxxx
Subject: Re: [PATCH] access user space addresses/switch process context
From: Keith Owens <kaos@xxxxxxx>
Date: Wed, 16 Apr 2003 23:01:19 +1000
Cc: kdb <kdb@xxxxxxxxxxx>
In-reply-to: Your message of "Wed, 16 Apr 2003 17:31:33 +0530." <20030416173132.A25486@in.ibm.com>
Sender: kdb-bounce@xxxxxxxxxxx
On Wed, 16 Apr 2003 17:31:33 +0530, 
"Vamsi Krishna S ." <vamsi@xxxxxxxxxx> wrote:
>diff -urN -X /home/vamsi/.dontdiff 2420-kdb4.1-pure/kdb/kdbsupport.c 
>2420-kdb4.1/kdb/kdbsupport.c
>--- 2420-kdb4.1-pure/kdb/kdbsupport.c  2003-04-16 11:38:14.000000000 +0530
>+++ 2420-kdb4.1/kdb/kdbsupport.c       2003-04-16 12:56:42.000000000 +0530
>+/*
>+ * from mm/memory.c, adapted to run without any locks to work within kdb
>+ */
>+static struct page * kdb_follow_page(struct mm_struct *mm, unsigned long 
>address, int write) 

AFAICT this function is identical to follow_page().  Instead of
duplicating that code and possibly getting out of sync with the real
follow_page(), change follow_page() so it is extern for CONFIG_KDB=y,
otherwise it is static.

>+static struct page * kdb_get_one_user_page(struct task_struct *tsk, unsigned 
>long start,
>+              int len, int write)

Why have a write flag?  KDB will only read user pages, or are you
planning more changes that will require write access?

>+      /* shouldn't cross a page boundary. temporary restriction. */
>+      if ((from & PAGE_MASK) != ((from+size) & PAGE_MASK)) {
>+              kdb_printf("%s: crosses page boundary: from=%08lx, size=%d\n", 
>+                      __FUNCTION__, from, size);
>+              return size;
>+      }

'return size' changes the semantics of __kdba_getarea_size.  Currently
it returns 0 or a negative error code, now you are returning a positive
value on an error.  Why?  Any failure to get a user page should return
-EFAULT, the same as a kernel page.


<Prev in Thread] Current Thread [Next in Thread>