)]}'
{
  "commit": "a949ae560a511fe4e3adf48fa44fefded93e5c2b",
  "tree": "c47563e7c5696f264050aa5e049ad6f69787f536",
  "parents": [
    "a798c10faf62a505d24e5f6213fbaf904a39623f"
  ],
  "author": {
    "name": "Steven Rostedt (Red Hat)",
    "email": "rostedt@goodmis.org",
    "time": "Thu Apr 24 10:40:12 2014 -0400"
  },
  "committer": {
    "name": "Steven Rostedt",
    "email": "rostedt@goodmis.org",
    "time": "Mon Apr 28 10:37:21 2014 -0400"
  },
  "message": "ftrace/module: Hardcode ftrace_module_init() call into load_module()\n\nA race exists between module loading and enabling of function tracer.\n\n\tCPU 1\t\t\t\tCPU 2\n\t-----\t\t\t\t-----\n  load_module()\n   module-\u003estate \u003d MODULE_STATE_COMING\n\n\t\t\t\tregister_ftrace_function()\n\t\t\t\t mutex_lock(\u0026ftrace_lock);\n\t\t\t\t ftrace_startup()\n\t\t\t\t  update_ftrace_function();\n\t\t\t\t   ftrace_arch_code_modify_prepare()\n\t\t\t\t    set_all_module_text_rw();\n\t\t\t\t   \u003cenables-ftrace\u003e\n\t\t\t\t    ftrace_arch_code_modify_post_process()\n\t\t\t\t     set_all_module_text_ro();\n\n\t\t\t\t[ here all module text is set to RO,\n\t\t\t\t  including the module that is\n\t\t\t\t  loading!! ]\n\n   blocking_notifier_call_chain(MODULE_STATE_COMING);\n    ftrace_init_module()\n\n     [ tries to modify code, but it\u0027s RO, and fails!\n       ftrace_bug() is called]\n\nWhen this race happens, ftrace_bug() will produces a nasty warning and\nall of the function tracing features will be disabled until reboot.\n\nThe simple solution is to treate module load the same way the core\nkernel is treated at boot. To hardcode the ftrace function modification\nof converting calls to mcount into nops. This is done in init/main.c\nthere\u0027s no reason it could not be done in load_module(). This gives\na better control of the changes and doesn\u0027t tie the state of the\nmodule to its notifiers as much. Ftrace is special, it needs to be\ntreated as such.\n\nThe reason this would work, is that the ftrace_module_init() would be\ncalled while the module is in MODULE_STATE_UNFORMED, which is ignored\nby the set_all_module_text_ro() call.\n\nLink: http://lkml.kernel.org/r/1395637826-3312-1-git-send-email-indou.takao@jp.fujitsu.com\n\nReported-by: Takao Indoh \u003cindou.takao@jp.fujitsu.com\u003e\nAcked-by: Rusty Russell \u003crusty@rustcorp.com.au\u003e\nCc: stable@vger.kernel.org # 2.6.38+\nSigned-off-by: Steven Rostedt \u003crostedt@goodmis.org\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "9212b017bc7236cfc63afe5c268cc741995a1af4",
      "old_mode": 33188,
      "old_path": "include/linux/ftrace.h",
      "new_id": "ae9504b4b67d3026cd9c1c1fcd30a8cfc928c984",
      "new_mode": 33188,
      "new_path": "include/linux/ftrace.h"
    },
    {
      "type": "modify",
      "old_id": "11869408f79b86abe33e5194d0f5c705b44e9d81",
      "old_mode": 33188,
      "old_path": "kernel/module.c",
      "new_id": "5f14fec9f825f907d5e6939fe9d1a9a469ab4654",
      "new_mode": 33188,
      "new_path": "kernel/module.c"
    },
    {
      "type": "modify",
      "old_id": "1fd4b9479210183762293944be777abb5435f8e3",
      "old_mode": 33188,
      "old_path": "kernel/trace/ftrace.c",
      "new_id": "4a54a25afa2fe67165cb6f65cd0b63c42eb724eb",
      "new_mode": 33188,
      "new_path": "kernel/trace/ftrace.c"
    }
  ]
}
