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
--