linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Philipp Rudo <prudo@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 4.19 17/32] s390/ftrace: fix potential crashes when switching tracers
Date: Fri,  8 May 2020 14:35:30 +0200	[thread overview]
Message-ID: <20200508123037.116783881@linuxfoundation.org> (raw)
In-Reply-To: <20200508123034.886699170@linuxfoundation.org>

From: Philipp Rudo <prudo@linux.ibm.com>

[ Upstream commit 8ebf6da9db1b2a20bb86cc1bee2552e894d03308 ]

Switching tracers include instruction patching. To prevent that a
instruction is patched while it's read the instruction patching is done
in stop_machine 'context'. This also means that any function called
during stop_machine must not be traced. Thus add 'notrace' to all
functions called within stop_machine.

Fixes: 1ec2772e0c3c ("s390/diag: add a statistic for diagnose calls")
Fixes: 38f2c691a4b3 ("s390: improve wait logic of stop_machine")
Fixes: 4ecf0a43e729 ("processor: get rid of cpu_relax_yield")
Signed-off-by: Philipp Rudo <prudo@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/s390/kernel/diag.c  | 2 +-
 arch/s390/kernel/smp.c   | 4 ++--
 arch/s390/kernel/trace.c | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/s390/kernel/diag.c b/arch/s390/kernel/diag.c
index 35c842aa87058..4c7cf8787a848 100644
--- a/arch/s390/kernel/diag.c
+++ b/arch/s390/kernel/diag.c
@@ -128,7 +128,7 @@ void diag_stat_inc(enum diag_stat_enum nr)
 }
 EXPORT_SYMBOL(diag_stat_inc);
 
-void diag_stat_inc_norecursion(enum diag_stat_enum nr)
+void notrace diag_stat_inc_norecursion(enum diag_stat_enum nr)
 {
 	this_cpu_inc(diag_stat.counter[nr]);
 	trace_s390_diagnose_norecursion(diag_map[nr].code);
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index ecd24711f3aa9..8e31dfd85de32 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -393,7 +393,7 @@ int smp_find_processor_id(u16 address)
 	return -1;
 }
 
-bool arch_vcpu_is_preempted(int cpu)
+bool notrace arch_vcpu_is_preempted(int cpu)
 {
 	if (test_cpu_flag_of(CIF_ENABLED_WAIT, cpu))
 		return false;
@@ -403,7 +403,7 @@ bool arch_vcpu_is_preempted(int cpu)
 }
 EXPORT_SYMBOL(arch_vcpu_is_preempted);
 
-void smp_yield_cpu(int cpu)
+void notrace smp_yield_cpu(int cpu)
 {
 	if (MACHINE_HAS_DIAG9C) {
 		diag_stat_inc_norecursion(DIAG_STAT_X09C);
diff --git a/arch/s390/kernel/trace.c b/arch/s390/kernel/trace.c
index 490b52e850145..11a669f3cc93c 100644
--- a/arch/s390/kernel/trace.c
+++ b/arch/s390/kernel/trace.c
@@ -14,7 +14,7 @@ EXPORT_TRACEPOINT_SYMBOL(s390_diagnose);
 
 static DEFINE_PER_CPU(unsigned int, diagnose_trace_depth);
 
-void trace_s390_diagnose_norecursion(int diag_nr)
+void notrace trace_s390_diagnose_norecursion(int diag_nr)
 {
 	unsigned long flags;
 	unsigned int *depth;
-- 
2.20.1




  parent reply	other threads:[~2020-05-08 12:51 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-08 12:35 [PATCH 4.19 00/32] 4.19.122-rc1 review Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.19 01/32] vhost: vsock: kick send_pkt worker once device is started Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.19 02/32] powerpc/pci/of: Parse unassigned resources Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.19 03/32] ASoC: topology: Check return value of pcm_new_ver Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.19 04/32] selftests/ipc: Fix test failure seen after initial test run Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.19 05/32] ASoC: sgtl5000: Fix VAG power-on handling Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.19 06/32] usb: dwc3: gadget: Properly set maxpacket limit Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.19 07/32] ASoC: rsnd: Fix parent SSI start/stop in multi-SSI mode Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.19 08/32] ASoC: rsnd: Fix HDMI channel mapping for " Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.19 09/32] ASoC: codecs: hdac_hdmi: Fix incorrect use of list_for_each_entry Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.19 10/32] drm/amdgpu: Correctly initialize thermal controller for GPUs with Powerplay table v0 (e.g Hawaii) Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.19 11/32] wimax/i2400m: Fix potential urb refcnt leak Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.19 12/32] net: stmmac: fix enabling socfpgas ptp_ref_clock Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.19 13/32] net: stmmac: Fix sub-second increment Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.19 14/32] ASoC: rsnd: Dont treat master SSI in multi SSI setup as parent Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.19 15/32] ASoC: rsnd: Fix "status check failed" spam for multi-SSI Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.19 16/32] cifs: protect updating server->dstaddr with a spinlock Greg Kroah-Hartman
2020-05-08 12:35 ` Greg Kroah-Hartman [this message]
2020-05-08 12:35 ` [PATCH 4.19 18/32] scripts/config: allow colons in option strings for sed Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.19 19/32] lib/mpi: Fix building for powerpc with clang Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.19 20/32] net: bcmgenet: suppress warnings on failed Rx SKB allocations Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.19 21/32] net: systemport: " Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.19 22/32] sctp: Fix SHUTDOWN CTSN Ack in the peer restart case Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.19 23/32] drm/amdgpu: Fix oops when pp_funcs is unset in ACPI event Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.19 24/32] lib: devres: add a helper function for ioremap_uc Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.19 25/32] mfd: intel-lpss: Use devm_ioremap_uc for MMIO Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.19 26/32] hexagon: clean up ioremap Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.19 27/32] hexagon: define ioremap_uc Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.19 28/32] ALSA: hda: Match both PCI ID and SSID for driver blacklist Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.19 29/32] platform/x86: GPD pocket fan: Fix error message when temp-limits are out of range Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.19 30/32] mac80211: add ieee80211_is_any_nullfunc() Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.19 31/32] cgroup, netclassid: remove double cond_resched Greg Kroah-Hartman
2020-05-08 12:35 ` [PATCH 4.19 32/32] drm/atomic: Take the atomic toys away from X Greg Kroah-Hartman
2020-05-08 20:30   ` Pavel Machek
2020-05-08 21:06 ` [PATCH 4.19 00/32] 4.19.122-rc1 review Guenter Roeck
2020-05-09  9:07 ` Naresh Kamboju
2020-05-11 16:49 ` shuah

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=20200508123037.116783881@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=gor@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=prudo@linux.ibm.com \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).