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,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Ilya Leoshkevich <iii@linux.ibm.com>,
	Heiko Carstens <hca@linux.ibm.com>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 4.14 35/68] s390/cpcmd: fix inline assembly register clobbering
Date: Thu, 15 Apr 2021 16:47:16 +0200	[thread overview]
Message-ID: <20210415144415.607728993@linuxfoundation.org> (raw)
In-Reply-To: <20210415144414.464797272@linuxfoundation.org>

From: Alexander Gordeev <agordeev@linux.ibm.com>

[ Upstream commit 7a2f91441b2c1d81b77c1cd816a4659f4abc9cbe ]

Register variables initialized using arithmetic. That leads to
kasan instrumentaton code corrupting the registers contents.
Follow GCC guidlines and use temporary variables for assigning
init values to register variables.

Fixes: 94c12cc7d196 ("[S390] Inline assembly cleanup.")
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Acked-by: Ilya Leoshkevich <iii@linux.ibm.com>
Link: https://gcc.gnu.org/onlinedocs/gcc-10.2.0/gcc/Local-Register-Variables.html
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/s390/kernel/cpcmd.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/s390/kernel/cpcmd.c b/arch/s390/kernel/cpcmd.c
index af013b4244d3..2da027359798 100644
--- a/arch/s390/kernel/cpcmd.c
+++ b/arch/s390/kernel/cpcmd.c
@@ -37,10 +37,12 @@ static int diag8_noresponse(int cmdlen)
 
 static int diag8_response(int cmdlen, char *response, int *rlen)
 {
+	unsigned long _cmdlen = cmdlen | 0x40000000L;
+	unsigned long _rlen = *rlen;
 	register unsigned long reg2 asm ("2") = (addr_t) cpcmd_buf;
 	register unsigned long reg3 asm ("3") = (addr_t) response;
-	register unsigned long reg4 asm ("4") = cmdlen | 0x40000000L;
-	register unsigned long reg5 asm ("5") = *rlen;
+	register unsigned long reg4 asm ("4") = _cmdlen;
+	register unsigned long reg5 asm ("5") = _rlen;
 
 	asm volatile(
 		"	diag	%2,%0,0x8\n"
-- 
2.30.2




  parent reply	other threads:[~2021-04-15 15:06 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-15 14:46 [PATCH 4.14 00/68] 4.14.231-rc1 review Greg Kroah-Hartman
2021-04-15 14:46 ` [PATCH 4.14 01/68] ALSA: aloop: Fix initialization of controls Greg Kroah-Hartman
2021-04-15 14:46 ` [PATCH 4.14 02/68] ASoC: intel: atom: Stop advertising non working S24LE support Greg Kroah-Hartman
2021-04-15 14:46 ` [PATCH 4.14 03/68] nfc: fix refcount leak in llcp_sock_bind() Greg Kroah-Hartman
2021-04-15 14:46 ` [PATCH 4.14 04/68] nfc: fix refcount leak in llcp_sock_connect() Greg Kroah-Hartman
2021-04-15 14:46 ` [PATCH 4.14 05/68] nfc: fix memory " Greg Kroah-Hartman
2021-04-15 14:46 ` [PATCH 4.14 06/68] nfc: Avoid endless loops caused by repeated llcp_sock_connect() Greg Kroah-Hartman
2021-04-15 14:46 ` [PATCH 4.14 07/68] xen/evtchn: Change irq_info lock to raw_spinlock_t Greg Kroah-Hartman
2021-04-15 14:46 ` [PATCH 4.14 08/68] net: ipv6: check for validity before dereferencing cfg->fc_nlinfo.nlh Greg Kroah-Hartman
2021-04-15 14:46 ` [PATCH 4.14 09/68] ia64: fix user_stack_pointer() for ptrace() Greg Kroah-Hartman
2021-04-15 14:46 ` [PATCH 4.14 10/68] ocfs2: fix deadlock between setattr and dio_end_io_write Greg Kroah-Hartman
2021-04-15 14:46 ` [PATCH 4.14 11/68] fs: direct-io: fix missing sdio->boundary Greg Kroah-Hartman
2021-04-15 14:46 ` [PATCH 4.14 12/68] parisc: parisc-agp requires SBA IOMMU driver Greg Kroah-Hartman
2021-04-15 14:46 ` [PATCH 4.14 13/68] parisc: avoid a warning on u8 cast for cmpxchg on u8 pointers Greg Kroah-Hartman
2021-04-15 14:46 ` [PATCH 4.14 14/68] ARM: dts: turris-omnia: configure LED[2]/INTn pin as interrupt pin Greg Kroah-Hartman
2021-04-15 14:46 ` [PATCH 4.14 15/68] batman-adv: initialize "struct batadv_tvlv_tt_vlan_data"->reserved field Greg Kroah-Hartman
2021-04-15 14:46 ` [PATCH 4.14 16/68] net: ensure mac header is set in virtio_net_hdr_to_skb() Greg Kroah-Hartman
2021-04-16  8:49   ` Balazs Nemeth
2021-04-16  9:32     ` Eric Dumazet
2021-04-29  9:01       ` Balazs Nemeth
2021-04-15 14:46 ` [PATCH 4.14 17/68] net: sched: sch_teql: fix null-pointer dereference Greg Kroah-Hartman
2021-04-15 14:46 ` [PATCH 4.14 18/68] usbip: add sysfs_lock to synchronize sysfs code paths Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 19/68] usbip: stub-dev " Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 20/68] usbip: synchronize event handler with " Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 21/68] i2c: turn recovery error on init to debug Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 22/68] regulator: bd9571mwv: Fix AVS and DVFS voltage range Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 23/68] ASoC: wm8960: Fix wrong bclk and lrclk with pll enabled for some chips Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 24/68] amd-xgbe: Update DMA coherency values Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 25/68] sch_red: fix off-by-one checks in red_check_params() Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 26/68] gianfar: Handle error code at MAC address change Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 27/68] net:tipc: Fix a double free in tipc_sk_mcast_rcv Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 28/68] ARM: dts: imx6: pbab01: Set vmmc supply for both SD interfaces Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 29/68] net/ncsi: Avoid channel_monitor hrtimer deadlock Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 30/68] ASoC: sunxi: sun4i-codec: fill ASoC card owner Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 31/68] soc/fsl: qbman: fix conflicting alignment attributes Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 32/68] clk: fix invalid usage of list cursor in register Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 33/68] clk: fix invalid usage of list cursor in unregister Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 34/68] workqueue: Move the position of debug_work_activate() in __queue_work() Greg Kroah-Hartman
2021-04-15 14:47 ` Greg Kroah-Hartman [this message]
2021-04-15 14:47 ` [PATCH 4.14 36/68] net/mlx5: Fix placement of log_max_flow_counter Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 37/68] RDMA/cxgb4: check for ipv6 address properly while destroying listener Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 38/68] clk: socfpga: fix iomem pointer cast on 64-bit Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 39/68] net/ncsi: Make local function ncsi_get_filter() static Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 40/68] net/ncsi: Improve general state logging Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 41/68] net/ncsi: Dont return error on normal response Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 42/68] net/ncsi: Add generic netlink family Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 43/68] net/ncsi: Refactor MAC, VLAN filters Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 44/68] net/ncsi: Avoid GFP_KERNEL in response handler Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 45/68] usbip: fix vudc usbip_sockfd_store races leading to gpf Greg Kroah-Hartman
2021-07-28 12:56   ` Krzysztof Kozlowski
2021-04-15 14:47 ` [PATCH 4.14 46/68] cfg80211: remove WARN_ON() in cfg80211_sme_connect Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 47/68] net: tun: set tun->dev->addr_len during TUNSETLINK processing Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 48/68] drivers: net: fix memory leak in atusb_probe Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 49/68] drivers: net: fix memory leak in peak_usb_create_dev Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 50/68] net: mac802154: Fix general protection fault Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 51/68] net: ieee802154: nl-mac: fix check on panid Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 52/68] net: ieee802154: fix nl802154 del llsec key Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 53/68] net: ieee802154: fix nl802154 del llsec dev Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 54/68] net: ieee802154: fix nl802154 add llsec key Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 55/68] net: ieee802154: fix nl802154 del llsec devkey Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 56/68] net: ieee802154: forbid monitor for set llsec params Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 57/68] net: ieee802154: forbid monitor for del llsec seclevel Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 58/68] net: ieee802154: stop dump llsec params for monitors Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 59/68] Revert "cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath." Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 60/68] KVM: arm64: Hide system instruction access to Trace registers Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 61/68] KVM: arm64: Disable guest access to trace filter controls Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 62/68] drm/imx: imx-ldb: fix out of bounds array access warning Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 63/68] gfs2: report "already frozen/thawed" errors Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 64/68] block: only update parent bi_status when bio fail Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 65/68] net: phy: broadcom: Only advertise EEE for supported modes Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 66/68] netfilter: x_tables: fix compat match/target pad out-of-bound write Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 67/68] perf map: Tighten snprintf() string precision to pass gcc check on some 32-bit arches Greg Kroah-Hartman
2021-04-15 14:47 ` [PATCH 4.14 68/68] xen/events: fix setting irq affinity Greg Kroah-Hartman
2021-04-15 22:44 ` [PATCH 4.14 00/68] 4.14.231-rc1 review Shuah Khan
2021-04-15 22:45 ` Shuah Khan
2021-04-16 11:33 ` Naresh Kamboju
2021-04-17  1:00 ` Samuel Zou

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=20210415144415.607728993@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=agordeev@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=iii@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --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).