mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: stable-review@kernel.org, torvalds@linux-foundation.org,
	akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
	Steven Rostedt <rostedt@goodmis.org>
Subject: [35/38] ftrace: Fix regression of :mod:module function enabling
Date: Tue, 11 Oct 2011 10:55:45 -0600	[thread overview]
Message-ID: <20111011165713.698672347@pistachio.kroah.org> (raw)
In-Reply-To: <20111011165903.GA30976@kroah.com>

3.0-stable review patch.  If anyone has any objections, please let us know.

------------------

From: Steven Rostedt <srostedt@redhat.com>

commit 43dd61c9a09bd413e837df829e6bfb42159be52a upstream.

The new code that allows different utilities to pick and choose
what functions they trace broke the :mod: hook that allows users
to trace only functions of a particular module.

The reason is that the :mod: hook bypasses the hash that is setup
to allow individual users to trace their own functions and uses
the global hash directly. But if the global hash has not been
set up, it will cause a bug:

echo '*:mod:radeon' > /sys/kernel/debug/set_ftrace_filter

produces:

 [drm:drm_mode_getfb] *ERROR* invalid framebuffer id
 [drm:radeon_crtc_page_flip] *ERROR* failed to reserve new rbo buffer before flip
 BUG: unable to handle kernel paging request at ffffffff8160ec90
 IP: [<ffffffff810d9136>] add_hash_entry+0x66/0xd0
 PGD 1a05067 PUD 1a09063 PMD 80000000016001e1
 Oops: 0003 [#1] SMP Jul  7 04:02:28 phyllis kernel: [55303.858604] CPU 1
 Modules linked in: cryptd aes_x86_64 aes_generic binfmt_misc rfcomm bnep ip6table_filter hid radeon r8169 ahci libahci mii ttm drm_kms_helper drm video i2c_algo_bit intel_agp intel_gtt

 Pid: 10344, comm: bash Tainted: G        WC  3.0.0-rc5 #1 Dell Inc. Inspiron N5010/0YXXJJ
 RIP: 0010:[<ffffffff810d9136>]  [<ffffffff810d9136>] add_hash_entry+0x66/0xd0
 RSP: 0018:ffff88003a96bda8  EFLAGS: 00010246
 RAX: ffff8801301735c0 RBX: ffffffff8160ec80 RCX: 0000000000306ee0
 RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff880137c92940
 RBP: ffff88003a96bdb8 R08: ffff880137c95680 R09: 0000000000000000
 R10: 0000000000000001 R11: 0000000000000000 R12: ffffffff81c9df78
 R13: ffff8801153d1000 R14: 0000000000000000 R15: 0000000000000000
 FS: 00007f329c18a700(0000) GS:ffff880137c80000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
 CR2: ffffffff8160ec90 CR3: 000000003002b000 CR4: 00000000000006e0
 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
 Process bash (pid: 10344, threadinfo ffff88003a96a000, task ffff88012fcfc470)
 Stack:
  0000000000000fd0 00000000000000fc ffff88003a96be38 ffffffff810d92f5
  ffff88011c4c4e00 ffff880000000000 000000000b69f4d0 ffffffff8160ec80
  ffff8800300e6f06 0000000081130295 0000000000000282 ffff8800300e6f00
 Call Trace:
  [<ffffffff810d92f5>] match_records+0x155/0x1b0
  [<ffffffff810d940c>] ftrace_mod_callback+0xbc/0x100
  [<ffffffff810dafdf>] ftrace_regex_write+0x16f/0x210
  [<ffffffff810db09f>] ftrace_filter_write+0xf/0x20
  [<ffffffff81166e48>] vfs_write+0xc8/0x190
  [<ffffffff81167001>] sys_write+0x51/0x90
  [<ffffffff815c7e02>] system_call_fastpath+0x16/0x1b
 Code: 48 8b 33 31 d2 48 85 f6 75 33 49 89 d4 4c 03 63 08 49 8b 14 24 48 85 d2 48 89 10 74 04 48 89 42 08 49 89 04 24 4c 89 60 08 31 d2
 RIP [<ffffffff810d9136>] add_hash_entry+0x66/0xd0
  RSP <ffff88003a96bda8>
 CR2: ffffffff8160ec90
 ---[ end trace a5d031828efdd88e ]---

Reported-by: Brian Marete <marete@toshnix.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 include/linux/ftrace.h         |    3 ++-
 kernel/trace/ftrace.c          |   12 +++---------
 kernel/trace/trace_functions.c |    3 ++-
 3 files changed, 7 insertions(+), 11 deletions(-)

--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -123,7 +123,8 @@ stack_trace_sysctl(struct ctl_table *tab
 struct ftrace_func_command {
 	struct list_head	list;
 	char			*name;
-	int			(*func)(char *func, char *cmd,
+	int			(*func)(struct ftrace_hash *hash,
+					char *func, char *cmd,
 					char *params, int enable);
 };
 
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2407,10 +2407,9 @@ ftrace_match_module_records(struct ftrac
  */
 
 static int
-ftrace_mod_callback(char *func, char *cmd, char *param, int enable)
+ftrace_mod_callback(struct ftrace_hash *hash,
+		    char *func, char *cmd, char *param, int enable)
 {
-	struct ftrace_ops *ops = &global_ops;
-	struct ftrace_hash *hash;
 	char *mod;
 	int ret = -EINVAL;
 
@@ -2430,11 +2429,6 @@ ftrace_mod_callback(char *func, char *cm
 	if (!strlen(mod))
 		return ret;
 
-	if (enable)
-		hash = ops->filter_hash;
-	else
-		hash = ops->notrace_hash;
-
 	ret = ftrace_match_module_records(hash, func, mod);
 	if (!ret)
 		ret = -EINVAL;
@@ -2760,7 +2754,7 @@ static int ftrace_process_regex(struct f
 	mutex_lock(&ftrace_cmd_mutex);
 	list_for_each_entry(p, &ftrace_commands, list) {
 		if (strcmp(p->name, command) == 0) {
-			ret = p->func(func, command, next, enable);
+			ret = p->func(hash, func, command, next, enable);
 			goto out_unlock;
 		}
 	}
--- a/kernel/trace/trace_functions.c
+++ b/kernel/trace/trace_functions.c
@@ -324,7 +324,8 @@ ftrace_trace_onoff_unreg(char *glob, cha
 }
 
 static int
-ftrace_trace_onoff_callback(char *glob, char *cmd, char *param, int enable)
+ftrace_trace_onoff_callback(struct ftrace_hash *hash,
+			    char *glob, char *cmd, char *param, int enable)
 {
 	struct ftrace_probe_ops *ops;
 	void *count = (void *)-1;



  parent reply	other threads:[~2011-10-11 17:08 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-11 16:59 [00/38] 3.0.7-stable review Greg KH
2011-10-11 16:55 ` [01/38] PCI: Set PCI-E Max Payload Size on fabric Greg KH
2011-10-11 17:20   ` Benjamin LaHaise
2011-10-11 18:14     ` Bjorn Helgaas
2011-10-11 19:24       ` Greg KH
2011-10-11 19:47         ` Bjorn Helgaas
2011-10-11 19:56           ` Greg KH
2011-10-11 20:03             ` Benjamin LaHaise
2011-10-11 21:31               ` Greg KH
2011-10-11 20:22             ` Bjorn Helgaas
2011-10-11 21:32               ` Greg KH
2011-10-11 16:55 ` [02/38] PCI: export pcie_bus_configure_settings symbol Greg KH
2011-10-11 16:55 ` [03/38] PCI: Remove MRRS modification from MPS setting code Greg KH
2011-10-11 16:55 ` [04/38] pci: Dont crash when reading mpss from root complex Greg KH
2011-10-11 16:55 ` [05/38] Fix pointer dereference before call to pcie_bus_configure_settings Greg KH
2011-10-11 16:55 ` [06/38] PCI: Disable MPS configuration by default Greg KH
2011-10-11 16:55 ` [07/38] sparc64: Force the execute bit in OpenFirmwares translation entries Greg KH
2011-10-11 16:55 ` [08/38] sched/rt: Migrate equal priority tasks to available CPUs Greg KH
2011-10-11 16:55 ` [09/38] sched: Fix up wchan borkage Greg KH
2011-10-11 16:55 ` [10/38] ide-disk: Fix request requeuing Greg KH
2011-10-11 16:55 ` [11/38] posix-cpu-timers: Cure SMP wobbles Greg KH
2011-10-11 16:55 ` [12/38] lis3: fix regression of HP DriveGuard with 8bit chip Greg KH
2011-10-11 16:55 ` [13/38] ASoC: use a valid device for dev_err() in Zylonite Greg KH
2011-10-11 16:55 ` [14/38] ASoC: Fix setting update bits for WM8753_LADC and WM8753_RADC Greg KH
2011-10-11 16:55 ` [15/38] drm/radeon: Update AVIVO cursor coordinate origin before x/yorigin calculation Greg KH
2011-10-11 16:55 ` [16/38] drm/radeon/kms: Fix logic error in DP HPD handler Greg KH
2011-10-11 16:55 ` [17/38] drm/radeon/kms: fix regression in DP aux defer handling Greg KH
2011-10-11 16:55 ` [18/38] drm/radeon/kms: add retry limits for native DP aux defer Greg KH
2011-10-11 16:55 ` [19/38] drm/radeon/kms: fix channel_remap setup (v2) Greg KH
2011-10-11 16:55 ` [20/38] ptp: fix L2 event message recognition Greg KH
2011-10-11 16:55 ` [21/38] rt2x00: Serialize TX operations on a queue Greg KH
2011-10-11 16:55 ` [22/38] x86/PCI: use host bridge _CRS info on ASUS M2V-MX SE Greg KH
2011-10-11 16:55 ` [23/38] [SCSI] qla2xxx: Fix crash in qla2x00_abort_all_cmds() on unload Greg KH
2011-10-11 16:55 ` [24/38] [SCSI] libsas: fix panic when single phy is disabled on a wide port Greg KH
2011-10-11 16:55 ` [25/38] md: Avoid waking up a thread after it has been freed Greg KH
2011-10-11 16:55 ` [26/38] dm table: avoid crash if integrity profile changes Greg KH
2011-10-11 16:55 ` [27/38] mmc: mxs-mmc: fix clock rate setting Greg KH
2011-10-11 16:55 ` [28/38] exec: do not call request_module() twice from search_binary_handler() Greg KH
2011-10-11 16:55 ` [29/38] ARM: mach-ux500: enable fix for ARM errata 754322 Greg KH
2011-10-11 16:55 ` [30/38] drm/radeon/kms: retry aux transactions if there are status flags Greg KH
2011-10-11 16:55 ` [31/38] drm/radeon/kms: use hardcoded dig encoder to transmitter mapping for DCE4.1 Greg KH
2011-10-11 16:55 ` [32/38] ipv6: fix NULL dereference in udp6_ufo_fragment() Greg KH
2011-10-11 16:55 ` [33/38] ahci: Enable SB600 64bit DMA on Asus M3A Greg KH
2011-10-11 16:55 ` [34/38] MIPS: PM: Use struct syscore_ops instead of sysdevs for PM (v2) Greg KH
2011-10-11 16:55 ` Greg KH [this message]
2011-10-11 16:55 ` [36/38] ftrace: Fix regression where ftrace breaks when modules are loaded Greg KH
2011-10-11 16:55 ` [37/38] ftrace: Fix warning when CONFIG_FUNCTION_TRACER is not defined Greg KH
2011-10-11 16:55 ` [38/38] e1000e: workaround for packet drop on 82579 at 100Mbps Greg KH
2011-10-11 17:00 ` [00/38] 3.0.7-stable review Greg KH
2011-10-17 15:05   ` Conny Seidel
2011-10-17 15:21     ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111011165713.698672347@pistachio.kroah.org \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=stable-review@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®