mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>,
	kan.liang@linux.intel.com, like.xu@linux.intel.com
Subject: [PATCH] perf/x86: Make dummy_iregs static
Date: Fri, 30 Oct 2020 12:19:19 +0100	[thread overview]
Message-ID: <20201030111919.GM2651@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20201030090037.GZ2628@hirez.programming.kicks-ass.net>

On Fri, Oct 30, 2020 at 10:00:37AM +0100, Peter Zijlstra wrote:
> > static void __intel_pmu_pebs_event(struct perf_event *event,
> > 				   struct pt_regs *iregs,
> > 				   void *base, void *top,
> > 				   int bit, int count,
> > 				   void (*setup_sample)(struct perf_event *,
> > 						struct pt_regs *,
> > 						void *,
> > 						struct perf_sample_data *,
> > 						struct pt_regs *))
> > {
> > 	struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
> > 	struct hw_perf_event *hwc = &event->hw;
> > 	struct perf_sample_data data;
> > 	struct x86_perf_regs perf_regs;
> > 	struct pt_regs *regs = &perf_regs.regs;
> > 	void *at = get_next_pebs_record_by_bit(base, top, bit);
> > 	struct pt_regs dummy_iregs;
> 
> The only thing I can come up with in a hurry is that that dummy_iregs
> thing really should be static. That's 168 bytes of stack out the window
> right there.

---
Subject: perf/x86: Make dummy_iregs static
From: Peter Zijlstra <peterz@infradead.org>
Date: Fri Oct 30 12:15:06 CET 2020

Having pt_regs on-stack is unfortunate, it's 168 bytes. Since it isn't
actually used, make it a static variable. This both gets if off the
stack and ensures it gets 0 initialized, just in case someone does
look at it.

Reported-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 arch/x86/events/intel/ds.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/x86/events/intel/ds.c
+++ b/arch/x86/events/intel/ds.c
@@ -1735,7 +1735,7 @@ static void __intel_pmu_pebs_event(struc
 	struct x86_perf_regs perf_regs;
 	struct pt_regs *regs = &perf_regs.regs;
 	void *at = get_next_pebs_record_by_bit(base, top, bit);
-	struct pt_regs dummy_iregs;
+	static struct pt_regs dummy_iregs;
 
 	if (hwc->flags & PERF_X86_EVENT_AUTO_RELOAD) {
 		/*

      parent reply	other threads:[~2020-10-30 11:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-30  4:27 [BUG] Stack overflow when running perf and function tracer Steven Rostedt
2020-10-30  9:00 ` Peter Zijlstra
2020-10-30 10:26   ` Thomas Gleixner
2020-10-30 10:32     ` Peter Zijlstra
2020-10-30 11:36       ` Thomas Gleixner
2020-10-30 13:42         ` Thomas Gleixner
2020-10-30 10:59     ` [PATCH] perf/arch: Remove perf_sample_data::regs_user_copy Peter Zijlstra
2020-10-30 12:33       ` Steven Rostedt
2020-10-30 11:19   ` Peter Zijlstra [this message]

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=20201030111919.GM2651@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=kan.liang@linux.intel.com \
    --cc=like.xu@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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®