Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261607AbVDRDWi (ORCPT ); Sun, 17 Apr 2005 23:22:38 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261636AbVDRDWi (ORCPT ); Sun, 17 Apr 2005 23:22:38 -0400 Received: from tama5.ecl.ntt.co.jp ([129.60.39.102]:56506 "EHLO tama5.ecl.ntt.co.jp") by vger.kernel.org with ESMTP id S261607AbVDRDVf (ORCPT ); Sun, 17 Apr 2005 23:21:35 -0400 Message-ID: <4263275A.2020405@lab.ntt.co.jp> Date: Mon, 18 Apr 2005 12:19:54 +0900 From: Takashi Ikebe User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: linux-kernel@vger.kernel.org Subject: [PATCH x86_64] Live Patching Function on 2.6.11.7 Content-Type: multipart/mixed; boundary="------------090404030002040502000902" Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 60576 Lines: 857 This is a multi-part message in MIME format. --------------090404030002040502000902 Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit The patch was over 50k, so I separate it to each architecture and in line.. This patch add function called "Live patching" which is defined on OSDL's carrier grade linux requiremnt definition to linux 2.6.11.7 kernel. The live patching allows process to patch on-line (without restarting process) on i386 and x86_64 architectures, by overwriting jump assembly code on entry point of functions which you want to fix, to patched functions. The live patching function is very common on high-availability system such as carrier system, and this patch realize it also on linux. (Patch & process restart time is very critical on such high-availability system, live patch allows you to milliseconds order process stopping time to apply new patch.) The basis is below: 1. Live patch command loads the patch modules to target process's memory area, 2. Live patch command resolve patch symbol. 3. Live patch command overwrite jump code to the entry point of function which you want to fix, to the patch module's symbol. Kernel patch and user mode tools are required, and both of them are available at http://pannus.sourceforge.net Please take a look and give us comments! This patch add following system calls and function. o mmap3: maps patch to target process's memory area with security check. o accesspvm: access(read/write) target process's memory area. o init_pend: initialization of live patch sequence on target process. o rt_handlereturn: run initialize root of each patch (same as signal handler). o check_init: check that the initialization is finished or not. o munmap3: unmap patch from target process's memory area. -- Takashi Ikebe NTT Network Service Systems Laboratories 9-11, Midori-Cho 3-Chome Musashino-Shi, Tokyo 180-8585 Japan Tel : +81 422 59 4246, Fax : +81 422 60 4012 e-mail : ikebe.takashi@lab.ntt.co.jp --------------090404030002040502000902 Content-Type: text/plain; name="pannus-2.6.11.7-x86_64.patch" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="pannus-2.6.11.7-x86_64.patch" ZGlmZiAtdXJwTiBsaW51eC0yLjYuMTEuNy12YW5pbGxhL2FyY2gveDg2XzY0L2tlcm5lbC9N YWtlZmlsZSBsaW51eC0yLjYuMTEuNy1wYW5udXMteDg2XzY0L2FyY2gveDg2XzY0L2tlcm5l bC9NYWtlZmlsZQotLS0gbGludXgtMi42LjExLjctdmFuaWxsYS9hcmNoL3g4Nl82NC9rZXJu ZWwvTWFrZWZpbGUJMjAwNS0wNC0wOCAwMzo1Nzo1NS4wMDAwMDAwMDAgKzA5MDAKKysrIGxp bnV4LTIuNi4xMS43LXBhbm51cy14ODZfNjQvYXJjaC94ODZfNjQva2VybmVsL01ha2VmaWxl CTIwMDUtMDQtMTggMTA6NDU6NDcuMDAwMDAwMDAwICswOTAwCkBAIC03LDcgKzcsOCBAQCBF WFRSQV9BRkxBR1MJOj0gLXRyYWRpdGlvbmFsCiBvYmoteQk6PSBwcm9jZXNzLm8gc2VtYXBo b3JlLm8gc2lnbmFsLm8gZW50cnkubyB0cmFwcy5vIGlycS5vIFwKIAkJcHRyYWNlLm8gdGlt ZS5vIGlvcG9ydC5vIGxkdC5vIHNldHVwLm8gaTgyNTkubyBzeXNfeDg2XzY0Lm8gXAogCQl4 ODY2NF9rc3ltcy5vIGkzODcubyBzeXNjYWxsLm8gdnN5c2NhbGwubyBcCi0JCXNldHVwNjQu byBib290ZmxhZy5vIGU4MjAubyByZWJvb3QubyBxdWlya3MubworCQlzZXR1cDY0Lm8gY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xpbmthZ2UgaW50IHN5c19hY2Nlc3Nw dm0obG9uZyBwaWQsIHVuc2lnbmVkIGxvbmcgYWRkciwgbG9uZyBkYXRhcCwgaW50IGxlbiwg aW50IGZsYWcpCit7CisgICAgICAgCXN0cnVjdCB0YXNrX3N0cnVjdCAqdHNrOworCWludCBy ZXQgPSAtRVBFUk07CisJbG9uZyAqcCA9IE5VTEw7CisKKwlyZWFkX2xvY2soJnRhc2tsaXN0 X2xvY2spOyAvLyBsb2NrIHRhc2tsaXN0CisJdHNrID0gZmluZF90YXNrX2J5X3BpZChwaWQp OworCWlmICh0c2spCisJCWdldF90YXNrX3N0cnVjdCh0c2spOyAvLyBnZXQgdGFza19zdHJ1 Y3QKKwlyZWFkX3VubG9jaygmdGFza2xpc3RfbG9jayk7IC8vIHVubG9jayB0YXNrbGlzdAor CWlmICghdHNrKSB7CisJCXJldCA9IC1FU1JDSDsKKwkJZ290byBvdXQ7CisJfQorCisJaWYg KHBpZCA8PSAxKQkJLy8geW91IG1heSBub3QgbWVzcyB3aXRoIGtlcm5lbCB0aHJlYWQgb3Ig aW5pdC4KKwkJZ290byBvdXRfdHNrOworCQorCWlmKCgoY3VycmVudC0+dWlkICE9IHRzay0+ ZXVpZCkgfHwKKwkgICAgKGN1cnJlbnQtPnVpZCAhPSB0c2stPnN1aWQpIHx8CisJICAgIChj dXJyZW50LT51aWQgIT0gdHNrLT51aWQpIHx8CisJICAgIChjdXJyZW50LT5naWQgIT0gdHNr LT5lZ2lkKSB8fAorCSAgICAoY3VycmVudC0+Z2lkICE9IHRzay0+c2dpZCkgfHwKKwkgICAg KGN1cnJlbnQtPmdpZCAhPSB0c2stPmdpZCkpICYmICFjYXBhYmxlKENBUF9TWVNfUEFOTlVT KSkgeworICAgICAgICAgICAgICAgIC8vIGludmFsaWQgdXNlciBpbiBzeXNfYWNjZXNzcHZt CisgICAgICAgICAgICAgICAgcmV0dXJuIC1FUEVSTTsKKyAgICAgICAgfQorCisJcCA9IHZt YWxsb2Mob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9fcHV0X3VzZXIocmVncy0+cjEyLCAmc2MtPnIx Mik7CisgICAgICAgIGVyciB8PSBfX3B1dF91c2VyKHJlZ3MtPnIxMywgJnNjLT5yMTMpOwor ICAgICAgICBlcnIgfD0gX19wdXRfdXNlcihyZWdzLT5yMTQsICZzYy0+cjE0KTsKKyAgICAg ICAgZXJyIHw9IF9fcHV0X3VzZXIocmVncy0+cjE1LCAmc2MtPnIxNSk7CisgICAgICAgIGVy ciB8PSBfX3B1dF91c2VyKG1lLT50aHJlYWQudHJhcF9ubywgJnNjLT50cmFwbm8pOworICAg ICAgICBlcnIgfD0gX19wdXRfdXNlcihtZS0+dGhyZWFkLmVycm9yX2NvZGUsICZzYy0+ZXJy KTsKKyAgICAgICAgZXJyIHw9IF9fcHV0X3VzZXIocmVncy0+cmlwLCAmc2MtPnJpcCk7Cisg ICAgICAgIGVyciB8PSBfX3B1dF91c2VyKHJlZ3MtPmVmbGFncywgJnNjLT5lZmxhZ3MpOwor ICAgICAgICBlcnIgfD0gX19wdXRfdXNlcihtYXNrLCAmc2MtPm9sZG1hc2spOworICAgICAg ICBlcnIgfD0gX19wdXRfdXNlcihtZS0+dGhyZWFkLmNyMiwgJnNjLT5jcjIpOworCisgICAg ICAgIHJldHVybiBlcnI7Cit9CisKKy8qCisgKiBGaXggc3RhY2sgcG9pbnRlci4KKyAqLwor c3RhdGljIHZvaWQgKgorZ2V0X3N0YWNrKHN0cnVjdCBwdF9yZWdzICpyZWdzLCB1bnNpZ25l ZCBsb25nIHNpemUpCit7CisJdW5zaWduZWQgbG9uZyByc3A7CisKKwkvKiBTaGlmdCBzdGFj ayBwb2ludGVyIGJ5IHN0YWNrIHNpemUuICovCisJcnNwID0gcmVncy0+cnNwIC0gMTI4Owor CisJLyogQWxpZ24gcGFnZSBzaXplIGJvdWRhcmllcyAqLworCXJldHVybiAodm9pZCAqKXJv dW5kX2Rvd24ocnNwIC0gc2l6ZSwgMTYpOworfQorCisvKgorICogU2V0IGluaXRpYWxpemF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ncy0+b3JpZ19yYXgpOworCit9IAorCisvKgorICogU2V0IGlu aXBlbmRpbmcgZmxhZy4KKyAqLworYXNtbGlua2FnZSBpbnQgc3lzX2luaXRfcGVuZChwaWRf dCBwaWQsIHN0cnVjdCBrX2luaXRhY3Rpb24gKnVzZXJfa19pYSkKK3sKKwlzdHJ1Y3Qga19p bml0YWN0aW9uIGthOworCXN0cnVjdCB0YXNrX3N0cnVjdCAqdHNrOworCWludCBlcnJvcjsK KworCS8qIENvcHkgaW5pdGlhbGl6YXRpb24gaW5mb3JtYXRpb24gZnJvbSB1c2VyIGFyZWEg dG8ga2VybmVsIGFyZWEuICovCisJZXJyb3IgPSAtRUZBVUxUOworCWlmKGNvcHlfZnJvbV91 c2VyKCZrYSx1c2VyX2tfaWEsc2l6ZW9mKGthKSkpCisJCWdvdG8gb3V0OworCisJLyogaWYg cGlkIDw9IDEsIHBhcmFtZXRlciBlcnJvciAqLworCWVycm9yID0gLUVQRVJNOworCWlmIChw aWQgPD0gMSkKKwkJZ290byBvdXQ7CisKKwkvKiAgR2V0IHRhc2sgc3RydWN0IGZyb20gUElE LiAqLworCWVycm9yID0gLUVTUkNIOworCXJlYWRfbG9jaygmdGFza2xpc3RfbG9jayk7CisJ dHNrID0gZmluZF90YXNrX2J5X3BpZCgocGlkX3QpcGlkKTsKKwlpZih0c2spCisJCWdldF90 YXNrX3N0cnVjdCh0c2spOworCXJlYWRfdW5sb2NrKCZ0YXNrbGlzdF9sb2NrKTsKKwlpZigh dHNrKQorCQlnb3RvIG91dDsKKworCS8qIGNhcGFiaWxpdHkgY2hlY2suICovCisJaWYoKChj dXJyZW50LT51aWQgIT0gdHNrLT5ldWlkKSB8fAorCSAgICAoY3VycmVudC0+dWlkICE9IHRz ay0+c3VpZCkgfHwKKwkgICAgKGN1cnJlbnQtPnVpZCAhPSB0c2stPnVpZCkgfHwKKwkgICAg KGN1cnJlbnQtPmdpZCAhPSB0c2stPmVnaWQpIHx8CisJICAgIChjdXJyZW50LT5na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SB0c2stPmV1aWQpIHx8CisgICAgICAgICAgICAoY3VycmVudC0+ dWlkICE9IHRzay0+c3VpZCkgfHwKKyAgICAgICAgICAgIChjdXJyZW50LT51aWQgIT0gdHNr LT51aWQpIHx8CisgICAgICAgICAgICAoY3VycmVudC0+Z2lkICE9IHRzay0+ZWdpZCkgfHwK KyAgICAgICAgICAgIChjdXJyZW50LT5naWQgIT0gdHNrLT5zZ2lkKSB8fAorICAgICAgICAg ICAgKGN1cnJlbnQtPmdpZCAhPSB0c2stPmdpZCkpICYmICFjYXBhYmxlKENBUF9TWVNfUEFO TlVTKSkgeworICAgICAgICAgICAgLyogSW52YWxpZCB1c2VyICovCisJCWdvdG8gb3V0Owor ICAgICAgICB9CisKKwkvKiAKKwkgKiBDaGVjayBpbmlmaW5pc2ggaW4gdGFzayBzdHJ1Y3Qu CisJICogSWYgaXQgaXMgMCwgcmV0dXJuIDAsIGlmIGl0IGlzICAtMSwgcmV0dXJuIC0xLCBl bHNlIHJldHVybiBFQUdBSU4uCisJICovCisJaWYodHNrLT50aHJlYWRfaW5mby0+aW5pZmlu aXNoPT0wKXsKKwkJcmV0dXJuIDA7CisJfWVsc2UgaWYodHNrLT50aHJlYWRfaW5mby0+aW5p ZmluaXNoPT0tMSl7CisJCWVycm9yID0gLUVJTlZBTDsKKwkJZ290byBvdXQ7CisJfWVsc2V7 CisJCWVycm9yID0gLUVBR0FJTjsKKwkJZ290byBvdXQ7CisJfQorCitvdXQ6CisJcmV0dXJu IGVycm9yOworfQorCmRpZmYgLXVycE4gbGludXgtMi42LjExLjctdmFuaWxsYS9hcmNoL3g4 Nl82NC9rZXJuZWwvc3lzX3g4Nl82NC5jIGxpbnV4LTIuNi4xMS43LXBhbm51cy14ODZfNjQv YXJjaC94ODZfNjQva2VybmVsL3N5c194ODZfNjQuYwotLS0gbGludXgtMi42LjExLjctdmFu aWxsYS9hcmNoL3g4Nl82NC9rZXJuZWwvc3lzX3g4Nl82NC5jCTIwMDUtMDQtMDggMDM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isg ICAgICBpZiAoYS5wZ29mZiAmIH5QQUdFX01BU0spCisgICAgICAgICAgICAgIGdvdG8gb3V0 OworICAgICAgZXJyb3IgPSAtRUJBREY7CisgICAgICBmaWxlID0gTlVMTDsKKyAgICAgIGEu ZmxhZ3MgJj0gfihNQVBfRVhFQ1VUQUJMRSB8IE1BUF9ERU5ZV1JJVEUpOworICAgICAgaWYg KCEoYS5mbGFncyAmIE1BUF9BTk9OWU1PVVMpKSB7CisgICAgICAgICAgICAgIGZpbGUgPSBm Z2V0KGEuZmQpOworICAgICAgICAgICAgICBpZiAoIWZpbGUpCisgICAgICAgICAgICAgICAg ICAgICAgZ290byBvdXQ7CisgICAgICB9CisgICAgICBlcnJvciA9IC1FU1JDSDsKKyAgICAg IHJlYWRfbG9jaygmdGFza2xpc3RfbG9jayk7IC8vIGxvY2sgdGFza2xpc3QKKyAgICAgIHRz ayA9IGZpbmRfdGFza19ieV9waWQoKHBpZF90KWEucGlkKTsKKyAgICAgIGlmICh0c2spCisg ICAgICAgICAgICAgIGdldF90YXNrX3N0cnVjdCh0c2spOworICAgICAgcmVhZF91bmxvY2so JnRhc2tsaXN0X2xvY2spOyAvLyB1bmxvY2sgdGFza2xpc3QKKyAgICAgIGlmICghdHNrKQor ICAgICAgICAgICAgICBnb3RvIG91dDsKKyAgICAgIGlmKCgoY3VycmVudC0+dWlkICE9IHRz ay0+ZXVpZCkgfHwKKyAgICAgIChjdXJyZW50LT51aWQgIT0gdHNrLT5zdWlkKSB8fAorICAg ICAgKGN1cnJlbnQtPnVpZCAhPSB0c2stPnVpZCkgfHwKKyAgICAgIChjdXJyZW50LT5naWQg IT0gdHNrLT5lZ2lkKSB8fAorICAgICAgKGN1cnJlbnQtPmdpZCAhPSB0c2stPnNnaWQpIHx8 CisgICAgICAoY3VycmVudC0+Z2lkICE9IHRzay0+Z2lkKSkgJiYgIWNhcGFibGUoQ0FQX1NZ U19QQU5OVVMpKSB7CisgICAgICAgICAgICAgIC8vIGludmFsaWQgd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RydWN0ICovCisJc3RydWN0IHRhc2tfc3RydWN0ICp0c2s7CisKKwkvKiBnZXQg c3BlY2lmaWVkIHByb2Nlc3MgdGFzayBzdHJ1Y3QgZnJvbSBwaWQuKi8gICAgICAgICAgCisJ cmVhZF9sb2NrKCZ0YXNrbGlzdF9sb2NrKTsKKwl0c2sgPSBmaW5kX3Rhc2tfYnlfcGlkKHBp ZCk7CisJcmVhZF91bmxvY2soJnRhc2tsaXN0X2xvY2spOworCisJaWYgKCF0c2spCisJCXJl dHVybiAtRVNSQ0g7CisKKwkvLyBjYXBhYmlsaXR5IGNoZWNrCQorCWlmKCgoY3VycmVudC0+ dWlkICE9IHRzay0+ZXVpZCkgfHwKKwkoY3VycmVudC0+dWlkICE9IHRzay0+c3VpZCkgfHwK KwkoY3VycmVudC0+dWlkICE9IHRzay0+dWlkKSB8fAorCShjdXJyZW50LT5naWQgIT0gdHNr LT5lZ2lkKSB8fAorCShjdXJyZW50LT5naWQgIT0gdHNrLT5zZ2lkKSB8fAorCShjdXJyZW50 LT5naWQgIT0gdHNrLT5naWQpKSAmJiAhY2FwYWJsZShDQVBfU1lTX1BBTk5VUykpIHsKKwkJ Ly8gaW52YWxpZCB1c2VyIGluIG11bmFtcDMKKwkJLy8gRVBFUk06MSBPcGVyYXRpb24gbm90 IHBlcm1pdHRlZAorCQlyZXR1cm4gLUVQRVJNOworCX0KKyAgICAgICAgCisgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAKKwltbSA9IHRzay0+bW07CisJZG93bl93cml0ZSgmbW0tPm1tYXBfc2VtKTsK KwlyZXQgPSBkb19tdW5tYXAobW0sIGFkZHIsIGxlbik7CisJdXBfd3JpdGUoJm1tLT5tbWFw X3NlbSk7CisJcmV0dXJuIHJldDsKK30KKwogLyoKICAqICB0aGlzIGlzIHJlYWxseSBhIHNp bXBsaWZpZWQgImRvX21tYXAiLiAgaXQgb25seSBoYW5kbGVzCiAgKiAgYW5vbnltb3VzIG1h cHMuICBldmVudHVhbGx5IHdlIG1heSBiZSBhYmxlIHRvIGRvIHNvbWUK --------------090404030002040502000902-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/