]> git.openfabrics.org - ~shefty/rdma-dev.git/blobdiff - arch/x86/kernel/alternative.c
x86-64: Modify copy_user_generic() alternatives mechanism
[~shefty/rdma-dev.git] / arch / x86 / kernel / alternative.c
index de7353c0ce9ca5bbb029e513bd55773a6c2396d5..2589ea4c60ce145bfadbb2b925e6f81f85957bd8 100644 (file)
@@ -205,7 +205,7 @@ void __init_or_module apply_alternatives(struct alt_instr *start,
                                         struct alt_instr *end)
 {
        struct alt_instr *a;
-       char insnbuf[MAX_PATCH_LEN];
+       u8 insnbuf[MAX_PATCH_LEN];
 
        DPRINTK("%s: alt table %p -> %p\n", __func__, start, end);
        for (a = start; a < end; a++) {
@@ -223,6 +223,8 @@ void __init_or_module apply_alternatives(struct alt_instr *start,
                }
 #endif
                memcpy(insnbuf, a->replacement, a->replacementlen);
+               if (*insnbuf == 0xe8 && a->replacementlen == 5)
+                   *(s32 *)(insnbuf + 1) += a->replacement - a->instr;
                add_nops(insnbuf + a->replacementlen,
                         a->instrlen - a->replacementlen);
                text_poke_early(instr, insnbuf, a->instrlen);