From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753892AbbLYGWe (ORCPT ); Fri, 25 Dec 2015 01:22:34 -0500 Received: from mga01.intel.com ([192.55.52.88]:56782 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751316AbbLYGWd (ORCPT ); Fri, 25 Dec 2015 01:22:33 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,477,1444719600"; d="scan'208";a="880736938" From: "Qiu, PeiyangX" To: Steven Rostedt , Ingo Molnar , Rusty Russell Cc: linux-kernel@vger.kernel.org, yanmin_zhang@linux.intel.com Subject: [PATCH 0/2] fix ftrace initialization issue when a module is loaded Message-ID: <567CE0A7.80605@intel.com> Date: Fri, 25 Dec 2015 14:22:31 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 Content-Type: text/plain; charset=gbk Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When a module is loaded, current ftrace initialization around the new module has some issues. 1) ftrace might race with insmod: Just after load_module calls ftrace_module_init to add ftrace records of the module, ftrace_run_update_code might jump in to change module codes. But load_module calls complete_formation=>set_section_ro_nx to put the module TEXT attribute to RO. Then, ftrace_run_update_code triggers ftrace_bug and fails. 2) complete_formation might fail and the module's ftrace records are not cleaned up. This patchset fixes above issues.