From: Linus Torvalds <torvalds@linux-foundation.org>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Jiri Slaby <jirislaby@gmail.com>, linux-kernel@vger.kernel.org
Subject: Re: GIT head no longer boots on x86-64
Date: Mon, 13 Oct 2008 08:03:47 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.2.00.0810130752020.3288@nehalem.linux-foundation.org> (raw)
In-Reply-To: <20081013143502.01f3f526@lxorguk.ukuu.org.uk>
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);
next prev parent reply other threads:[~2008-10-13 15:04 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-13 9:23 GIT head no longer boots on x86-64 Alan Cox
2008-10-13 10:13 ` Jiri Slaby
2008-10-13 10:20 ` Alan Cox
2008-10-13 10:56 ` Jiri Slaby
2008-10-13 13:35 ` Alan Cox
2008-10-13 15:03 ` Linus Torvalds [this message]
2008-10-13 15:11 ` Jiri Slaby
2008-10-13 15:47 ` Alan Cox
2008-10-15 11:51 ` Ingo Molnar
2008-10-15 13:19 ` Jiri Slaby
2008-10-15 15:06 ` Linus Torvalds
2008-10-15 15:33 ` Jiri Slaby
2008-10-15 16:01 ` Linus Torvalds
2008-10-15 20:31 ` Arjan van de Ven
2008-10-15 15:35 ` Linus Torvalds
2008-10-16 10:31 ` H. Peter Anvin
2008-10-13 14:45 ` Linus Torvalds
2008-10-13 14:50 ` Jiri Slaby
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LFD.2.00.0810130752020.3288@nehalem.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=jirislaby@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox