lkml.org 
[lkml]   [2008]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: GIT head no longer boots on x86-64


On Mon, 13 Oct 2008, Alan Cox wrote:

> On Mon, 13 Oct 2008 12:56:54 +0200
> Jiri Slaby <jirislaby@gmail.com> wrote:
>
> > Could you try the debug patch below to see what address is text_poke trying
> > to translate?
>
> BUG? vmalloc_to_page (from text_poke+0x30/0x14a): ffffffffa01e40b1

Hmm. Last page of code being fixed up, perhaps?

Does this fix it?

(Totally untested. Of course.)

Linus

---
arch/x86/kernel/alternative.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index fb04e49..f4a8870 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -498,23 +498,22 @@ void *text_poke_early(void *addr, const void *opcode, size_t len)
*/
void *__kprobes text_poke(void *addr, const void *opcode, size_t len)
{
- unsigned long flags;
+ unsigned long flags, offset;
char *vaddr;
- int nr_pages = 2;
struct page *pages[2];
- int i;
+ int i, nr_pages;

+ offset = (unsigned long) addr & ~PAGE_MASK;
+ nr_pages = (offset + len) > PAGE_SIZE ? 2 : 1;
if (!core_kernel_text((unsigned long)addr)) {
pages[0] = vmalloc_to_page(addr);
- pages[1] = vmalloc_to_page(addr + PAGE_SIZE);
+ pages[1] = vmalloc_to_page(addr + len - 1);
} else {
pages[0] = virt_to_page(addr);
WARN_ON(!PageReserved(pages[0]));
- pages[1] = virt_to_page(addr + PAGE_SIZE);
+ pages[1] = pages[0]+1;
}
BUG_ON(!pages[0]);
- if (!pages[1])
- nr_pages = 1;
vaddr = vmap(pages, nr_pages, VM_MAP, PAGE_KERNEL);
BUG_ON(!vaddr);
local_irq_save(flags);

\
 
 \ /
  Last update: 2008-10-13 17:07    [W:0.085 / U:0.228 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site