Re: [PATCH] x86 Fix text_poke for vmalloced pages

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Ingo Molnar
Date: Friday, March 21, 2008 - 2:38 am

* Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:



hm, this looks ugly, and the whole text_poke() function looks ugly. For 
example why the extra code block + indentation here:

+void *__kprobes text_poke(void *addr, const void *opcode, size_t len)
+{
+       unsigned long flags;
+       char *vaddr;
+       int nr_pages = 2;
+
+       BUG_ON(len > sizeof(long));
+       BUG_ON((((long)addr + len - 1) & ~(sizeof(long) - 1))
+               - ((long)addr & ~(sizeof(long) - 1)));
+       {
+               struct page *pages[2] = { virt_to_page(addr),
+                       virt_to_page(addr + PAGE_SIZE) };

also, more fundamentally - why not introduce a proper, generic "look up 
kernel text struct page *" method, instead of open-coding various 
assumptions about which kernel text is readonly and which isnt?

	Ingo
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] x86 Fix text_poke for vmalloced pages, Mathieu Desnoyers, (Wed Mar 19, 5:39 pm)
Re: [PATCH] x86 Fix text_poke for vmalloced pages, Ingo Molnar, (Fri Mar 21, 2:38 am)
Re: [PATCH] x86 Fix text_poke for vmalloced pages, Mathieu Desnoyers, (Mon Mar 24, 10:02 am)